Added ItemCustomizable abstract class which both scripted and linked items extend from. Common behavior between the classes should move there.

This commit is contained in:
luisc committed 2025-02-13 18:16:53 -06:00
1 parent 44e5c8b4c5
commit d9e6372acb
3 files changed
+11 -8

No files matched your search

@@ -0,0 +1,9 @@
package noppes.npcs.items;
import net.minecraft.item.Item;
public abstract class ItemCustomizable extends Item implements ItemRenderInterface {
@Override
public void renderSpecial() {}
}
@@ -22,7 +22,7 @@ import noppes.npcs.scripted.item.ScriptCustomItem;
import noppes.npcs.scripted.item.ScriptLinkedItem;
import org.lwjgl.opengl.GL11;
public class ItemLinked extends Item implements ItemRenderInterface {
public class ItemLinked extends ItemCustomizable {
public ItemLinked() {
maxStackSize = 1;
@@ -151,9 +151,6 @@ public class ItemLinked extends Item implements ItemRenderInterface {
return super.getItemUseAction(stack);
}
@Override
public void renderSpecial() {}
public void renderOffset(ScriptLinkedItem scriptCustomItem) {
GL11.glTranslatef(0.135F * scriptCustomItem.itemDisplay.scaleX, 0.2F * scriptCustomItem.itemDisplay.scaleY, 0.07F * scriptCustomItem.itemDisplay.scaleZ);
}
@@ -26,7 +26,7 @@ import noppes.npcs.scripted.event.ItemEvent;
import noppes.npcs.scripted.item.ScriptCustomItem;
import org.lwjgl.opengl.GL11;
public class ItemScripted extends Item implements ItemRenderInterface {
public class ItemScripted extends ItemCustomizable {
public ItemScripted() {
maxStackSize = 1;
setCreativeTab(CustomItems.tab);
@@ -156,9 +156,6 @@ public class ItemScripted extends Item implements ItemRenderInterface {
return super.getItemUseAction(stack);
}
@Override
public void renderSpecial() {}
public void renderOffset(ScriptCustomItem scriptCustomItem) {
GL11.glTranslatef(0.135F * scriptCustomItem.itemDisplay.scaleX, 0.2F * scriptCustomItem.itemDisplay.scaleY, 0.07F * scriptCustomItem.itemDisplay.scaleZ);
}