summaryrefslogtreecommitdiff
path: root/ihl/model/IHLBlockRenderer.java
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-06-17 08:12:18 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-06-17 08:12:18 +0300
commitdc3df3edd5843bde0c1335d6a8e460b2c832aa48 (patch)
treeaf13bfeee567f2351e35e1ef176d168fe37c8aac /ihl/model/IHLBlockRenderer.java
parent1da8dcd58647e34c9af94ceeecaeaf3b0d08c48c (diff)
full project files
Diffstat (limited to 'ihl/model/IHLBlockRenderer.java')
-rw-r--r--ihl/model/IHLBlockRenderer.java78
1 files changed, 0 insertions, 78 deletions
diff --git a/ihl/model/IHLBlockRenderer.java b/ihl/model/IHLBlockRenderer.java
deleted file mode 100644
index 81efbd9..0000000
--- a/ihl/model/IHLBlockRenderer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package ihl.model;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import ihl.handpump.BlockWithCoordinates;
-import net.minecraft.client.renderer.GLAllocation;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.world.ChunkCache;
-import net.minecraft.world.World;
-
-@SideOnly(value=Side.CLIENT)
-public class IHLBlockRenderer {
-
- private RenderBlocks renderBlocks;
- private final Map<BlockWithCoordinates, Integer> renderCache = new HashMap<BlockWithCoordinates, Integer>();
- public static IHLBlockRenderer instance;
-
- public IHLBlockRenderer()
- {
- renderBlocks=RenderBlocks.getInstance();
- instance=this;
- }
-
- public void refreshDisplayLists(int diplayLists, List<BlockWithCoordinates> bwc, ChunkCache iBlockAccess)
- {
- if (bwc==null || bwc.isEmpty())
- {
- return;
- }
- renderBlocks.blockAccess=iBlockAccess;
- GL11.glNewList(diplayLists, 4864 /*GL_COMPILE*/);
- Iterator<BlockWithCoordinates> bwci = bwc.iterator();
- while(bwci.hasNext())
- {
- BlockWithCoordinates bwce = bwci.next();
- renderBlock(bwce);
- }
- GL11.glEndList();
- }
-
-
- public int getBlockDisplayLists(BlockWithCoordinates bwc, World world) {
- if (bwc.block == null)
- {
- return -1;
- }
- if(renderCache.containsKey(bwc))
- {
- return renderCache.get(bwc);
- }
- int diplayLists = GLAllocation.generateDisplayLists(1);
- if(renderBlocks.blockAccess==null || !renderBlocks.blockAccess.equals(world))
- {
- renderBlocks.blockAccess=world;
- }
- GL11.glNewList(diplayLists, 4864 /*GL_COMPILE*/);
- renderBlock(bwc);
- GL11.glEndList();
- renderCache.put(bwc, diplayLists);
- return diplayLists;
- }
-
- private void renderBlock(BlockWithCoordinates bwc)
- {
- Tessellator tessellator = Tessellator.instance;
- tessellator.startDrawingQuads();
- renderBlocks.renderBlockByRenderType(bwc.block, bwc.x, bwc.y, bwc.z);
- tessellator.draw();
- }
-}