Skip to content

Commit

Permalink
add rotated icon while in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
botn365 committed Apr 28, 2024
1 parent e92a1b6 commit 208e534
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import com.gtnewhorizon.structurelib.StructureLib;
import com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

Expand All @@ -15,6 +19,10 @@
import static net.minecraft.util.StatCollector.translateToLocal;

public class ItemConstructableTrigger extends Item {

@SideOnly(Side.CLIENT)
private IIcon debugModeIcon;

public ItemConstructableTrigger() {
setUnlocalizedName("structurelib.constructableTrigger");
setTextureName(MOD_ID + ":itemConstructableTrigger");
Expand All @@ -39,6 +47,18 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world,
return ConstructableUtility.handle(stack, player, world, x, y, z, side);
}

@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister iconRegister) {
super.registerIcons(iconRegister);
this.debugModeIcon = iconRegister.registerIcon(MOD_ID + ":itemConstructableTriggerDebug");
}

@Override
public IIcon getIconIndex(ItemStack itemStack) {
return itemStack.getItemDamage() == 1 ? debugModeIcon : itemIcon;
}

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 208e534

Please sign in to comment.