diff --git a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java index 4f6fbcb..cbfbecf 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java +++ b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java @@ -85,9 +85,9 @@ public class Chunk implements BlockAccess, WorldGenConstants, DataStorage continue; } // check for air. Yes this is stupid, TODO fix this - if (getBlockEntity(x - 1, y, z) == null || getBlockEntity(x + 1, y, z) == null || - getBlockEntity(x, y - 1, z) == null || getBlockEntity(x, y + 1, z) == null || - getBlockEntity(x, y, z - 1) == null || getBlockEntity(x, y, z + 1) == null) + if (getBlockEntity(x - 1, y, z).getModel() == null || getBlockEntity(x + 1, y, z).getModel() == null || + getBlockEntity(x, y - 1, z).getModel() == null || getBlockEntity(x, y + 1, z).getModel() == null || + getBlockEntity(x, y, z - 1).getModel() == null || getBlockEntity(x, y, z + 1).getModel() == null) { renderedBlocks[index(x, y, z)] = block; } } } diff --git a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java index de5470b..555f691 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java +++ b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java @@ -66,7 +66,7 @@ public class BlockRenderer extends Renderer implements WorldGenConstants shader.start(); shader.loadSkyColour(Window.getColour()); shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera); - TexturedModel model = renderList[0].getModel(); +// TexturedModel model = renderList[0].getModel(); if (GingerRegister.getInstance().wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); // @@ -77,9 +77,10 @@ public class BlockRenderer extends Renderer implements WorldGenConstants BlockInstance entity = renderList[Chunk.index(x, y, z)]; if (entity != null && entity.getModel() != null) { - prepTexture(entity.getModel().getTexture(), entity.getModel().getTexture().getTextureID()); + TexturedModel blockModel = entity.getModel(); + prepTexture(blockModel.getTexture(), blockModel.getTexture().getTextureID()); prepBlockInstance(entity); - GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0); + GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0); } } if (GingerRegister.getInstance().wireframe) diff --git a/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java b/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java index 42156c6..56cb21e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java +++ b/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java @@ -1,6 +1,7 @@ package com.github.hydos.ginger.engine.api; import org.joml.Vector2f; +import org.lwjgl.opengl.GL11; import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.logic.Timer;