Skip to content

Commit 7e282a2

Browse files
committed
Fix compile errors for mini model
1 parent ad6f942 commit 7e282a2

File tree

2 files changed

+50
-51
lines changed

2 files changed

+50
-51
lines changed

src/main/java/io/github/cadiboo/examplemod/client/render/MiniModel.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@
55
/**
66
* A wrapper around ChunkRender.
77
* Stores the a render of the chunk (16x16x16) surrounding a TileEntity
8+
* TODO: Make this work on 1.15
89
*
910
* @author Cadiboo
1011
*/
1112
public class MiniModel {
1213

13-
// // Cache the result of BlockRenderLayer.values() instead of calling BlockRenderLayer.values()
14-
// // each time (because each call creates a new BlockRenderLayer[] which is wasteful)
15-
// public static final BlockRenderLayer[] BLOCK_RENDER_LAYERS = BlockRenderLayer.values();
16-
//
1714
// // We only create one of these per cache, we reset it each time we rebuild
1815
// public final RegionRenderCacheBuilder regionRenderCacheBuilder;
1916
// private final ChunkRender chunkRender;
2017
// public ChunkRenderTask generator;
21-
private boolean isBuilt = false;
18+
private boolean isCompiled = false;
2219

2320
// private MiniModel(final ChunkRender chunkRender, final RegionRenderCacheBuilder regionRenderCacheBuilder) {
2421
// this.chunkRender = chunkRender;
@@ -39,7 +36,7 @@ public static MiniModel forTileEntity(final TileEntity tileEntity) {
3936
/**
4037
* (re)build the render
4138
*/
42-
public void rebuild() {
39+
public void compile() {
4340
// final ChunkRender chunkRender = this.chunkRender;
4441
// final RegionRenderCacheBuilder buffers = this.regionRenderCacheBuilder;
4542
//
@@ -67,8 +64,8 @@ public void rebuild() {
6764
// this.isBuilt = true;
6865
}
6966

70-
public boolean isBuilt() {
71-
return isBuilt;
67+
public boolean isCompiled() {
68+
return isCompiled;
7269
}
7370

7471
}

src/main/java/io/github/cadiboo/examplemod/client/render/tileentity/MiniModelTileEntityRenderer.java

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* This should really probably not be in an examplemod for beginners,
2525
* but I added comments to it so its all good
2626
*
27+
* TODO: Update this to 1.15
28+
*
2729
* @author Cadiboo
2830
*/
2931
public class MiniModelTileEntityRenderer extends TileEntityRenderer<MiniModelTileEntity> {
@@ -36,33 +38,33 @@ public MiniModelTileEntityRenderer(final TileEntityRendererDispatcher tileEntity
3638
* Render our TileEntity
3739
*/
3840
@Override
39-
public void func_225616_a_(final MiniModelTileEntity tileEntityIn, final float partialTicks, final MatrixStack matrixStack, final IRenderTypeBuffer renderTypeBuffer, final int packedLight, final int backupPackedLight) {
40-
41-
final MiniModel miniModel = tileEntityIn.miniModel;
42-
43-
if (miniModel == null)
44-
return;
45-
46-
if (!miniModel.isBuilt())
47-
miniModel.rebuild();
48-
49-
// Setup correct GL state
50-
// this.field_228858_b_.textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
51-
RenderHelper.disableStandardItemLighting();
52-
// Translucency
53-
if (ExampleModConfig.modelTranslucency) {
54-
RenderSystem.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
55-
} else {
56-
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
57-
}
58-
RenderSystem.enableBlend();
59-
60-
if (Minecraft.isAmbientOcclusionEnabled()) {
61-
RenderSystem.shadeModel(GL11.GL_SMOOTH);
62-
} else {
63-
RenderSystem.shadeModel(GL11.GL_FLAT);
64-
}
41+
public void render(final MiniModelTileEntity tileEntityIn, final float partialTicks, final MatrixStack matrixStack, final IRenderTypeBuffer renderTypeBuffer, final int packedLight, final int backupPackedLight) {
6542

43+
// final MiniModel miniModel = tileEntityIn.miniModel;
44+
//
45+
// if (miniModel == null)
46+
// return;
47+
//
48+
// if (!miniModel.isBuilt())
49+
// miniModel.rebuild();
50+
//
51+
// // Setup correct GL state
52+
//// this.field_228858_b_.textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
53+
// RenderHelper.disableStandardItemLighting();
54+
// // Translucency
55+
// if (ExampleModConfig.modelTranslucency) {
56+
// RenderSystem.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
57+
// } else {
58+
// RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
59+
// }
60+
// RenderSystem.enableBlend();
61+
//
62+
// if (Minecraft.isAmbientOcclusionEnabled()) {
63+
// RenderSystem.shadeModel(GL11.GL_SMOOTH);
64+
// } else {
65+
// RenderSystem.shadeModel(GL11.GL_FLAT);
66+
// }
67+
//
6668
// GlStateManager.pushMatrix();
6769
//
6870
// // Translate to render pos. The 0.5 is to translate into the centre of the block, rather than to the corner of it
@@ -110,22 +112,22 @@ public boolean isGlobalRenderer(final MiniModelTileEntity te) {
110112
// }
111113
// }
112114
// }
113-
114-
/**
115-
* This should work.
116-
* Draws a BufferBuilder without resetting its internal data.
117-
*
118-
* @param bufferBuilder The BufferBuilder to draw (but not reset)
119-
*/
120-
private void drawBufferWithoutResetting(final BufferBuilder bufferBuilder) {
121-
// Get the internal data from the BufferBuilder (This resets the BufferBuilder's own copy of this data)
122-
final ByteBuffer byteBuffer = bufferBuilder.func_227832_f_().getSecond();
123-
// Set the BufferBuilder's internal data to the original data
124-
bufferBuilder.putBulkData(byteBuffer);
125-
// Draw the BufferBuilder (This resets the BufferBuilder's data)
126-
WorldVertexBufferUploader.draw(bufferBuilder);
127-
// Set the BufferBuilder's internal data back to the original data
128-
bufferBuilder.putBulkData(byteBuffer);
129-
}
115+
//
116+
// /**
117+
// * This should work.
118+
// * Draws a BufferBuilder without resetting its internal data.
119+
// *
120+
// * @param bufferBuilder The BufferBuilder to draw (but not reset)
121+
// */
122+
// private void drawBufferWithoutResetting(final BufferBuilder bufferBuilder) {
123+
// // Get the internal data from the BufferBuilder (This resets the BufferBuilder's own copy of this data)
124+
// final ByteBuffer byteBuffer = bufferBuilder.getAndResetData().getSecond();
125+
// // Set the BufferBuilder's internal data to the original data
126+
// bufferBuilder.putBulkData(byteBuffer);
127+
// // Draw the BufferBuilder (This resets the BufferBuilder's data)
128+
// WorldVertexBufferUploader.draw(bufferBuilder);
129+
// // Set the BufferBuilder's internal data back to the original data
130+
// bufferBuilder.putBulkData(byteBuffer);
131+
// }
130132

131133
}

0 commit comments

Comments
 (0)