42 lines
2.0 KiB
Diff
42 lines
2.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/color/BlockColors.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/color/BlockColors.java
|
|
@@ -27,7 +27,8 @@
|
|
@SideOnly(Side.CLIENT)
|
|
public class BlockColors
|
|
{
|
|
- private final ObjectIntIdentityMap<IBlockColor> field_186725_a = new ObjectIntIdentityMap<IBlockColor>(32);
|
|
+ // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant
|
|
+ private final java.util.Map<net.minecraftforge.fml.common.registry.RegistryDelegate<Block>, IBlockColor> blockColorMap = com.google.common.collect.Maps.newHashMap();
|
|
|
|
public static BlockColors func_186723_a()
|
|
{
|
|
@@ -164,7 +165,7 @@
|
|
|
|
public int func_189991_a(IBlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_)
|
|
{
|
|
- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Block.func_149682_b(p_189991_1_.func_177230_c()));
|
|
+ IBlockColor iblockcolor = this.blockColorMap.get(p_189991_1_.func_177230_c().delegate);
|
|
|
|
if (iblockcolor != null)
|
|
{
|
|
@@ -179,7 +180,7 @@
|
|
|
|
public int func_186724_a(IBlockState p_186724_1_, @Nullable IBlockAccess p_186724_2_, @Nullable BlockPos p_186724_3_, int p_186724_4_)
|
|
{
|
|
- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Block.func_149682_b(p_186724_1_.func_177230_c()));
|
|
+ IBlockColor iblockcolor = this.blockColorMap.get(p_186724_1_.func_177230_c().delegate);
|
|
return iblockcolor == null ? -1 : iblockcolor.func_186720_a(p_186724_1_, p_186724_2_, p_186724_3_, p_186724_4_);
|
|
}
|
|
|
|
@@ -187,7 +188,9 @@
|
|
{
|
|
for (Block block : p_186722_2_)
|
|
{
|
|
- this.field_186725_a.func_148746_a(p_186722_1_, Block.func_149682_b(block));
|
|
+ if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
|
|
+ if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
|
|
+ this.blockColorMap.put(block.delegate, p_186722_1_);
|
|
}
|
|
}
|
|
}
|