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_Ice_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_Ice_Item.java')
-rw-r--r-- | main/java/gregtech/api/items/GT_Spray_Ice_Item.java | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/main/java/gregtech/api/items/GT_Spray_Ice_Item.java b/main/java/gregtech/api/items/GT_Spray_Ice_Item.java new file mode 100644 index 0000000000..2e8c4ed0a8 --- /dev/null +++ b/main/java/gregtech/api/items/GT_Spray_Ice_Item.java @@ -0,0 +1,81 @@ +package gregtech.api.items; + +import static gregtech.api.enums.GT_Values.W; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + +import java.util.Arrays; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class GT_Spray_Ice_Item extends GT_Tool_Item { + public GT_Spray_Ice_Item(String aUnlocalized, String aEnglish, int aMaxDamage, int aEntityDamage) { + super(aUnlocalized, aEnglish, "Very effective against Slimes", aMaxDamage, aEntityDamage, true);/* + addToEffectiveList(EntitySlime.class.getName()); + addToEffectiveList("BlueSlime"); + addToEffectiveList("SlimeClone"); + addToEffectiveList("MetalSlime"); + addToEffectiveList("EntityTFFireBeetle"); + addToEffectiveList("EntityTFMazeSlime"); + addToEffectiveList("EntityTFSlimeBeetle"); + setCraftingSound(GregTech_API.sSoundList.get(102)); + setBreakingSound(GregTech_API.sSoundList.get(102)); + setEntityHitSound(GregTech_API.sSoundList.get(102)); + setUsageAmounts(4, 16, 1);*/ + + for (Object tName : Arrays.asList(OrePrefixes.bucket.get(Materials.Water), OrePrefixes.cell.get(Materials.Water), OrePrefixes.capsule.get(Materials.Water))) { + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(Blocks.ice, 1, 0), new Object[] {new ItemStack(this, 1, W), tName}); + } + } + /* + @Override + public void onHitEntity(Entity aEntity) { + if (aEntity instanceof EntityLiving) { + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 400, 2, false)); + ((EntityLiving)aEntity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 400, 2, false)); + } + } + */ + + @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; + } + aX += ForgeDirection.getOrientation(aSide).offsetX; + aY += ForgeDirection.getOrientation(aSide).offsetY; + aZ += ForgeDirection.getOrientation(aSide).offsetZ; + 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); + + if (aBlock == Blocks.water || aBlock == Blocks.flowing_water) { + if (aMeta == 0 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.ice, 0, 3); + return true; + } + return false; + } + + if (aBlock == Blocks.lava || aBlock == Blocks.flowing_lava) { + if (aMeta == 0 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.obsidian, 0, 3); + return true; + } + return false; + } + return false; + } +}
\ No newline at end of file |