aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-11-12 17:16:20 +1000
committerAlkalus <draknyte1@hotmail.com>2017-11-12 17:16:20 +1000
commit566b1b123082569cb0ffdb2ba5f873ebc0f84470 (patch)
tree9c46f124afccec10c3d12ad430a85292d8649ee6 /src/Java/gtPlusPlus/core
parentda9ccc16d90b6e5e9e7e2547b67af3327751d5d4 (diff)
downloadGT5-Unofficial-566b1b123082569cb0ffdb2ba5f873ebc0f84470.tar.gz
GT5-Unofficial-566b1b123082569cb0ffdb2ba5f873ebc0f84470.tar.bz2
GT5-Unofficial-566b1b123082569cb0ffdb2ba5f873ebc0f84470.zip
% Improved base tile entity with custom name support and sided inventory functionality.
% Improved tool-tip of modular bauble tooltip. % Improved tile entities handling of per tick processing. $ Fixed Trade Table, to support new base changes.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java96
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java134
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java317
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java66
4 files changed, 474 insertions, 139 deletions
diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
index 2353058ba3..b6e73edf20 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java
@@ -2,6 +2,8 @@ package gtPlusPlus.core.item.bauble;
import java.util.List;
+import org.lwjgl.input.Keyboard;
+
import com.google.common.collect.Multimap;
import baubles.api.BaubleType;
@@ -160,49 +162,57 @@ public class ModularBauble extends BaseBauble {
if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) {
list.add(EnumChatFormatting.GRAY + "Defence Boost: " + EnumChatFormatting.BLUE + mStatlevel
+ EnumChatFormatting.GRAY + "/100.");
- if (mStatlevel >= 1) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Cactus"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 10) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling Blocks"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 20) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wall Suffocation"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 35) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Drowning"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 50) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Starvation"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 60) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 75) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Lava"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 80) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Magic"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 95) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wither"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 100) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Fire"
- + EnumChatFormatting.GRAY + ".");
- }
- if (mStatlevel >= 100) {
- list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Void"
- + EnumChatFormatting.GRAY + ".");
+
+ if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) {
+
+ if (mStatlevel >= 1) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Cactus"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 10) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling Blocks"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 20) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wall Suffocation"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 35) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Drowning"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 50) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Starvation"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 60) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 75) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Lava"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 80) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Magic"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 95) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wither"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 100) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Fire"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 100) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Void"
+ + EnumChatFormatting.GRAY + ".");
+ }
+
+ }
+ else {
+ list.add(EnumChatFormatting.GRAY + "<Press Shift to view protections>");
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
index 9b0e8dee64..9acb5ae396 100644
--- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
+++ b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java
@@ -3,11 +3,15 @@ package gtPlusPlus.core.tileentities.base;
import java.util.UUID;
import gtPlusPlus.core.util.Utils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
-public class TileEntityBase extends TileEntity {
+public abstract class TileEntityBase extends TileEntity implements ISidedInventory {
+ private String customName;
public String mOwnerName = "null";
public String mOwnerUUID = "null";
private boolean mIsOwnerOP = false;
@@ -23,7 +27,13 @@ public class TileEntityBase extends TileEntity {
@Override
public void writeToNBT(final NBTTagCompound nbt){
+
super.writeToNBT(nbt);
+
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+
nbt.setBoolean("mIsOwnerOP", this.mIsOwnerOP);
nbt.setString("mOwnerName", this.mOwnerName);
nbt.setString("mOwnerUUID", this.mOwnerUUID);
@@ -31,29 +41,85 @@ public class TileEntityBase extends TileEntity {
@Override
public void readFromNBT(final NBTTagCompound nbt){
+
+ super.readFromNBT(nbt);
+
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
+ }
+
this.mIsOwnerOP = nbt.getBoolean("mIsOwnerOP");
this.mOwnerName = nbt.getString("mOwnerName");
this.mOwnerUUID = nbt.getString("mOwnerUUID");
- super.readFromNBT(nbt);
}
@Override
public void updateEntity() {
- super.updateEntity();
+ try{
+ if (this.isServerSide()){
+ onPreTick();
+ }
+ } catch (Throwable t){
+ Utils.LOG_ERROR("Tile Entity Encountered an error in it's pre-tick stage.");
+ t.printStackTrace();
+ }
+ try{
+ if (this.isServerSide()){
+ onTick();
+ }
+ } catch (Throwable t){
+ Utils.LOG_ERROR("Tile Entity Encountered an error in it's tick stage.");
+ t.printStackTrace();
+ }
+ try{
+ if (this.isServerSide()){
+ onPostTick();
+ }
+ } catch (Throwable t){
+ Utils.LOG_ERROR("Tile Entity Encountered an error in it's post-tick stage.");
+ t.printStackTrace();
+ }
}
+ public boolean onPreTick(){
+
+ return true;
+ }
+
+ public boolean onTick(){
+ try{
+ if (this.isServerSide()){
+ processRecipe();
+ }
+ } catch (Throwable t){
+ Utils.LOG_ERROR("Tile Entity Encountered an error in it's processing of a recipe stage.");
+ t.printStackTrace();
+ }
+ return true;
+ }
+
+ public boolean onPostTick(){
+
+ return true;
+ }
+
+ public boolean processRecipe(){
+ return true;
+ }
+
+
@Override
public boolean canUpdate() {
return true;
}
-
+
public String getOwner(){
if (this.mOwnerName == null){
return "null";
}
return this.mOwnerName;
}
-
+
public UUID getOwnerUUID(){
return UUID.fromString(this.mOwnerUUID);
}
@@ -69,7 +135,6 @@ public class TileEntityBase extends TileEntity {
this.mOwnerName = mName;
this.mOwnerUUID = mUUID;
this.mIsOwnerOP = mOP;
- Utils.LOG_INFO("Finished setting TE information. owner: "+this.mOwnerName+" | UUID: "+this.mOwnerUUID+" | OP: "+this.mIsOwnerOP);
}
}
}
@@ -86,4 +151,61 @@ public class TileEntityBase extends TileEntity {
return false;
}
+ public String getCustomName() {
+ return this.customName;
+ }
+
+ public void setCustomName(String customName) {
+ this.customName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.fishrap";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return this.customName != null && !this.customName.equals("");
+ }
+
+ @Override
+ public abstract int getSizeInventory();
+
+ @Override
+ public abstract ItemStack getStackInSlot(int p_70301_1_);
+
+ @Override
+ public abstract ItemStack decrStackSize(int p_70298_1_, int p_70298_2_);
+
+ @Override
+ public abstract ItemStack getStackInSlotOnClosing(int p_70304_1_);
+
+ @Override
+ public abstract void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_);
+
+ @Override
+ public abstract int getInventoryStackLimit();
+
+ @Override
+ public abstract boolean isUseableByPlayer(EntityPlayer p_70300_1_);
+
+ @Override
+ public abstract void openInventory();
+
+ @Override
+ public abstract void closeInventory();
+
+ @Override
+ public abstract boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_);
+
+ @Override
+ public abstract int[] getAccessibleSlotsFromSide(int p_94128_1_);
+
+ @Override
+ public abstract boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_);
+
+ @Override
+ public abstract boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_);
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
index 0a0561ee73..5393e15500 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java
@@ -11,23 +11,25 @@ import gtPlusPlus.core.container.Container_ModularityTable;
import gtPlusPlus.core.inventories.modulartable.InventoryModularMain;
import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput;
import gtPlusPlus.core.item.bauble.ModularBauble;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.util.array.Pair;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.nbt.ModularArmourUtils;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT;
import gtPlusPlus.core.util.nbt.ModularArmourUtils.Modifiers;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
+import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-public class TileEntityModularityTable extends TileEntity {
+public class TileEntityModularityTable extends TileEntityBase implements ISidedInventory{
public InventoryModularMain inventoryGrid;
public InventoryModularOutput inventoryOutputs;
public InventoryModularOutput mTempRecipeStorage;
private Container_ModularityTable container;
+ private String customName;
private int mRecipeTimeRemaining = -1;
public TileEntityModularityTable() {
@@ -41,11 +43,11 @@ public class TileEntityModularityTable extends TileEntity {
public void setContainer(Container_ModularityTable container_ModularityTable) {
this.container = container_ModularityTable;
}
-
+
public Container_ModularityTable getContainer() {
return this.container;
}
-
+
public int getRecipeTime(){
return this.mRecipeTimeRemaining;
}
@@ -65,8 +67,9 @@ public class TileEntityModularityTable extends TileEntity {
this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput"));
this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid"));
this.mTempRecipeStorage.writeToNBT(this.getTag(nbt, "ContentsRecipeTemp"));
-
-
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
}
@Override
@@ -76,94 +79,20 @@ public class TileEntityModularityTable extends TileEntity {
this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput"));
this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid"));
this.mTempRecipeStorage.readFromNBT(nbt.getCompoundTag("ContentsRecipeTemp"));
- }
-
- @Override
- public void updateEntity() {
- if (!this.worldObj.isRemote) {
-
- //Check for active recipe
- if (this.mRecipeTimeRemaining > -1 || (this.mTempRecipeStorage != null) && (this.mTempRecipeStorage.getRecipeTime() > -1)){
- if ((this.mTempRecipeStorage != null) && this.mTempRecipeStorage.getRecipeTime() > -1){
- if (this.mRecipeTimeRemaining < this.mTempRecipeStorage.getRecipeTime()){
- this.mRecipeTimeRemaining = this.mTempRecipeStorage.getRecipeTime();
- this.markDirty();
- }
- }
- if (this.mInputstackA != null && this.mInputstackB != null && this.mOutputStack != null){
- this.mTempRecipeStorage.setInventorySlotContents(0, this.mInputstackA);
- this.mTempRecipeStorage.setInventorySlotContents(1, this.mInputstackB);
- this.mTempRecipeStorage.setInventorySlotContents(2, this.mOutputStack);
- this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
- this.markDirty();
- }
- }
-
- boolean removeInputA = false;
- boolean removeInputB = false;
- // Data stick
- ItemStack tBauble = this.inventoryOutputs.getStackInSlot(0);
- ItemStack tUpgrade = this.inventoryOutputs.getStackInSlot(1);
- if (tBauble != null && tUpgrade != null && this.container != null) {
- if (tBauble.getItem() instanceof ModularBauble && this.mRecipeTimeRemaining == -1) {
- if (tUpgrade != null && tBauble != null) {
- removeInputA = true;
- this.setInputStacks(tBauble, tUpgrade);
- try {
- removeInputB = addUpgrade(tUpgrade, tBauble);
- if (!removeInputB) {
- }
- } catch (Throwable t) {
- }
- if (removeInputA && removeInputB) {
- if (this.setOutputStack(tBauble)){
- if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1) {
- ItemStack mTempStack = this.inventoryOutputs.getStackInSlot(1);
- mTempStack.stackSize--;
- this.inventoryOutputs.setInventorySlotContents(1, mTempStack);
- } else {
- this.inventoryOutputs.setInventorySlotContents(1, null);
- }
- this.inventoryOutputs.setInventorySlotContents(0, null);
-
- this.mRecipeTimeRemaining = 80;
- this.markDirty();
- }
- } else {
- Utils.LOG_INFO("1: " + removeInputA + " | 2: " + removeInputB);
- }
- }
- }
- }
-
- if (mRecipeTimeRemaining == 0){
- this.inventoryOutputs.setInventorySlotContents(2, this.getPendingOutputItem());
- clearRecipeData();
- this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
- this.markDirty();
- }
- /*else if (mRecipeTimeRemaining == -1){
- mRecipeTimeRemaining = -1;
- }*/
- else if (mRecipeTimeRemaining > 0){
- mRecipeTimeRemaining--;
- this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
- //Utils.LOG_INFO("Remaining: "+this.mRecipeTimeRemaining);
- }
-
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
}
- super.updateEntity();
}
-
+
protected ItemStack mOutputStack; //Upgraded Bauble
protected ItemStack mInputstackA; //Bauble
protected ItemStack mInputstackB; //Upgrade
-
+
public ItemStack getPendingOutputItem(){
this.mRecipeTimeRemaining--;
return this.mOutputStack;
}
-
+
public ItemStack[] getCurrentInputItems(){
if (this.mRecipeTimeRemaining < 0){
return null;
@@ -172,7 +101,7 @@ public class TileEntityModularityTable extends TileEntity {
return new ItemStack[]{this.mInputstackA, this.mInputstackB};
}
}
-
+
public boolean setInputStacks(ItemStack tBauble, ItemStack tUpgrade){
if (tBauble != null){
this.mInputstackA = tBauble;
@@ -191,7 +120,7 @@ public class TileEntityModularityTable extends TileEntity {
}
return false;
}
-
+
public boolean setOutputStack(ItemStack mNewBauble){
if (mNewBauble != null){
this.mOutputStack = mNewBauble;
@@ -202,7 +131,7 @@ public class TileEntityModularityTable extends TileEntity {
return false;
}
}
-
+
public boolean clearRecipeData(){
this.mInputstackA = null;
this.mInputstackB = null;
@@ -289,7 +218,6 @@ public class TileEntityModularityTable extends TileEntity {
if (pair.getKey().getItem() == tStack.getItem()
&& pair.getKey().getItemDamage() == tStack.getItemDamage()) {
Pair<Modifiers, Integer> newPair = pair.getValue();
- int mCurrentLevel = ModularArmourUtils.getModifierLevel(tBauble, newPair);
ModularArmourUtils.setModifierLevel(tBauble, newPair);
return true;
}
@@ -300,4 +228,213 @@ public class TileEntityModularityTable extends TileEntity {
return false;
}
+ @Override
+ public int getSizeInventory() {
+ return 11;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot) {
+ if (slot < this.inventoryGrid.getSizeInventory()){
+ return this.inventoryGrid.getStackInSlot(slot);
+ }
+ else if (slot < (this.inventoryGrid.getSizeInventory()+this.inventoryOutputs.getSizeInventory())){
+ return this.inventoryOutputs.getStackInSlot(slot);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ItemStack decrStackSize(int slot, int count) {
+ if (slot < this.inventoryGrid.getSizeInventory()){
+ return this.inventoryGrid.decrStackSize(slot, count);
+ }
+ else if (slot < (this.inventoryGrid.getSizeInventory()+this.inventoryOutputs.getSizeInventory())){
+ return this.inventoryOutputs.decrStackSize(slot, count);
+ }
+ else {
+ return null;
+ }
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int slot) {
+ return this.getStackInSlot(slot);
+ }
+
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack stack) {
+ if (slot < this.inventoryGrid.getSizeInventory()){
+ this.inventoryGrid.setInventorySlotContents(slot, stack);
+ }
+ else if (slot < (this.inventoryGrid.getSizeInventory()+this.inventoryOutputs.getSizeInventory())){
+ this.inventoryOutputs.setInventorySlotContents(slot, stack);
+ }
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1);
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
+ this.inventoryGrid.openInventory();
+ this.inventoryOutputs.openInventory();
+ }
+
+ @Override
+ public void closeInventory() {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1);
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
+ this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
+ this.inventoryGrid.openInventory();
+ this.inventoryOutputs.openInventory();
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
+ if (slot < this.inventoryGrid.getSizeInventory()){
+ return this.inventoryGrid.isItemValidForSlot(slot, itemstack);
+ }
+ else if (slot < (this.inventoryGrid.getSizeInventory()+this.inventoryOutputs.getSizeInventory())){
+ return this.inventoryOutputs.isItemValidForSlot(slot, itemstack);
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int side) {
+ int[] accessibleSides = new int[this.getSizeInventory()];
+ if (side == 0){
+
+ }
+ else if (side == 1){
+ for (int r=0; r<this.inventoryOutputs.getSizeInventory(); r++){
+ accessibleSides[r]=r;
+ }
+ }
+ else if (side > 1){
+ for (int r=0; r<this.inventoryGrid.getSizeInventory(); r++){
+ accessibleSides[r]=r;
+ }
+ }
+ return accessibleSides;
+
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ return true;
+ }
+
+ public String getCustomName() {
+ return this.customName;
+ }
+
+ public void setCustomName(String customName) {
+ this.customName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.fishrap";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return this.customName != null && !this.customName.equals("");
+ }
+
+ @Override
+ public boolean onPreTick() {
+ //Check for active recipe
+ if (this.mRecipeTimeRemaining > -1 || (this.mTempRecipeStorage != null) && (this.mTempRecipeStorage.getRecipeTime() > -1)){
+ if ((this.mTempRecipeStorage != null) && this.mTempRecipeStorage.getRecipeTime() > -1){
+ if (this.mRecipeTimeRemaining < this.mTempRecipeStorage.getRecipeTime()){
+ this.mRecipeTimeRemaining = this.mTempRecipeStorage.getRecipeTime();
+ this.markDirty();
+ }
+ }
+ if (this.mInputstackA != null && this.mInputstackB != null && this.mOutputStack != null){
+ this.mTempRecipeStorage.setInventorySlotContents(0, this.mInputstackA);
+ this.mTempRecipeStorage.setInventorySlotContents(1, this.mInputstackB);
+ this.mTempRecipeStorage.setInventorySlotContents(2, this.mOutputStack);
+ this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
+ this.markDirty();
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onPostTick() {
+ if (mRecipeTimeRemaining == 0){
+ this.inventoryOutputs.setInventorySlotContents(2, this.getPendingOutputItem());
+ clearRecipeData();
+ this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
+ this.markDirty();
+ }
+ else if (mRecipeTimeRemaining > 0){
+ mRecipeTimeRemaining--;
+ this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean processRecipe() {
+ boolean removeInputA = false;
+ boolean removeInputB = false;
+ // Data stick
+ ItemStack tBauble = this.inventoryOutputs.getStackInSlot(0);
+ ItemStack tUpgrade = this.inventoryOutputs.getStackInSlot(1);
+ if (tBauble != null && tUpgrade != null && this.container != null) {
+ if (tBauble.getItem() instanceof ModularBauble && this.mRecipeTimeRemaining == -1) {
+ if (tUpgrade != null && tBauble != null) {
+ removeInputA = true;
+ this.setInputStacks(tBauble, tUpgrade);
+ try {
+ removeInputB = addUpgrade(tUpgrade, tBauble);
+ if (!removeInputB) {
+ }
+ } catch (Throwable t) {
+ }
+ if (removeInputA && removeInputB) {
+ if (this.setOutputStack(tBauble)){
+ if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1) {
+ ItemStack mTempStack = this.inventoryOutputs.getStackInSlot(1);
+ mTempStack.stackSize--;
+ this.inventoryOutputs.setInventorySlotContents(1, mTempStack);
+ } else {
+ this.inventoryOutputs.setInventorySlotContents(1, null);
+ }
+ this.inventoryOutputs.setInventorySlotContents(0, null);
+ this.mRecipeTimeRemaining = 80;
+ this.markDirty();
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
index 6690e1e2c1..712ee1d5cc 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java
@@ -5,6 +5,7 @@ import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain;
import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.util.nbt.NBTUtils;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -62,4 +63,69 @@ public class TileEntityTradeTable extends TileEntityBase {
super.updateEntity();
}
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
+
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+
+ }
+
+ @Override
+ public void closeInventory() {
+
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ return null;
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ return false;
+ }
+
} \ No newline at end of file