diff options
| author | Blood Asp <Blood@Asp> | 2015-04-23 18:14:22 +0200 |
|---|---|---|
| committer | Blood Asp <Blood@Asp> | 2015-04-23 18:14:22 +0200 |
| commit | 7224ac4299098c70efae9dbd04c50a97e3f5f583 (patch) | |
| tree | c739bb7d176a9735bc8e598063918023de32330c /main/java/gregtech/api/items/GT_Spray_Bug_Item.java | |
| download | GT5-Unofficial-7224ac4299098c70efae9dbd04c50a97e3f5f583.tar.gz GT5-Unofficial-7224ac4299098c70efae9dbd04c50a97e3f5f583.tar.bz2 GT5-Unofficial-7224ac4299098c70efae9dbd04c50a97e3f5f583.zip | |
Initial Commit
Diffstat (limited to 'main/java/gregtech/api/items/GT_Spray_Bug_Item.java')
| -rw-r--r-- | main/java/gregtech/api/items/GT_Spray_Bug_Item.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/main/java/gregtech/api/items/GT_Spray_Bug_Item.java b/main/java/gregtech/api/items/GT_Spray_Bug_Item.java new file mode 100644 index 0000000000..d39d3d67a1 --- /dev/null +++ b/main/java/gregtech/api/items/GT_Spray_Bug_Item.java @@ -0,0 +1,66 @@ +package gregtech.api.items; + +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class GT_Spray_Bug_Item extends GT_Tool_Item { + public GT_Spray_Bug_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { + super(aUnlocalized, aEnglish, "A very 'buggy' Spray", aMaxDamage, aEntityDamage, true);/* + addToEffectiveList(EntityCaveSpider.class.getName()); + addToEffectiveList(EntitySpider.class.getName()); + addToEffectiveList("EntityTFHedgeSpider"); + addToEffectiveList("EntityTFKingSpider"); + addToEffectiveList("EntityTFSwarmSpider"); + addToEffectiveList("EntityTFTowerBroodling"); + addToEffectiveList("EntityTFFireBeetle"); + addToEffectiveList("EntityTFSlimeBeetle"); + setCraftingSound(GregTech_API.sSoundList.get(102)); + setBreakingSound(GregTech_API.sSoundList.get(102)); + setEntityHitSound(GregTech_API.sSoundList.get(102)); + setUsageAmounts(8, 4, 1);*/ + } + /* + @Override + public void onHitEntity(Entity aEntity) { + if (aEntity instanceof EntityLiving) { + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 60, 1, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 600, 1, false)); + } + } + + @Override + public ItemStack getEmptiedItem(ItemStack aStack) { + return ItemList.Spray_Empty.get(1); + } + */ + @Override + public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); + if (aWorld.isRemote) { + return false; + } + Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) return false; +// byte aMeta = (byte)aWorld.getBlockMetadata(aX, aY, aZ); + TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + + try { + if (aTileEntity instanceof ic2.api.crops.ICropTile) { + int tCropBefore = ((ic2.api.crops.ICropTile)aTileEntity).getWeedExStorage(); + if (tCropBefore <= 100 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { + ((ic2.api.crops.ICropTile)aTileEntity).setWeedExStorage(tCropBefore+100); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); + return true; + } + } + } catch (Throwable e) {/*Do nothing*/} + + return false; + } +}
\ No newline at end of file |
