Skip to content

Commit

Permalink
Fix vanilla Anvils, Saplings, and Slabs (#18)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
connor135246 authored Feb 22, 2024
1 parent a8a49f2 commit 61f8fbe
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

}
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 61f8fbe

Please sign in to comment.