diff --git a/.gitignore b/.gitignore index d4458fd0..4b7242ef 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ hs_err_pid* .metadata/ .recommenders/ -cubyz-client/logs/ \ No newline at end of file +cubyz-client/logs/ +cubyz-client/cache \ No newline at end of file diff --git a/cubyz-client/cache/bedrock.png b/cubyz-client/cache/bedrock.png deleted file mode 100644 index 5f526e3a..00000000 Binary files a/cubyz-client/cache/bedrock.png and /dev/null differ diff --git a/cubyz-client/cache/coal_ore.png b/cubyz-client/cache/coal_ore.png deleted file mode 100644 index a759ae94..00000000 Binary files a/cubyz-client/cache/coal_ore.png and /dev/null differ diff --git a/cubyz-client/cache/diamond_ore.png b/cubyz-client/cache/diamond_ore.png deleted file mode 100644 index e618d099..00000000 Binary files a/cubyz-client/cache/diamond_ore.png and /dev/null differ diff --git a/cubyz-client/cache/dirt.png b/cubyz-client/cache/dirt.png deleted file mode 100644 index 910df490..00000000 Binary files a/cubyz-client/cache/dirt.png and /dev/null differ diff --git a/cubyz-client/cache/emerald_ore.png b/cubyz-client/cache/emerald_ore.png deleted file mode 100644 index 57afb7c0..00000000 Binary files a/cubyz-client/cache/emerald_ore.png and /dev/null differ diff --git a/cubyz-client/cache/gold_ore.png b/cubyz-client/cache/gold_ore.png deleted file mode 100644 index c08d9d8a..00000000 Binary files a/cubyz-client/cache/gold_ore.png and /dev/null differ diff --git a/cubyz-client/cache/iron_ore.png b/cubyz-client/cache/iron_ore.png deleted file mode 100644 index cd37f6ad..00000000 Binary files a/cubyz-client/cache/iron_ore.png and /dev/null differ diff --git a/cubyz-client/cache/oak_leaves.png b/cubyz-client/cache/oak_leaves.png deleted file mode 100644 index 8dbd1aba..00000000 Binary files a/cubyz-client/cache/oak_leaves.png and /dev/null differ diff --git a/cubyz-client/cache/oak_log.png b/cubyz-client/cache/oak_log.png deleted file mode 100644 index 12c3be6e..00000000 Binary files a/cubyz-client/cache/oak_log.png and /dev/null differ diff --git a/cubyz-client/cache/ruby_ore.png b/cubyz-client/cache/ruby_ore.png deleted file mode 100644 index 3d33812e..00000000 Binary files a/cubyz-client/cache/ruby_ore.png and /dev/null differ diff --git a/cubyz-client/cache/sand.png b/cubyz-client/cache/sand.png deleted file mode 100644 index 48e4e6a9..00000000 Binary files a/cubyz-client/cache/sand.png and /dev/null differ diff --git a/cubyz-client/cache/stone.png b/cubyz-client/cache/stone.png deleted file mode 100644 index c1aa8f5a..00000000 Binary files a/cubyz-client/cache/stone.png and /dev/null differ diff --git a/cubyz-client/cache/water.png b/cubyz-client/cache/water.png deleted file mode 100644 index 993eae16..00000000 Binary files a/cubyz-client/cache/water.png and /dev/null differ diff --git a/cubyz-client/src/io/cubyz/client/Cubyz.java b/cubyz-client/src/io/cubyz/client/Cubyz.java index 359d38dd..bba376c9 100644 --- a/cubyz-client/src/io/cubyz/client/Cubyz.java +++ b/cubyz-client/src/io/cubyz/client/Cubyz.java @@ -130,6 +130,13 @@ public class Cubyz implements IGameLogic { @Override public void init(Window window) throws Exception { + // Delete cache + File cache = new File("cache"); + if (cache.exists()) { + for (File f : cache.listFiles()) { + f.delete(); + } + } //CubzLogger.useDefaultHandler = true; gameUI = new UISystem(); gameUI.init(window); @@ -273,6 +280,8 @@ public class Cubyz implements IGameLogic { public static final ArrayList EMPTY_CHUNK_LIST = new ArrayList(); public static final Block[] EMPTY_BLOCK_LIST = new Block[0]; + float playerBobbing; + boolean bobbingUp; @Override public void render(Window window) { if (window.shouldClose()) { @@ -280,13 +289,29 @@ public class Cubyz implements IGameLogic { } if (world != null) { + if (playerInc.x != 0 || playerInc.z != 0) { // while walking + if (bobbingUp) { + playerBobbing += 0.005f; + if (playerBobbing >= 0.05f) { + bobbingUp = false; + } + } else { + playerBobbing -= 0.005f; + if (playerBobbing <= -0.05f) { + bobbingUp = true; + } + } + } else { + //System.out.println("no bobbing"); + //playerBobbing = 0; + } if (playerInc.y != 0) { world.getLocalPlayer().vy = playerInc.y; } if (playerInc.x != 0) { world.getLocalPlayer().vx = playerInc.x; } - ctx.getCamera().setPosition(world.getLocalPlayer().getPosition().x, world.getLocalPlayer().getPosition().y + 1.5f, world.getLocalPlayer().getPosition().z); + ctx.getCamera().setPosition(world.getLocalPlayer().getPosition().x, world.getLocalPlayer().getPosition().y + 1.5f + playerBobbing, world.getLocalPlayer().getPosition().z); } if (world != null) { renderer.render(window, ctx, new Vector3f(0.3F, 0.3F, 0.3F), light, world.getChunks(), world.getBlocks()); diff --git a/cubyz-client/src/io/cubyz/client/CubyzMeshSelectionDetector.java b/cubyz-client/src/io/cubyz/client/CubyzMeshSelectionDetector.java index dd05f6b4..600ad84d 100644 --- a/cubyz-client/src/io/cubyz/client/CubyzMeshSelectionDetector.java +++ b/cubyz-client/src/io/cubyz/client/CubyzMeshSelectionDetector.java @@ -23,8 +23,8 @@ public class CubyzMeshSelectionDetector { } /** - * Return selected spatial - * @return selected spatial, or null if none. + * Return selected block instance + * @return selected block instance, or null if none. */ public BlockInstance getSelectedBlockInstance() { return selectedSpatial; @@ -37,6 +37,7 @@ public class CubyzMeshSelectionDetector { public void selectSpatial(List chunks, Vector3f position, Vector3f dir) { float closestDistance = Float.POSITIVE_INFINITY; + selectedSpatial = null; for (Chunk ch : chunks) { if(!ch.isLoaded()) continue; diff --git a/cubyz-client/src/io/cubyz/utils/TextureConverter.java b/cubyz-client/src/io/cubyz/utils/TextureConverter.java index 8abf88c7..19681584 100644 --- a/cubyz-client/src/io/cubyz/utils/TextureConverter.java +++ b/cubyz-client/src/io/cubyz/utils/TextureConverter.java @@ -1,6 +1,5 @@ package io.cubyz.utils; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; @@ -37,10 +36,8 @@ public class TextureConverter { System.err.println("Could not read cache of " + name + " texture"); } } - BufferedImage out = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB); + BufferedImage out = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = out.createGraphics(); - g2d.setColor(Color.WHITE); - g2d.fillRect(0, 0, 1024, 1024); g2d.drawImage(in, 0, 0, 512, 512, null); g2d.drawImage(in, 512, 0, 512, 512, null); g2d.drawImage(in, 0, 512, 512, 512, null); diff --git a/cubyz-common/src/io/cubyz/blocks/OakLeaves.java b/cubyz-common/src/io/cubyz/blocks/OakLeaves.java index 18463f3e..83b0b888 100644 --- a/cubyz-common/src/io/cubyz/blocks/OakLeaves.java +++ b/cubyz-common/src/io/cubyz/blocks/OakLeaves.java @@ -7,8 +7,4 @@ public class OakLeaves extends Block { setID("cubyz:oak_leaves"); } - public void update() { - - } - } \ No newline at end of file