Fixed RenderTypeLookup loosing mappings for registry replacements. (#6452)

This commit is contained in:
Brennan Ward 2020-01-22 14:23:42 -05:00 committed by LexManos
parent ad7e4e95ae
commit 68ce113c5b

View file

@ -46,8 +46,8 @@
+ // FORGE START + // FORGE START
+ +
+ private static final Map<Block, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap(); + private static final Map<net.minecraftforge.registries.IRegistryDelegate<Block>, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap();
+ private static final Map<Fluid, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap(); + private static final Map<net.minecraftforge.registries.IRegistryDelegate<Fluid>, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap();
+ static { + static {
+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); + field_228386_a_.forEach(RenderTypeLookup::setRenderLayer);
+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); + field_228387_b_.forEach(RenderTypeLookup::setRenderLayer);
@ -60,7 +60,7 @@
+ } else { + } else {
+ java.util.function.Predicate<RenderType> rendertype; + java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) { + synchronized (RenderTypeLookup.class) {
+ rendertype = blockRenderChecks.get(block); + rendertype = blockRenderChecks.get(block.delegate);
+ } + }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); + return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ } + }
@ -69,7 +69,7 @@
+ public static boolean canRenderInLayer(IFluidState fluid, RenderType type) { + public static boolean canRenderInLayer(IFluidState fluid, RenderType type) {
+ java.util.function.Predicate<RenderType> rendertype; + java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) { + synchronized (RenderTypeLookup.class) {
+ rendertype = fluidRenderChecks.get(fluid.func_206886_c()); + rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate);
+ } + }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); + return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ } + }
@ -80,7 +80,7 @@
+ } + }
+ +
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) { + public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ blockRenderChecks.put(block, predicate); + blockRenderChecks.put(block.delegate, predicate);
+ } + }
+ +
+ public static void setRenderLayer(Fluid fluid, RenderType type) { + public static void setRenderLayer(Fluid fluid, RenderType type) {
@ -89,7 +89,7 @@
+ } + }
+ +
+ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) { + public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) {
+ fluidRenderChecks.put(fluid, predicate); + fluidRenderChecks.put(fluid.delegate, predicate);
+ } + }
+ +
public static void func_228393_a_(boolean p_228393_0_) { public static void func_228393_a_(boolean p_228393_0_) {