aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-05-29 14:58:07 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-05-29 14:58:07 +1000
commitf887c642796d77adb7a5baf559092807d8274f81 (patch)
treeabb6f4b20aeeaabf924df119fed0c28b75b3c7c8 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage
parenta2377acf4dc0dedc087fe83ca5665d142ab26ba1 (diff)
downloadGT5-Unofficial-f887c642796d77adb7a5baf559092807d8274f81.tar.gz
GT5-Unofficial-f887c642796d77adb7a5baf559092807d8274f81.tar.bz2
GT5-Unofficial-f887c642796d77adb7a5baf559092807d8274f81.zip
$ More work on threaded super buffers.
$ Fixed the infinite item holder.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java
index 5aa004637c..529a0b79f6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java
@@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.core.util.sys.KeyboardUtils;
@@ -23,8 +24,7 @@ public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_Tier
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
-
- if (aPlayer.worldObj.isRemote) {
+ if (aBaseMetaTileEntity.getWorld().isRemote) {
return false;
}
@@ -33,19 +33,25 @@ public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_Tier
if (aPlayer.getHeldItem() != null) {
this.mItemStack = aPlayer.getHeldItem().copy();
this.mItemCount = Short.MAX_VALUE;
+ aPlayer.setCurrentItemOrArmor(0, null);
+ PlayerUtils.messagePlayer(aPlayer, "Now holding "+this.mItemStack.getDisplayName()+" x"+Short.MAX_VALUE+".");
+ return true;
}
}
else {
if (aPlayer.getHeldItem() == null) {
+ aPlayer.entityDropItem(mItemStack, 1);
this.mItemStack = null;
this.mItemCount = 0;
+ PlayerUtils.messagePlayer(aPlayer, "Emptying.");
+ return true;
}
}
}
- else {
- PlayerUtils.messagePlayer(aPlayer, "Currently holding: "+(this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing")+" x"+this.mItemCount);
- }
- return super.onRightclick(aBaseMetaTileEntity, aPlayer);
+
+ PlayerUtils.messagePlayer(aPlayer, "Currently holding: "+(this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing")+" x"+this.mItemCount);
+ return true;
+ //return super.onRightclick(aBaseMetaTileEntity, aPlayer);
}
@Override
@@ -60,6 +66,9 @@ public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_Tier
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (mItemStack != null) {
+ setItemCount(0);
+ }
super.onPostTick(aBaseMetaTileEntity, aTimer);
}
@@ -70,14 +79,16 @@ public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_Tier
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- // TODO Auto-generated method stub
- return super.allowPullStack(aBaseMetaTileEntity, aIndex, aSide, aStack);
+ return true;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- // TODO Auto-generated method stub
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack);
+ return false;
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_InfiniteItemHolder(this.mName, this.mTier, this.mDescription, this.mTextures);
}