From 61f8fbe1ceb2a3fe4670bb7097990f7ea4cf3241 Mon Sep 17 00:00:00 2001 From: connor135246 <66351014+connor135246@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:33:30 +0000 Subject: [PATCH] Fix vanilla Anvils, Saplings, and Slabs (#18) * Fix Anvil display * Fix growth stage 1 Saplings * Fix top slabs and "smooth" double slabs * comment on modded anvils * spotless apply * Only fix vanilla anvil modded anvils can do it themselves * Simplify Thinking about this, I don't think there's a need to worry about the smooth double slabs. There's a few reasons: These blocks can only be obtained with commands. The only one this actually matters for is the sandstone one (43:9), since that's the only one that is visually different as well as has the wrong name. Holding 43:9 in your inventory will still have the wrong name anyway. Mods that add the modern minecraft ways of accessing these blocks create their own versions instead of using the old ones. --- .../addons/vanillamc/HUDHandlerVanilla.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/mcp/mobius/waila/addons/vanillamc/HUDHandlerVanilla.java b/src/main/java/mcp/mobius/waila/addons/vanillamc/HUDHandlerVanilla.java index ced2db3f..3199058b 100644 --- a/src/main/java/mcp/mobius/waila/addons/vanillamc/HUDHandlerVanilla.java +++ b/src/main/java/mcp/mobius/waila/addons/vanillamc/HUDHandlerVanilla.java @@ -4,6 +4,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockRedstoneOre; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockWoodSlab; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -44,6 +46,8 @@ public class HUDHandlerVanilla implements IWailaDataProvider { static Block log = Blocks.log; static Block log2 = Blocks.log2; static Block quartz = Blocks.quartz_block; + static Block anvil = Blocks.anvil; + static Block sapling = Blocks.sapling; @Override public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { @@ -96,6 +100,18 @@ public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler return new ItemStack(block, 1, 2); } + if (block == anvil) { + return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata())); + } + + if (block == sapling) { + return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata())); + } + + if (block instanceof BlockStoneSlab || block instanceof BlockWoodSlab) { + return new ItemStack(block, 1, block.damageDropped(accessor.getMetadata())); + } + return null; } @@ -245,6 +261,10 @@ public static void register() { ModuleRegistrar.instance().registerStackProvider(provider, log.getClass()); ModuleRegistrar.instance().registerStackProvider(provider, log2.getClass()); ModuleRegistrar.instance().registerStackProvider(provider, quartz.getClass()); + ModuleRegistrar.instance().registerStackProvider(provider, anvil.getClass()); + ModuleRegistrar.instance().registerStackProvider(provider, sapling.getClass()); + ModuleRegistrar.instance().registerStackProvider(provider, BlockStoneSlab.class); + ModuleRegistrar.instance().registerStackProvider(provider, BlockWoodSlab.class); // ModuleRegistrar.instance().registerStackProvider(provider, Block.class); ModuleRegistrar.instance().registerHeadProvider(provider, mobSpawner.getClass());