From ae21012d216df71f31aed6fbc9d76215fc24ceed Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sat, 4 Mar 2017 12:58:47 +1000 Subject: + New texture for the slow builders ring. + Added the Alkalus Disk. $ Fixed Frame Box Assembler Recipes. $ Fixed Missing 7Li material. $ Fixed Tiered Tanks not showing their capacity in the tooltip. $ Fixed tooltips for alloys containing Bronze or Steel. $ Fixed Clay Pipe Extruder Recipes. - Removed a handful of Plasma cells for misc. materials. % Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements. % Cleaned up The Entire Project. --- .../core/item/general/BedLocator_Base.java | 77 +++-- .../gtPlusPlus/core/item/general/BufferCore.java | 59 ++-- .../core/item/general/ItemBasicFirestarter.java | 20 +- .../core/item/general/ItemBlueprint.java | 124 ++++---- .../core/item/general/ItemCloakingDevice.java | 115 ++++--- .../core/item/general/ItemHealingDevice.java | 117 ++++---- .../core/item/general/ItemSlowBuildingRing.java | 61 ++-- .../core/item/general/NuclearFuelRodBase.java | 334 ++++++++++----------- .../core/item/general/RF2EU_Battery.java | 145 +++++---- .../core/item/general/fuelrods/FuelRod_Base.java | 171 ++++++----- .../item/general/fuelrods/FuelRod_Thorium.java | 2 +- 11 files changed, 609 insertions(+), 616 deletions(-) (limited to 'src/Java/gtPlusPlus/core/item/general') diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java index 5a05ac7655..55efc50c4e 100644 --- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java +++ b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.item.general; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -18,87 +17,87 @@ public class BedLocator_Base extends Item{ public int bed_X = 0; public int bed_Y = 0; public int bed_Z = 0; - - public BedLocator_Base(String unlocalizedName) { + + public BedLocator_Base(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + + int NBT_X = this.bed_X; + int NBT_Y = this.bed_Y; + int NBT_Z = this.bed_Z; - - int NBT_X = bed_X; - int NBT_Y = bed_Y; - int NBT_Z = bed_Z; - if (stack.stackTagCompound != null) { NBT_X = stack.stackTagCompound.getInteger("pos_x"); NBT_Y = stack.stackTagCompound.getInteger("pos_y"); NBT_Z = stack.stackTagCompound.getInteger("pos_z"); - String tempX = String.valueOf(NBT_X); - String tempY = String.valueOf(NBT_Y); - String tempZ = String.valueOf(NBT_Z); - String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; - String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; - String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; - - list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); - list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); - list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); - super.addInformation(stack, aPlayer, list, bool); - } + final String tempX = String.valueOf(NBT_X); + final String tempY = String.valueOf(NBT_Y); + final String tempZ = String.valueOf(NBT_Z); + final String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; + final String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; + final String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; + + list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); + list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); + list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); + super.addInformation(stack, aPlayer, list, bool); + } } //Ticking and NBT Handling /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and * update it's contents. - * + * * public int fuelRemaining = 0; public int maximumFuel = 0; public String fuelType = ""; public float heat = 0; public float maxHeat = 5000; - * + * */ @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { itemStack.stackTagCompound = new NBTTagCompound(); this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { + } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { itemStack.stackTagCompound = new NBTTagCompound(); if (par3Entity.getBedLocation() != null){ - this.bed_X = par3Entity.getBedLocation().posX; - this.bed_Y = par3Entity.getBedLocation().posY; - this.bed_Z = par3Entity.getBedLocation().posZ; + this.bed_X = par3Entity.getBedLocation().posX; + this.bed_Y = par3Entity.getBedLocation().posY; + this.bed_Z = par3Entity.getBedLocation().posZ; } else { this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; } - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); return super.onItemRightClick(itemStack, world, par3Entity); } diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java index 42f8c99c70..40136d7409 100644 --- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java +++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java @@ -1,23 +1,22 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.BaseItemWithDamageValue; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BufferCore extends BaseItemWithDamageValue{ - + public int coreTier = 0; - - public BufferCore(String unlocalizedName, int i) { + + public BufferCore(final String unlocalizedName, final int i) { super(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(2); @@ -25,74 +24,74 @@ public class BufferCore extends BaseItemWithDamageValue{ } @Override - public String getItemStackDisplayName(ItemStack stack) { + public String getItemStackDisplayName(final ItemStack stack) { return super.getItemStackDisplayName(stack)+" ["+CORE.VOLTAGES[this.coreTier-1]+"]."; } - + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } + public boolean requiresMultipleRenderPasses() + { + return true; + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers."); super.addInformation(stack, aPlayer, list, bool); } public final int getCoreTier() { - return coreTier; + return this.coreTier; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { //Figure Out Damage - String s = String.format("%X", HEX_OxFFFFFF); + final String s = String.format("%X", HEX_OxFFFFFF); //Utils.LOG_INFO(s); //String rgb = Utils.hex2Rgb(s); //Utils.LOG_INFO(rgb); - if (coreTier == 1){ + if (this.coreTier == 1){ HEX_OxFFFFFF = 0x4d4d4d; } - else if (coreTier == 2){ + else if (this.coreTier == 2){ HEX_OxFFFFFF = 0x666666; } - else if (coreTier == 3){ + else if (this.coreTier == 3){ HEX_OxFFFFFF = 0x8c8c8c; } - else if (coreTier == 4){ + else if (this.coreTier == 4){ HEX_OxFFFFFF = 0xa6a6a6; } - else if (coreTier == 5){ + else if (this.coreTier == 5){ HEX_OxFFFFFF = 0xcccccc; } - else if (coreTier == 6){ + else if (this.coreTier == 6){ HEX_OxFFFFFF = 0xe6e6e6; } - else if (coreTier == 7){ + else if (this.coreTier == 7){ HEX_OxFFFFFF = 0xffffcc; } - else if (coreTier == 8){ + else if (this.coreTier == 8){ HEX_OxFFFFFF = 0xace600; } - else if (coreTier == 9){ + else if (this.coreTier == 9){ HEX_OxFFFFFF = 0xffff00; } /*else if (coreTier == 10){ HEX_OxFFFFFF = 0xff0000; }*/ - else if (coreTier == 10){ + else if (this.coreTier == 10){ HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); } else { HEX_OxFFFFFF = 0xffffff; } - + return HEX_OxFFFFFF; } - + } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java index a7a1526277..6bb1e8d7bc 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java @@ -14,15 +14,15 @@ import net.minecraft.world.World; public class ItemBasicFirestarter extends CoreItem { public ItemBasicFirestarter() { - super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); + super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); this.setTextureName(CORE.MODID+":"+"itemFireStarter"); } @Override public boolean onItemUse( - ItemStack thisItem, EntityPlayer thisPlayer, World thisWorld, + final ItemStack thisItem, final EntityPlayer thisPlayer, final World thisWorld, int blockX, int blockY, int blockZ, - int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) { if (p_77648_7_ == 0) { --blockY; } @@ -47,23 +47,23 @@ public class ItemBasicFirestarter extends CoreItem { if (thisWorld.getBlock(blockX, blockY, blockZ) instanceof FirePit){ thisWorld.setBlockMetadataWithNotify(blockX, blockY, blockZ, 2, 4); PlayerUtils.messagePlayer(thisPlayer, "You light the fire pit. "); - } + } if (thisWorld.isAirBlock(blockX, blockY, blockZ)) { - int random = MathUtils.randInt(0, 3); + final int random = MathUtils.randInt(0, 3); //Explode, lol. if (random == 0){ PlayerUtils.messagePlayer(thisPlayer, "You somehow managed to set yourself on fire... "); - thisWorld.playSoundEffect((double)thisPlayer.posX + 0.5D, (double)thisPlayer.posY + 0.5D, (double)thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisPlayer.setFire(4); + thisWorld.playSoundEffect(thisPlayer.posX + 0.5D, thisPlayer.posY + 0.5D, thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisPlayer.setFire(4); thisItem.damageItem(thisItem.getMaxDamage(), thisPlayer); } //Create a fire else if (random == 2){ PlayerUtils.messagePlayer(thisPlayer, "You created a fire!"); - thisWorld.playSoundEffect((double)blockX + 0.5D, (double)blockY + 0.5D, (double)blockZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); + thisWorld.playSoundEffect(blockX + 0.5D, blockY + 0.5D, blockZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); } //Do nothing @@ -78,7 +78,7 @@ public class ItemBasicFirestarter extends CoreItem { } @Override - public String getItemStackDisplayName(ItemStack thisItem) { + public String getItemStackDisplayName(final ItemStack thisItem) { return "Basic Firemaker"; } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java index 0458a38110..65aa618cb3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.lib.CORE; @@ -7,9 +10,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -19,14 +19,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class ItemBlueprint extends Item implements IItemBlueprint{ - public ItemBlueprint(String unlocalizedName) { + public ItemBlueprint(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); //this.bpID = MathUtils.randInt(0, 1000); GameRegistry.registerItem(this, unlocalizedName); @@ -34,10 +33,10 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack itemStack, final EntityPlayer aPlayer, final List list, final boolean bool) { //Create some NBT if it's not there, otherwise this does nothing. if (!itemStack.hasTagCompound()){ - createNBT(itemStack); + this.createNBT(itemStack); } //Set up some default variables. int id = -1; @@ -46,14 +45,14 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ //Get proper display vars from NBT if it's there if (itemStack.hasTagCompound()){ //Utils.LOG_WARNING("Found TagCompound"); - id = (int) getNBT(itemStack, "mID"); - name = (String) getNBT(itemStack, "mName"); - blueprint = (boolean) getNBT(itemStack, "mBlueprint"); + id = (int) this.getNBT(itemStack, "mID"); + name = (String) this.getNBT(itemStack, "mName"); + blueprint = (boolean) this.getNBT(itemStack, "mBlueprint"); } //Write to tooltip list for each viable setting. if (itemStack.hasTagCompound()) { if (id != -1){ - list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); + list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); } if(blueprint){ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name); @@ -61,7 +60,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } - } + } else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } @@ -69,46 +68,46 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return "Blueprint [I am useless]"; } @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { - createNBT(itemStack); + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { + this.createNBT(itemStack); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { //Let the player know what blueprint is held if (itemStack.hasTagCompound()) { - PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(readItemsFromNBT(itemStack))); + PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+this.getNBT(itemStack, "mID")+"|"+this.getNBT(itemStack, "mBlueprint")+"|"+this.getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(this.readItemsFromNBT(itemStack))); } else { - createNBT(itemStack); - PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID")); + this.createNBT(itemStack); + PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+this.getNBT(itemStack, "mID")); } return super.onItemRightClick(itemStack, world, par3Entity); } - public ItemStack[] readItemsFromNBT(ItemStack itemStack){ + public ItemStack[] readItemsFromNBT(final ItemStack itemStack){ ItemStack[] blueprint = new ItemStack[9]; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = nbt.getTagList("Items", 10); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = nbt.getTagList("Items", 10); blueprint = new ItemStack[INV_SIZE]; for(int i = 0;i= 0 && slot < INV_SIZE) + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) { blueprint[slot] = ItemStack.loadItemStackFromNBT(data); } @@ -118,17 +117,17 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return null; } - public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){ - ItemStack[] blueprint = craftingGrid; + public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid){ + final ItemStack[] blueprint = craftingGrid; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = new NBTTagList(); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = new NBTTagList(); for(int i = 0;i= 10000){ + if (this.getCharge(arg0) >= 10000){ arg1.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 2)); - discharge(arg0, 10000, 5, true, true, false); + this.discharge(arg0, 10000, 5, true, true, false); } else { if (arg1.isPotionActive((Potion.invisibility))){ diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index d922c243c3..63e0abb238 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -1,5 +1,11 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -7,9 +13,6 @@ import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; import ic2.api.item.*; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,10 +20,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -32,28 +31,28 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI public ItemHealingDevice(){ this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); this.thisStack = ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, unlocalizedName); + GameRegistry.registerItem(this, this.unlocalizedName); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { if (is.getItem() instanceof IElectricItem) { - IElectricItem electricItem = (IElectricItem) is.getItem(); - chargeEU = ElectricItem.manager.getCharge(is); + final IElectricItem electricItem = (IElectricItem) is.getItem(); + this.chargeEU = ElectricItem.manager.getCharge(is); } } @@ -65,81 +64,81 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public boolean canProvideEnergy(ItemStack itemStack) { + public boolean canProvideEnergy(final ItemStack itemStack) { return true; } @Override - public Item getChargedItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(maxValueEU); return x.getItem(); } @Override - public Item getEmptyItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(0); return x.getItem(); } @Override - public double getMaxCharge(ItemStack itemStack) { + public double getMaxCharge(final ItemStack itemStack) { return maxValueEU; } @Override - public int getTier(ItemStack itemStack) { + public int getTier(final ItemStack itemStack) { return 5; } @Override - public double getTransferLimit(ItemStack itemStack) { + public double getTransferLimit(final ItemStack itemStack) { return 32784; } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET); } @Override - public double getDurabilityForDisplay(ItemStack stack) + public double getDurabilityForDisplay(final ItemStack stack) { //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack); + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return true; } - - public double secondsLeft(ItemStack stack){ - + + public double secondsLeft(final ItemStack stack){ + double r = 0; - r = getCharge(stack)/(1638400/4); + r = this.getCharge(stack)/(1638400/4); return (int) r; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"Eu/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +"]"); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY); + list.add(""); + list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"Eu/t]"); + list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); + list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +"]"); super.addInformation(stack, aPlayer, list, bool); } @Override - public double charge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean simulate) { + public double charge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean simulate) { if (!simulate) { @@ -150,8 +149,8 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public double discharge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { if (!simulate) { ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); @@ -161,66 +160,66 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public double getCharge(ItemStack stack) { + public double getCharge(final ItemStack stack) { return ElectricItem.manager.getCharge(stack); } @Override - public boolean canUse(ItemStack stack, double amount) { + public boolean canUse(final ItemStack stack, final double amount) { return ElectricItem.manager.canUse(stack, amount); } @Override - public boolean use(ItemStack stack, double amount, EntityLivingBase entity) { + public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { return ElectricItem.manager.use(stack, amount, entity); } @Override - public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) { + public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { ElectricItem.manager.chargeFromArmor(stack, entity); } @Override - public String getToolTip(ItemStack stack) { + public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); } @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public BaubleType getBaubleType(ItemStack arg0) { + public BaubleType getBaubleType(final ItemStack arg0) { return BaubleType.AMULET; } @Override //TODO - public void onEquipped(ItemStack arg0, EntityLivingBase arg1) { + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) { + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onWornTick(ItemStack arg0, EntityLivingBase arg1) { + public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { if (!arg1.worldObj.isRemote){ - if (getCharge(arg0) >= 1638400/4){ + if (this.getCharge(arg0) >= (1638400/4)){ if (arg1.getHealth() < arg1.getMaxHealth()){ - float rx = arg1.getMaxHealth()-arg1.getHealth(); + final float rx = arg1.getMaxHealth()-arg1.getHealth(); Utils.LOG_INFO("rx:"+rx); - arg1.heal(rx*2); - discharge(arg0, (1638400/4)*rx, 6, true, true, false); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+secondsLeft(arg0)+"."); + arg1.heal(rx*2); + this.discharge(arg0, (1638400/4)*rx, 6, true, true, false); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+this.secondsLeft(arg0)+"."); } } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index 70ab4d38f5..e20271d4b6 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -1,13 +1,16 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.events.CustomMovementHandler; import gtPlusPlus.core.handler.events.SneakManager; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -16,38 +19,34 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemSlowBuildingRing extends Item implements IBauble{ private final String unlocalizedName = "SlowBuildingRing"; CustomMovementHandler x; - + public ItemSlowBuildingRing(){ this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); + this.setTextureName(CORE.MODID + ":" + "itemSlowBuildersRing"); ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, unlocalizedName); + GameRegistry.registerItem(this, this.unlocalizedName); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { - + } } @@ -56,59 +55,59 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.YELLOW+"Slow Building Ring"+EnumChatFormatting.GRAY); } - + @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return false; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY); - list.add(""); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY); + list.add(""); super.addInformation(stack, aPlayer, list, bool); } @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public BaubleType getBaubleType(ItemStack arg0) { + public BaubleType getBaubleType(final ItemStack arg0) { return BaubleType.RING; } @Override //TODO - public void onEquipped(ItemStack arg0, EntityLivingBase arg1) { + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { doEffect(arg1); } @Override //TODO - public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) { + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { SneakManager.setSprintingStateON(); SneakManager.setCrouchingStateOFF(); } @Override //TODO - public void onWornTick(ItemStack arg0, EntityLivingBase arg1) { + public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { doEffect(arg1); } - - private static void doEffect(EntityLivingBase arg1){ + + private static void doEffect(final EntityLivingBase arg1){ if (arg1.worldObj.isRemote){ if (!arg1.isSneaking()){ arg1.setSneaking(true); diff --git a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java index f452b83a73..f4ad191f11 100644 --- a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java +++ b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.item.general; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -12,199 +13,198 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.FillBucketEvent; -import cpw.mods.fml.common.eventhandler.Event; public class NuclearFuelRodBase extends Item { - /** field for checking if the bucket has been filled. */ - private Block isFull; - public NuclearFuelRodBase(Block p_i45331_1_) - { - this.maxStackSize = 1; - this.isFull = p_i45331_1_; - this.setCreativeTab(CreativeTabs.tabMisc); - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) - { - boolean flag = this.isFull == Blocks.air; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag); - - if (movingobjectposition == null) - { - return p_77659_1_; - } - FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); + /** field for checking if the bucket has been filled. */ + private final Block isFull; + public NuclearFuelRodBase(final Block p_i45331_1_) + { + this.maxStackSize = 1; + this.isFull = p_i45331_1_; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_, final EntityPlayer p_77659_3_) + { + final boolean flag = this.isFull == Blocks.air; + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag); + + if (movingobjectposition == null) + { + return p_77659_1_; + } + final FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); if (MinecraftForge.EVENT_BUS.post(event)) { - return p_77659_1_; + return p_77659_1_; } if (event.getResult() == Event.Result.ALLOW) { - if (p_77659_3_.capabilities.isCreativeMode) - { - return p_77659_1_; - } - - if (--p_77659_1_.stackSize <= 0) - { - return event.result; - } - - if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) - { - p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false); - } - - return p_77659_1_; + if (p_77659_3_.capabilities.isCreativeMode) + { + return p_77659_1_; + } + + if (--p_77659_1_.stackSize <= 0) + { + return event.result; + } + + if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) + { + p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false); + } + + return p_77659_1_; } if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) - { - return p_77659_1_; - } - - if (flag) - { - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - Material material = p_77659_2_.getBlock(i, j, k).getMaterial(); - int l = p_77659_2_.getBlockMetadata(i, j, k); - - if (material == Material.water && l == 0) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); - } - - if (material == Material.lava && l == 0) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket); - } - } - else - { - if (this.isFull == Blocks.air) - { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) - { - --j; - } - - if (movingobjectposition.sideHit == 1) - { - ++j; - } - - if (movingobjectposition.sideHit == 2) - { - --k; - } - - if (movingobjectposition.sideHit == 3) - { - ++k; - } - - if (movingobjectposition.sideHit == 4) - { - --i; - } - - if (movingobjectposition.sideHit == 5) - { - ++i; - } - - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) - { - return new ItemStack(Items.bucket); - } - } + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) + { + return p_77659_1_; + } + + if (flag) + { + if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) + { + return p_77659_1_; + } + + final Material material = p_77659_2_.getBlock(i, j, k).getMaterial(); + final int l = p_77659_2_.getBlockMetadata(i, j, k); + + if ((material == Material.water) && (l == 0)) + { + p_77659_2_.setBlockToAir(i, j, k); + return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); + } + + if ((material == Material.lava) && (l == 0)) + { + p_77659_2_.setBlockToAir(i, j, k); + return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket); + } + } + else + { + if (this.isFull == Blocks.air) + { + return new ItemStack(Items.bucket); + } + + if (movingobjectposition.sideHit == 0) + { + --j; + } + + if (movingobjectposition.sideHit == 1) + { + ++j; + } + + if (movingobjectposition.sideHit == 2) + { + --k; + } + + if (movingobjectposition.sideHit == 3) + { + ++k; + } + + if (movingobjectposition.sideHit == 4) + { + --i; + } + + if (movingobjectposition.sideHit == 5) + { + ++i; + } + + if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) + { + return p_77659_1_; + } + + if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) + { + return new ItemStack(Items.bucket); + } + } } return p_77659_1_; - } - - @SuppressWarnings("static-method") - private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) - { - if (p_150910_2_.capabilities.isCreativeMode) - { - return p_150910_1_; - } - else if (--p_150910_1_.stackSize <= 0) - { - return new ItemStack(p_150910_3_); - } - else - { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) - { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - */ - public boolean tryPlaceContainedLiquid(World p_77875_1_, int p_77875_2_, int p_77875_3_, int p_77875_4_) - { - if (this.isFull == Blocks.air) - { - return false; - } - Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial(); - boolean flag = !material.isSolid(); + } + + @SuppressWarnings("static-method") + private ItemStack func_150910_a(final ItemStack p_150910_1_, final EntityPlayer p_150910_2_, final Item p_150910_3_) + { + if (p_150910_2_.capabilities.isCreativeMode) + { + return p_150910_1_; + } + else if (--p_150910_1_.stackSize <= 0) + { + return new ItemStack(p_150910_3_); + } + else + { + if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) + { + p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); + } + + return p_150910_1_; + } + } + + /** + * Attempts to place the liquid contained inside the bucket. + */ + public boolean tryPlaceContainedLiquid(final World p_77875_1_, final int p_77875_2_, final int p_77875_3_, final int p_77875_4_) + { + if (this.isFull == Blocks.air) + { + return false; + } + final Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial(); + final boolean flag = !material.isSolid(); if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag) { - return false; + return false; } - if (p_77875_1_.provider.isHellWorld && this.isFull == Blocks.flowing_water) + if (p_77875_1_.provider.isHellWorld && (this.isFull == Blocks.flowing_water)) { - p_77875_1_.playSoundEffect((double)((float)p_77875_2_ + 0.5F), (double)((float)p_77875_3_ + 0.5F), (double)((float)p_77875_4_ + 0.5F), "random.fizz", 0.5F, 2.6F + (p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F); + p_77875_1_.playSoundEffect(p_77875_2_ + 0.5F, p_77875_3_ + 0.5F, p_77875_4_ + 0.5F, "random.fizz", 0.5F, 2.6F + ((p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F)); - for (int l = 0; l < 8; ++l) - { - p_77875_1_.spawnParticle("largesmoke", (double)p_77875_2_ + Math.random(), (double)p_77875_3_ + Math.random(), (double)p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D); - } + for (int l = 0; l < 8; ++l) + { + p_77875_1_.spawnParticle("largesmoke", p_77875_2_ + Math.random(), p_77875_3_ + Math.random(), p_77875_4_ + Math.random(), 0.0D, 0.0D,