Skip to content

Commit a17b7ef

Browse files
author
Eurymachus
committed
Small changes to Rendering
attempts to fix non-vanilla TileEntity rendering
1 parent 1cb4f64 commit a17b7ef

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

.project

-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,4 @@
4747
<value>$%7BFORGE_LOC%7D/mcp</value>
4848
</variable>
4949
</variableList>
50-
5150
</projectDescription>

LB-source/littleblocks/client/render/BlockLittleBlocksLittleRenderer.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import net.minecraft.src.ModLoader;
2424
import net.minecraft.tileentity.TileEntity;
2525
import net.minecraft.world.World;
26+
import net.minecraftforge.client.MinecraftForgeClient;
2627

2728
import org.lwjgl.opengl.GL11;
2829

@@ -66,27 +67,26 @@ public void renderBlocks() {
6667
for (String textureFile : this.textures) {
6768
if (this.texturedBlocksToRender.containsKey(textureFile)) {
6869
Tessellator tessellator = Tessellator.instance;
69-
//if (tessellator.isDrawing) {
70-
int mode = tessellator.drawMode;
71-
tessellator.draw();
72-
tessellator.startDrawing(mode);
73-
//}
70+
int mode = tessellator.drawMode;
71+
tessellator.draw();
72+
tessellator.startDrawing(mode);
73+
7474
HashMap<Integer, LittleBlockToRender> littleBlocksToRender = this.texturedBlocksToRender.get(textureFile);
7575
int texture = ModLoader.getMinecraftInstance().renderEngine
7676
.getTexture(textureFile);
7777
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
7878
for (LittleBlockToRender block: littleBlocksToRender.values()) {
79+
//MinecraftForgeClient.renderBlock(LBCore.getLittleRenderer(world), block.block, block.x, block.y, block.z);
7980
LBCore.getLittleRenderer(world).
8081
renderBlockByRenderType(
8182
block.block,
8283
block.x,
8384
block.y,
8485
block.z);
8586
}
86-
//if (tessellator.isDrawing) {
87-
tessellator.draw();
88-
tessellator.startDrawing(mode);
89-
//}
87+
88+
tessellator.draw();
89+
tessellator.startDrawing(mode);
9090
}
9191
}
9292
}

LB-source/littleblocks/client/render/LittleBlocksRenderer.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
5757
}
5858

5959
GL11.glPushMatrix();
60-
tessellator.startDrawingQuads();
60+
int mode = tessellator.drawMode;
61+
tessellator.startDrawing(mode);
6162

6263
double xS = -((x >> 4) << 4), yS = -((y >> 4) << 4), zS = -((z >> 4) << 4);
6364

@@ -72,7 +73,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
7273
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine
7374
.getTexture("/terrain.png"));
7475

75-
int mode = tessellator.drawMode;
76+
mode = tessellator.drawMode;
7677
if (tessellator.isDrawing) {
7778
tessellator.draw();
7879
}

LB-source/littleblocks/client/render/TileEntityLittleBlocksRenderer.java

+30-23
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
import org.lwjgl.opengl.GL11;
1717
import org.lwjgl.opengl.GL12;
1818

19+
import cpw.mods.fml.common.FMLCommonHandler;
20+
1921
public class TileEntityLittleBlocksRenderer extends TileEntitySpecialRenderer {
20-
22+
2123
@Override
2224
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
2325
renderTileEntityLittleBlocks(
@@ -56,15 +58,15 @@ private void renderTileEntityLittleBlocks(TileEntityLittleBlocks tile, double x,
5658
}
5759
}
5860

59-
Tessellator tessellator = Tessellator.instance;
60-
int mode = tessellator.drawMode;
61+
//Tessellator tessellator = Tessellator.instance;
62+
//int mode = tessellator.drawMode;
6163

62-
if (tessellator.isDrawing) {
63-
tessellator.draw();
64-
}
64+
//if (tessellator.isDrawing) {
65+
// tessellator.draw();
66+
//}
6567

6668
GL11.glPushMatrix();
67-
tessellator.startDrawing(mode);
69+
//tessellator.startDrawing(mode);
6870

6971
GL11.glTranslated(x, y, z);
7072
GL11.glTranslated(-tile.xCoord, -tile.yCoord, -tile.zCoord);
@@ -86,35 +88,40 @@ private void renderTileEntityLittleBlocks(TileEntityLittleBlocks tile, double x,
8688

8789
renderTiles(littleBlocks, tile, f);
8890

89-
this.bindTextureByName("/terrain.png");
91+
//this.bindTextureByName("/terrain.png");
9092

91-
if (tessellator.isDrawing) {
92-
tessellator.draw();
93-
}
93+
//if (tessellator.isDrawing) {
94+
// tessellator.draw();
95+
//}
9496

9597
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
9698
GL11.glPopMatrix();
97-
tessellator.startDrawing(mode);
98-
tessellator.draw();
99+
//tessellator.startDrawing(mode);
100+
//tessellator.draw();
99101
}
100102

101103
public void renderTiles(BlockLittleBlocksLittleRenderer littleBlocks, TileEntityLittleBlocks tile, float f) {
102104
for (String textureFile : littleBlocks.textures) {
103105
if (littleBlocks.texturedBlocksToRender.containsKey(textureFile)) {
104-
Tessellator tessellator = Tessellator.instance;
105-
int mode = tessellator.drawMode;
106-
if (tessellator.isDrawing) {
107-
tessellator.draw();
108-
}
109-
tessellator.startDrawing(mode);
106+
//Tessellator tessellator = Tessellator.instance;
107+
//int mode = tessellator.drawMode;
108+
//if (tessellator.isDrawing) {
109+
// tessellator.draw();
110+
// tessellator.startDrawing(mode);
111+
//}
112+
ModLoader.getLogger().fine("[LittleBlocks]-TileRender-Texture["+textureFile+"]");
113+
//this.bindTextureByName(textureFile);
114+
//if (tessellator.isDrawing) {
115+
// tessellator.draw();
116+
//}
110117
HashMap<Integer, BlockLittleBlocksLittleRenderer.LittleBlockToRender> littleBlocksToRender = littleBlocks.texturedBlocksToRender.get(textureFile);
111-
this.bindTextureByName(textureFile);
112118
for (LittleBlockToRender block: littleBlocksToRender.values()) {
113119
TileEntity littleTile = tile.getLittleWorld().getBlockTileEntity(
114120
block.x,
115121
block.y,
116122
block.z);
117123
if (littleTile != null) {
124+
ModLoader.getLogger().fine("[LittleBlocks]-TileRender-Tile["+littleTile.toString()+"]");
118125
tileEntityRenderer.renderTileEntityAt(
119126
littleTile,
120127
littleTile.xCoord,
@@ -123,9 +130,9 @@ public void renderTiles(BlockLittleBlocksLittleRenderer littleBlocks, TileEntity
123130
f);
124131
}
125132
}
126-
if (tessellator.isDrawing) {
127-
tessellator.draw();
128-
}
133+
//if (tessellator.isDrawing) {
134+
// tessellator.draw();
135+
//}
129136
}
130137
}
131138
}

0 commit comments

Comments
 (0)