Add state param to canRenderInLayer

This commit is contained in:
tterrag1098 2016-04-01 03:12:01 -04:00
parent 74a0709356
commit 5862aaf3a0
2 changed files with 15 additions and 3 deletions

View File

@ -201,7 +201,7 @@
}
@SideOnly(Side.CLIENT)
@@ -844,6 +866,1179 @@
@@ -844,6 +866,1191 @@
return "Block{" + field_149771_c.func_177774_c(this) + "}";
}
@ -1286,12 +1286,24 @@
+
+ /**
+ * Queries if this block should render in a given layer.
+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer
+ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer.
+ *
+ * @deprecated New method with state sensitivity: {@link #canRenderInLayer(IBlockState, BlockRenderLayer)}
+ */
+ @Deprecated
+ public boolean canRenderInLayer(BlockRenderLayer layer)
+ {
+ return func_180664_k() == layer;
+ }
+
+ /**
+ * Queries if this block should render in a given layer.
+ * ISmartBlockModel can use {@link MinecraftForgeClient#getRenderLayer()} to alter their model based on layer.
+ */
+ public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
+ {
+ return canRenderInLayer(layer);
+ }
+
+ // For Internal use only to capture droped items inside getDrops
+ protected static ThreadLocal<Boolean> captureDrops = new ThreadLocal<Boolean>()

View File

@ -26,7 +26,7 @@
- BlockRenderLayer blockrenderlayer1 = block.func_180664_k();
+ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) {
+ if(!block.canRenderInLayer(blockrenderlayer1)) continue;
+ if(!block.canRenderInLayer(iblockstate, blockrenderlayer1)) continue;
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1);
int j = blockrenderlayer1.ordinal();