mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 19:59:56 +00:00
LinkedItem Things
This commit is contained in:
1 parent
eb8b5387ea
commit
f51c636b79
6 files changed
+118
-6
No files matched your search
@@ -77,8 +77,10 @@ public class GuiNPCManageLinked extends GuiNPCInterface2 implements IScrollData,
|
||||
|
||||
this.addButton(new GuiNpcButton(3,guiLeft + 368, y += 22, 45, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 368, y += 22, 45, 20, "gui.copy"));
|
||||
this.addButton(new GuiNpcButton(5,guiLeft + 368, y += 22, 45, 20, "gui.build"));
|
||||
getButton(3).enabled = tab == 1;
|
||||
getButton(4).enabled = tab == 1;
|
||||
getButton(5).enabled = tab == 1;
|
||||
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0,0);
|
||||
@@ -234,6 +236,12 @@ public class GuiNPCManageLinked extends GuiNPCInterface2 implements IScrollData,
|
||||
if(button.id == 3){
|
||||
setSubGui(new SubGuiLinkedItem(this, this.linkedItem));
|
||||
}
|
||||
if(button.id == 5){
|
||||
// Build Linked Item
|
||||
if(tab == 1)
|
||||
PacketClient.sendClient(new LinkedItemBuildPacket(this.linkedItem.getId()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,9 +325,6 @@ public class GuiNPCManageLinked extends GuiNPCInterface2 implements IScrollData,
|
||||
if(!((SubGuiEditText)subgui).cancelled){
|
||||
PacketClient.sendClient(new LinkedNPCAddPacket(((SubGuiEditText)subgui).text));
|
||||
}
|
||||
}
|
||||
else if (subgui instanceof SubGuiLinkedItem){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import noppes.npcs.api.item.IItemCustomizable;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import noppes.npcs.items.ItemCustomizable;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
@@ -142,7 +142,7 @@ public class CustomItemRenderer implements IItemRenderer {
|
||||
GL11.glTranslatef(0.9375F, 0.0625F, 0.0F);
|
||||
GL11.glRotatef(-315.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
((ItemScripted) itemStack.getItem()).renderOffset(scriptCustomItem);
|
||||
((ItemCustomizable) itemStack.getItem()).renderOffset(scriptCustomItem);
|
||||
if(scriptCustomItem.isNormalItem()){
|
||||
GL11.glTranslatef(-0.05F, 0.3F, 0.3F);
|
||||
GL11.glRotatef(50, 1, 0, 0);
|
||||
|
||||
@@ -16,6 +16,33 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
|
||||
loadItemData();
|
||||
}
|
||||
|
||||
// For Building
|
||||
public ScriptLinkedItem(ItemStack item, NBTTagCompound linkedData) {
|
||||
super(item);
|
||||
setDefaults();
|
||||
this.linkedItem = new LinkedItem();
|
||||
this.linkedItem.readFromNBT(linkedData, false);
|
||||
}
|
||||
|
||||
public void setDefaults(){
|
||||
this.itemDisplay.texture = null;
|
||||
this.itemDisplay.translateX = null;
|
||||
this.itemDisplay.translateY = null;
|
||||
this.itemDisplay.translateZ = null;
|
||||
this.itemDisplay.itemColor = null;
|
||||
this.itemDisplay.scaleX = null;
|
||||
this.itemDisplay.scaleY = null;
|
||||
this.itemDisplay.scaleZ = null;
|
||||
this.itemDisplay.rotationX = null;
|
||||
this.itemDisplay.rotationY = null;
|
||||
this.itemDisplay.rotationZ = null;
|
||||
this.itemDisplay.rotationXRate = null;
|
||||
this.itemDisplay.rotationYRate = null;
|
||||
this.itemDisplay.rotationZRate = null;
|
||||
this.itemDisplay.durabilityShow = null;
|
||||
this.itemDisplay.durabilityColor = null;
|
||||
}
|
||||
|
||||
public LinkedItem getLinkedItem() {
|
||||
return LinkedItemController.getInstance().get(this.linkedItem.getId());
|
||||
}
|
||||
@@ -175,6 +202,8 @@ public class ScriptLinkedItem extends ScriptCustomizableItem implements IItemLin
|
||||
|
||||
public void setItemNBT(NBTTagCompound compound) {
|
||||
this.itemDisplay.readFromNBT(compound);
|
||||
if(linkedItem == null)
|
||||
this.linkedItem = new LinkedItem();
|
||||
this.linkedItem.readFromNBT(compound, false);
|
||||
this.linkedVersion = compound.getInteger(LinkedItem.LINKED_VERSION_VERSION_TAG);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user