Moved common stuff into ItemCustomizable

This commit is contained in:
luisc committed 2025-02-13 18:20:01 -06:00
1 parent d9e6372acb
commit cb5b8898bb
3 files changed
+63 -70

No files matched your search

@@ -24,9 +24,11 @@ import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.ItemEvent;
import noppes.npcs.scripted.item.ScriptCustomItem;
import noppes.npcs.scripted.item.ScriptCustomizableItem;
import org.lwjgl.opengl.GL11;
public class ItemScripted extends ItemCustomizable {
public ItemScripted() {
maxStackSize = 1;
setCreativeTab(CustomItems.tab);
@@ -34,27 +36,6 @@ public class ItemScripted extends ItemCustomizable {
setHasSubtypes(true);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister){
this.itemIcon = Items.iron_pickaxe.getIconFromDamage(0);
}
@Override
public int getColorFromItemStack(ItemStack itemStack, int par2){
return 0x8B4513;
}
@Override
public boolean requiresMultipleRenderPasses(){
return true;
}
@Override
public Item setUnlocalizedName(String name){
GameRegistry.registerItem(this, name);
return super.setUnlocalizedName(name);
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if(player.isSneaking() && player.capabilities.isCreativeMode) {
@@ -64,8 +45,7 @@ public class ItemScripted extends ItemCustomizable {
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, player);
}
}
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack;
return super.onItemRightClick(stack, world, player);
}
@Override
@@ -136,26 +116,6 @@ public class ItemScripted extends ItemCustomizable {
return EventHooks.onScriptItemAttack((ScriptCustomItem) istack, eve);
}
public EnumAction getItemUseAction(ItemStack stack)
{
IItemStack istack = NpcAPI.Instance().getIItemStack(stack);
if (istack instanceof ScriptCustomItem) {
switch (((ScriptCustomItem) istack).getItemUseAction()) {
case 0:
return EnumAction.none;
case 1:
return EnumAction.block;
case 2:
return EnumAction.bow;
case 3:
return EnumAction.eat;
case 4:
return EnumAction.drink;
}
}
return super.getItemUseAction(stack);
}
public void renderOffset(ScriptCustomItem scriptCustomItem) {
GL11.glTranslatef(0.135F * scriptCustomItem.itemDisplay.scaleX, 0.2F * scriptCustomItem.itemDisplay.scaleY, 0.07F * scriptCustomItem.itemDisplay.scaleZ);
}