Skip to content

Commit

Permalink
Fix unlocalized name of Wool Slabs (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
Worive authored Nov 15, 2024
1 parent d3c3fb1 commit 8a9767f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/main/java/tconstruct/world/itemblocks/WoolSlab1Item.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/tconstruct/world/itemblocks/WoolSlab2Item.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 8a9767f

Please sign in to comment.