aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/blocks/GT_Item_Machines.java')
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index 74e3e3653d..55743f445d 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -15,11 +15,19 @@ import gregtech.api.util.GT_ItsNotMyFaultException;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
+import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest;
+import gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumTank;
+import gregtech.common.tileentities.storage.GT_MetaTileEntity_SuperChest;
+import gregtech.common.tileentities.storage.GT_MetaTileEntity_SuperTank;
import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
@@ -211,4 +219,25 @@ public class GT_Item_Machines extends ItemBlock {
}
return true;
}
+
+ @Override
+ public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) {
+ super.onUpdate(aStack, aWorld, aPlayer, aTimer, aIsInHand);
+ short tDamage = (short) getDamage(aStack);
+ EntityLivingBase tPlayer = (EntityPlayer) aPlayer;
+ if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperChest ||
+ GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumChest ||
+ GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank ||
+ GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank) {
+ NBTTagCompound tNBT = aStack.stackTagCompound;
+ if (tNBT == null) return;
+ if ((tNBT.hasKey("mItemCount") && tNBT.getInteger("mItemCount") > 0) ||
+ tNBT.hasKey("mFluid")) {
+ tPlayer.addPotionEffect(new PotionEffect(Potion.hunger.id, 12000, 4));
+ tPlayer.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 12000, 4));
+ tPlayer.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 12000, 4));
+ tPlayer.addPotionEffect(new PotionEffect(Potion.weakness.id, 12000, 4));
+ }
+ }
+ }
}