diff options
author | Sphyix <masifede2@gmail.com> | 2021-11-21 12:58:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-21 12:58:56 +0100 |
commit | abeecd2da02c7d38cb1c5b6e2fd5517c6f8a994b (patch) | |
tree | 64c5960fc9a0e9c7a4bb368adfb6fa6e9b5aa071 /src/main/java/gregtech/common/blocks/GT_Item_Machines.java | |
parent | 01c243ee9f58c3f64fc883f931ad9a81813f894f (diff) | |
parent | 81f0b4801dfb0bd2d2a863e7a60f27af0daba463 (diff) | |
download | GT5-Unofficial-abeecd2da02c7d38cb1c5b6e2fd5517c6f8a994b.tar.gz GT5-Unofficial-abeecd2da02c7d38cb1c5b6e2fd5517c6f8a994b.tar.bz2 GT5-Unofficial-abeecd2da02c7d38cb1c5b6e2fd5517c6f8a994b.zip |
Merge branch 'GTNewHorizons:experimental' into experimental
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.java | 29 |
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)); + } + } + } } |