Extracted the creation of RegionRenderCache into a method.

Classes extending RegionRenderCache can change the behavior of the cache, allowing to visually change blocks (schematics etc).
This commit is contained in:
Lunatrius 2015-04-19 23:13:16 +02:00
parent de066a86da
commit ea9d805e4f

View file

@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
@@ -124,7 +124,7 @@
return;
}
- regionrendercache = new RegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1);
+ regionrendercache = createRegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1);
p_178581_4_.func_178543_a(compiledchunk);
}
finally
@@ -150,7 +150,7 @@
visgraph.func_178606_a(mutableblockpos);
}
@ -28,3 +37,28 @@
}
EnumWorldBlockLayer[] aenumworldblocklayer = EnumWorldBlockLayer.values();
@@ -374,4 +377,24 @@
{
return this.field_178593_n;
}
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Creates a new RegionRenderCache instance.<br>
+ * Extending classes can change the behavior of the cache, allowing to visually change
+ * blocks (schematics etc).
+ *
+ * @see RegionRenderCache
+ * @param world The world to cache.
+ * @param from The starting position of the chunk minus one on each axis.
+ * @param to The ending position of the chunk plus one on each axis.
+ * @param subtract Padding used internally by the RegionRenderCache constructor to make
+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache.
+ * @return new RegionRenderCache instance
+ */
+ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract)
+ {
+ return new RegionRenderCache(world, from, to, subtract);
+ }
+ /* ========================================= FORGE END ======================================*/
}