diff --git a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java index f0467234f..1e865944f 100644 --- a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java +++ b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/api/blockrenderlayer/v1/BlockRenderLayerMap.java @@ -20,7 +20,6 @@ import net.minecraft.block.Block; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayers; import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl; @@ -56,20 +55,6 @@ public interface BlockRenderLayerMap { */ void putBlocks(RenderLayer renderLayer, Block... blocks); - /** - * @deprecated For blocks, calling {@link #putBlock(Block, RenderLayer)} is enough. - * Other items always use a translucent render layer. - */ - @Deprecated(forRemoval = true) - void putItem(Item item, RenderLayer renderLayer); - - /** - * @deprecated For blocks, calling {@link #putBlocks(RenderLayer, Block...)} is enough. - * Other items always use a translucent render layer. - */ - @Deprecated(forRemoval = true) - void putItems(RenderLayer renderLayer, Item... items); - /** * Map (or re-map) a fluid state with a render layer. Re-mapping is not recommended but if done, last one in wins. * Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer. diff --git a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/impl/blockrenderlayer/BlockRenderLayerMapImpl.java b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/impl/blockrenderlayer/BlockRenderLayerMapImpl.java index 99c5f0569..d8353d1ec 100644 --- a/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/impl/blockrenderlayer/BlockRenderLayerMapImpl.java +++ b/fabric-blockrenderlayer-v1/src/client/java/net/fabricmc/fabric/impl/blockrenderlayer/BlockRenderLayerMapImpl.java @@ -23,7 +23,6 @@ import java.util.function.BiConsumer; import net.minecraft.block.Block; import net.minecraft.client.render.RenderLayer; import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; @@ -32,8 +31,8 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap { @Override public void putBlock(Block block, RenderLayer renderLayer) { - if (block == null) throw new IllegalArgumentException("Request to map null block to BlockRenderLayer"); - if (renderLayer == null) throw new IllegalArgumentException("Request to map block " + block.toString() + " to null BlockRenderLayer"); + if (block == null) throw new IllegalArgumentException("Request to map null block to RenderLayer"); + if (renderLayer == null) throw new IllegalArgumentException("Request to map block " + block.toString() + " to null RenderLayer"); blockHandler.accept(block, renderLayer); } @@ -45,25 +44,10 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap { } } - @Override - public void putItem(Item item, RenderLayer renderLayer) { - if (item == null) throw new IllegalArgumentException("Request to map null item to BlockRenderLayer"); - if (renderLayer == null) throw new IllegalArgumentException("Request to map item " + item.toString() + " to null BlockRenderLayer"); - - itemHandler.accept(item, renderLayer); - } - - @Override - public void putItems(RenderLayer renderLayer, Item... items) { - for (Item item : items) { - putItem(item, renderLayer); - } - } - @Override public void putFluid(Fluid fluid, RenderLayer renderLayer) { - if (fluid == null) throw new IllegalArgumentException("Request to map null fluid to BlockRenderLayer"); - if (renderLayer == null) throw new IllegalArgumentException("Request to map fluid " + fluid.toString() + " to null BlockRenderLayer"); + if (fluid == null) throw new IllegalArgumentException("Request to map null fluid to RenderLayer"); + if (renderLayer == null) throw new IllegalArgumentException("Request to map fluid " + fluid.toString() + " to null RenderLayer"); fluidHandler.accept(fluid, renderLayer); } @@ -75,27 +59,20 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap { } } - private static Map blockRenderLayerMap = new HashMap<>(); - private static Map itemRenderLayerMap = new HashMap<>(); - private static Map fluidRenderLayerMap = new HashMap<>(); + private static final Map BLOCK_RENDER_LAYER_MAP = new HashMap<>(); + private static final Map FLUID_RENDER_LAYER_MAP = new HashMap<>(); - //This consumers initially add to the maps above, and then are later set (when initialize is called) to insert straight into the target map. - private static BiConsumer blockHandler = (b, l) -> blockRenderLayerMap.put(b, l); - private static BiConsumer itemHandler = (i, l) -> itemRenderLayerMap.put(i, l); - private static BiConsumer fluidHandler = (f, b) -> fluidRenderLayerMap.put(f, b); + // These consumers initially add to the maps above, and then are later set (when initialize is called) to insert straight into the target map. + private static BiConsumer blockHandler = BLOCK_RENDER_LAYER_MAP::put; + private static BiConsumer fluidHandler = FLUID_RENDER_LAYER_MAP::put; public static void initialize(BiConsumer blockHandlerIn, BiConsumer fluidHandlerIn) { - //Done to handle backwards compat, in previous snapshots Items had their own map for render layers, now the BlockItem is used. - BiConsumer itemHandlerIn = (item, renderLayer) -> blockHandlerIn.accept(Block.getBlockFromItem(item), renderLayer); + // Add all the preexisting render layers + BLOCK_RENDER_LAYER_MAP.forEach(blockHandlerIn); + FLUID_RENDER_LAYER_MAP.forEach(fluidHandlerIn); - //Add all the pre existing render layers - blockRenderLayerMap.forEach(blockHandlerIn); - itemRenderLayerMap.forEach(itemHandlerIn); - fluidRenderLayerMap.forEach(fluidHandlerIn); - - //Set the handlers to directly accept later additions + // Set the handlers to directly accept later additions blockHandler = blockHandlerIn; - itemHandler = itemHandlerIn; fluidHandler = fluidHandlerIn; } }