Skip to content

Commit

Permalink
fix copying parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Flow86 committed Apr 2, 2013
1 parent 3a89c50 commit 65026e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions common/abo/items/ItemGateSettingsDuplicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ public GateSlot() {

public void writeToNBT(NBTTagCompound nbt) {
nbt.setInteger("trigger", trigger);
if (triggerParameter != null)
triggerParameter.writeToNBT(nbt.getCompoundTag("triggerParameter"));
if (triggerParameter != null) {
NBTTagCompound nbtparam = new NBTTagCompound();
triggerParameter.writeToNBT(nbtparam);
nbt.setCompoundTag("triggerParameter", nbtparam);
}
nbt.setInteger("action", action);
}

Expand Down Expand Up @@ -115,7 +118,9 @@ public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer entityPlayer, Wo
if (pipe.hasGate()) {
if (itemStack.stackTagCompound == null)
itemStack.stackTagCompound = new NBTTagCompound();

if (entityPlayer.isSneaking() && itemStack.stackTagCompound.hasKey("GateSettings")) {
// apply settings to gate
GateSettings gS = GateSettings.createFromNBT(itemStack.stackTagCompound);
if (gS.kind == pipe.gate.kind && gS.isAutarchic == (pipe.gate instanceof GateVanilla && ((GateVanilla) pipe.gate).hasPulser())) {
for (int i = 0; i < 8; ++i) {
Expand All @@ -127,7 +132,9 @@ public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer entityPlayer, Wo

entityPlayer.sendChatToPlayer("Gate settings pasted");
}

} else {
// get settings from gate
GateSettings gS = new GateSettings(pipe.gate.kind);

if (pipe.gate instanceof GateVanilla) {
Expand Down Expand Up @@ -157,6 +164,5 @@ public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer entityPlayer, Wo
}

return super.onItemUseFirst(itemStack, entityPlayer, worldObj, x, y, z, side, var8, var9, var10);

}
}

0 comments on commit 65026e5

Please sign in to comment.