From 8a9767f40b78927b919441dd84daaace8277de14 Mon Sep 17 00:00:00 2001 From: Worive <13164341+Worive@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:20:15 +0100 Subject: [PATCH] Fix unlocalized name of Wool Slabs (#135) --- .../tconstruct/world/itemblocks/WoolSlab1Item.java | 12 +++++++++--- .../tconstruct/world/itemblocks/WoolSlab2Item.java | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/tconstruct/world/itemblocks/WoolSlab1Item.java b/src/main/java/tconstruct/world/itemblocks/WoolSlab1Item.java index 4b72b86397f..3e70e2b0ba9 100644 --- a/src/main/java/tconstruct/world/itemblocks/WoolSlab1Item.java +++ b/src/main/java/tconstruct/world/itemblocks/WoolSlab1Item.java @@ -1,11 +1,11 @@ package tconstruct.world.itemblocks; import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; import mantle.blocks.abstracts.MultiItemBlock; @@ -24,8 +24,14 @@ public WoolSlab1Item(Block b) { @Override public String getUnlocalizedName(ItemStack par1ItemStack) { - int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 7); - return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[7 - i] + ".slab"; + int dyePos = par1ItemStack.getItemDamage(); + + if (dyePos >= 8) { + dyePos -= 8; + } + + int dye = BlockColored.func_150032_b(dyePos); + return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[dye] + ".slab"; } @Override diff --git a/src/main/java/tconstruct/world/itemblocks/WoolSlab2Item.java b/src/main/java/tconstruct/world/itemblocks/WoolSlab2Item.java index 950aed708d1..6a11c121a8b 100644 --- a/src/main/java/tconstruct/world/itemblocks/WoolSlab2Item.java +++ b/src/main/java/tconstruct/world/itemblocks/WoolSlab2Item.java @@ -1,11 +1,11 @@ package tconstruct.world.itemblocks; import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; import mantle.blocks.abstracts.MultiItemBlock; @@ -29,8 +29,14 @@ public int getMetadata(int meta) { @Override public String getUnlocalizedName(ItemStack par1ItemStack) { - int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 7, 15); - return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[15 - i] + ".slab"; + int dyePos = par1ItemStack.getItemDamage(); + + if (dyePos < 8) { + dyePos += 8; + } + + int dye = BlockColored.func_150032_b(dyePos); + return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[dye] + ".slab"; } @Override