aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-22 16:24:59 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-22 16:24:59 +1000
commit354fd67adc23ba49fe506da7af98600959fc0b09 (patch)
treea45e9d3c282f280b6f137dfc695cd6247ddb3896 /src/Java
parentee27545b71bd091377b5e77fab056999a740315a (diff)
downloadGT5-Unofficial-354fd67adc23ba49fe506da7af98600959fc0b09.tar.gz
GT5-Unofficial-354fd67adc23ba49fe506da7af98600959fc0b09.tar.bz2
GT5-Unofficial-354fd67adc23ba49fe506da7af98600959fc0b09.zip
% Small changes.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java3
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java76
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java22
3 files changed, 50 insertions, 51 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java
index 3510bbb392..c2bb478f85 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java
@@ -11,9 +11,8 @@ import net.minecraft.world.World;
public class ItemBlockNBT extends ItemBlock {
- public ItemBlockNBT(final Block block, final CreativeTabs tab) {
+ public ItemBlockNBT(final Block block) {
super(block);
- this.setCreativeTab(tab);
}
@Override
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java
index d7619cc1f9..b330aa52d2 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java
@@ -4,7 +4,6 @@ import java.util.List;
import java.util.Vector;
import gtPlusPlus.core.container.Container_ProjectTable;
-import gtPlusPlus.core.inventories.*;
import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain;
import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput;
import gtPlusPlus.core.util.Utils;
@@ -14,31 +13,28 @@ import ic2.api.network.INetworkUpdateListener;
import ic2.api.tile.IWrenchable;
import ic2.core.IC2;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
public class TileEntityProjectTable extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{
-
+
public InventoryProjectMain inventoryGrid;
public InventoryProjectOutput inventoryOutputs;
-
+
/** The crafting matrix inventory (3x3). */
- public InventoryCrafting craftMatrix;
- public IInventory craftResult;
- private Container_ProjectTable container;
+ public InventoryCrafting craftMatrix;
+ public IInventory craftResult;
+ private Container_ProjectTable container;
public TileEntityProjectTable(){
this.inventoryGrid = new InventoryProjectMain();//number of slots - without product slot
this.inventoryOutputs = new InventoryProjectOutput();//number of slots - without product slot
this.canUpdate();
}
-
+
public void setContainer(Container_ProjectTable container){
this.container = container;
}
@@ -123,35 +119,37 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr
@Override
public void updateEntity() {
-
- //Data stick
- ItemStack dataStick = this.inventoryOutputs.getStackInSlot(0);
- if (dataStick != null && this.container != null){
- Utils.LOG_WARNING("Found Data Stick and valid container.");
-
-
- ItemStack outputComponent = container.getOutputContent();
- ItemStack[] craftInputComponent = container.getInputComponents();
-
-
- ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, new ItemStack[]{outputComponent}, "Output");
- newStick = NBTUtils.writeItemsToNBT(newStick, craftInputComponent);
- NBTUtils.setBookTitle(newStick, "Encrypted Project Data");
- int slotm=0;
- Utils.LOG_WARNING("Uploading to Data Stick.");
- for (ItemStack is : NBTUtils.readItemsFromNBT(newStick)){
- if (is != null){
- Utils.LOG_WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+".");
+ if (!this.worldObj.isRemote){
+ //Data stick
+ ItemStack dataStick = this.inventoryOutputs.getStackInSlot(0);
+ if (dataStick != null && this.container != null && container.getOutputContent() != null){
+ Utils.LOG_WARNING("Found Data Stick and valid container.");
+
+
+ ItemStack outputComponent = container.getOutputContent();
+ ItemStack[] craftInputComponent = container.getInputComponents();
+
+
+ ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, new ItemStack[]{outputComponent}, "Output");
+ newStick = NBTUtils.writeItemsToNBT(newStick, craftInputComponent);
+ NBTUtils.setBookTitle(newStick, "Encrypted Project Data");
+ NBTUtils.setBoolean(newStick, "mEncrypted", true);
+ int slotm=0;
+ Utils.LOG_WARNING("Uploading to Data Stick.");
+ for (ItemStack is : NBTUtils.readItemsFromNBT(newStick)){
+ if (is != null){
+ Utils.LOG_WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+".");
+ }
+ else {
+ Utils.LOG_WARNING("Left memory slot "+slotm+" blank.");
+ }
+ slotm++;
}
- else {
- Utils.LOG_WARNING("Left memory slot "+slotm+" blank.");
- }
- slotm++;
- }
- Utils.LOG_WARNING("Encrypting Data Stick.");
- this.inventoryOutputs.setInventorySlotContents(1, newStick);
- this.inventoryOutputs.setInventorySlotContents(0, null);
- }
+ Utils.LOG_WARNING("Encrypting Data Stick.");
+ this.inventoryOutputs.setInventorySlotContents(1, newStick);
+ this.inventoryOutputs.setInventorySlotContents(0, null);
+ }
+ }
super.updateEntity();
}
@@ -159,7 +157,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr
public boolean canUpdate() {
return true;
}
-
+
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
index d244785b47..52c1fd6789 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
@@ -17,16 +17,16 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityTradeTable extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{
-
+
public InventoryTradeMain inventoryGrid;
public InventoryTradeOutput inventoryOutputs;
- private Container_TradeTable container;
+ private Container_TradeTable container;
public TileEntityTradeTable(){
this.inventoryGrid = new InventoryTradeMain();//number of slots - without product slot
this.inventoryOutputs = new InventoryTradeOutput();//number of slots - without product slot
}
-
+
public void setContainer(Container_TradeTable container_TradeTable){
this.container = container_TradeTable;
}
@@ -110,12 +110,14 @@ public class TileEntityTradeTable extends TileEntity implements INetworkDataProv
}
@Override
- public void updateEntity() {
- ItemStack slot0 = this.inventoryOutputs.getStackInSlot(0);
- if (slot0 != null && slot0.hasTagCompound()){
- NBTUtils.tryIterateNBTData(slot0);
- this.inventoryOutputs.setInventorySlotContents(0, null);
- }
+ public void updateEntity() {
+ if (!this.worldObj.isRemote){
+ ItemStack slot0 = this.inventoryOutputs.getStackInSlot(0);
+ if (slot0 != null && slot0.hasTagCompound()){
+ NBTUtils.tryIterateNBTData(slot0);
+ this.inventoryOutputs.setInventorySlotContents(0, null);
+ }
+ }
super.updateEntity();
}
@@ -123,7 +125,7 @@ public class TileEntityTradeTable extends TileEntity implements INetworkDataProv
public boolean canUpdate() {
return true;
}
-
+