aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/general
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/general')
-rw-r--r--src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java102
-rw-r--r--src/Java/gtPlusPlus/core/item/general/BufferCore.java91
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java377
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java293
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java263
-rw-r--r--src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java329
-rw-r--r--src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java359
-rw-r--r--src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java297
-rw-r--r--src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java4
9 files changed, 1047 insertions, 1068 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
index 95be6aa474..fe93fdf70e 100644
--- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
+++ b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
@@ -12,95 +12,91 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class BedLocator_Base extends Item{
+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 int bed_X = 0;
+ public int bed_Y = 0;
+ public int bed_Z = 0;
+
+ 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" })
+ @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 = bed_X;
- int NBT_Y = bed_Y;
- int NBT_Z = bed_Z;
-
+ int NBT_X = this.bed_X;
+ int NBT_Y = this.bed_Y;
+ int NBT_Z = this.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.
+ // 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;
*
- * 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);
- }
-
- @Override
- public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
-
-
+ 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 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;
+ if (par3Entity.getBedLocation() != null) {
+ 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);
}
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
+ final boolean par5) {
+ }
}
diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java
index c4a113cde5..12d78b6f83 100644
--- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java
+++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java
@@ -12,86 +12,87 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-public class BufferCore extends BaseItemWithDamageValue{
-
+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);
this.coreTier = i;
}
+ @SuppressWarnings({
+ "unchecked", "rawtypes"
+ })
@Override
- public String getItemStackDisplayName(ItemStack stack) {
- return super.getItemStackDisplayName(stack)+" ["+CORE.VOLTAGES[this.coreTier-1]+"].";
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean requiresMultipleRenderPasses()
- {
- return true;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers.");
+ 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;
- }
-
@Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- //Figure Out Damage
- String s = String.format("%X", HEX_OxFFFFFF);
- //Utils.LOG_INFO(s);
- //String rgb = Utils.hex2Rgb(s);
- //Utils.LOG_INFO(rgb);
- if (coreTier == 1){
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ // Figure Out Damage
+ final String s = String.format("%X", HEX_OxFFFFFF);
+ // Utils.LOG_INFO(s);
+ // String rgb = Utils.hex2Rgb(s);
+ // Utils.LOG_INFO(rgb);
+ 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){
- HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
+ /*
+ * else if (coreTier == 10){ HEX_OxFFFFFF = 0xff0000; }
+ */
+ 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;
}
-
+
+ public final int getCoreTier() {
+ return this.coreTier;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack stack) {
+ return super.getItemStackDisplayName(stack) + " [" + CORE.VOLTAGES[this.coreTier - 1] + "].";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses() {
+ return true;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
index ec7597e363..22bb194fde 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
@@ -20,95 +20,207 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class ItemBlueprint extends Item implements IItemBlueprint{
+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);
+ // this.bpID = MathUtils.randInt(0, 1000);
GameRegistry.registerItem(this, unlocalizedName);
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({
+ "unchecked", "rawtypes"
+ })
@Override
- public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) {
- //Create some NBT if it's not there, otherwise this does nothing.
- if (!itemStack.hasTagCompound()){
- createNBT(itemStack);
+ 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()) {
+ this.createNBT(itemStack);
}
- //Set up some default variables.
+ // Set up some default variables.
int id = -1;
String name = "";
boolean blueprint = false;
- //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");
+ // Get proper display vars from NBT if it's there
+ if (itemStack.hasTagCompound()) {
+ // Utils.LOG_WARNING("Found TagCompound");
+ 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.
+ // Write to tooltip list for each viable setting.
if (itemStack.hasTagCompound()) {
- if (id != -1){
- list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id);
+ if (id != -1) {
+ list.add(EnumChatFormatting.GRAY + "Technical Document No. " + id);
}
- if(blueprint){
- list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name);
+ if (blueprint) {
+ list.add(EnumChatFormatting.BLUE + "Currently holding a blueprint for " + name);
}
else {
- list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
+ list.add(EnumChatFormatting.RED + "Currently not holding a blueprint for anything.");
}
- }
+ }
else {
- list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
+ list.add(EnumChatFormatting.RED + "Currently not holding a blueprint for anything.");
}
super.addInformation(itemStack, aPlayer, list, bool);
}
+ public boolean createNBT(final ItemStack itemStack) {
+ if (itemStack.hasTagCompound()) {
+ if (!itemStack.stackTagCompound.getBoolean("mBlueprint")
+ && !itemStack.stackTagCompound.getString("mName").equals("")) {
+ // No Blueprint and no name Set
+ Utils.LOG_WARNING("No Blueprint and no name Set");
+ return false;
+ }
+ else if (itemStack.stackTagCompound.getBoolean("mBlueprint")
+ && !itemStack.stackTagCompound.getString("mName").equals("")) {
+ // Has Blueprint but invalid name set
+ Utils.LOG_WARNING("Has Blueprint but invalid name set");
+ // itemStack.stackTagCompound = null;
+ // createNBT(itemStack);
+ return false;
+ }
+ else if (!itemStack.stackTagCompound.getBoolean("mBlueprint")
+ && itemStack.stackTagCompound.getString("mName").equals("")) {
+ // Has no Blueprint, but strangely has a name
+ Utils.LOG_WARNING("Has no Blueprint, but strangely has a name");
+ // itemStack.stackTagCompound = null;
+ // createNBT(itemStack);
+ return false;
+ }
+ return false;
+ }
+ else if (!itemStack.hasTagCompound()) {
+ final int bpID = MathUtils.randInt(0, 1000);
+ final boolean hasRecipe = false;
+ final String recipeName = "";
+ Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. " + bpID);
+ itemStack.stackTagCompound = new NBTTagCompound();
+ itemStack.stackTagCompound.setInteger("mID", bpID);
+ itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
+ itemStack.stackTagCompound.setString("mName", recipeName);
+ return true;
+ }
+ else {
+ final int bpID = MathUtils.randInt(0, 1000);
+ final boolean hasRecipe = false;
+ final String recipeName = "";
+ Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. " + bpID);
+ itemStack.stackTagCompound = new NBTTagCompound();
+ itemStack.stackTagCompound.setInteger("mID", bpID);
+ itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
+ itemStack.stackTagCompound.setString("mName", recipeName);
+ return true;
+ }
+ }
+
+ @Override
+ public ItemStack[] getBlueprint(final ItemStack stack) {
+ ItemStack[] blueprint = new ItemStack[9];
+ if (stack.hasTagCompound()) {
+ blueprint = this.readItemsFromNBT(stack);
+ }
+ try {
+ final ItemStack[] returnStack = new ItemStack[9];
+ for (int o = 0; o < blueprint.length; o++) {
+ returnStack[o] = blueprint[o];
+ if (returnStack[0] != null) {
+ returnStack[0].stackSize = 1;
+ }
+ }
+ return returnStack;
+ }
+ catch (final Throwable t) {
+ return null;
+ }
+ }
+
@Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
return "Blueprint [I am useless]";
}
+ public Object getNBT(final ItemStack itemStack, final String tagNBT) {
+ if (!itemStack.hasTagCompound()) {
+ return null;
+ }
+ Object o = null;
+ if (tagNBT.equals("mID")) {
+ o = itemStack.stackTagCompound.getInteger(tagNBT);
+ }
+ else if (tagNBT.equals("mBlueprint")) {
+ o = itemStack.stackTagCompound.getBoolean(tagNBT);
+ }
+ else if (tagNBT.equals("mName")) {
+ o = itemStack.stackTagCompound.getString(tagNBT);
+ }
+ else if (tagNBT.equals("")) {
+ // For More Tag Support
+ // o = itemStack.stackTagCompound.getInteger(tagNBT);
+ }
+ if (o != null) {
+ return o;
+ }
+ return null;
+ }
+
@Override
- public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
- createNBT(itemStack);
+ public boolean hasBlueprint(final ItemStack stack) {
+ if (stack.hasTagCompound()) {
+ return (boolean) this.getNBT(stack, "mBlueprint");
+ }
+ return false;
}
@Override
- public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
+ public boolean isBlueprint(final ItemStack stack) {
+ return true;
+ }
+ @Override
+ public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
+ this.createNBT(itemStack);
}
@Override
- public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) {
- //Let the player know what blueprint is held
+ 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){
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
+ final boolean par5) {
+
+ }
+
+ public ItemStack[] readItemsFromNBT(final ItemStack itemStack) {
ItemStack[] blueprint = new ItemStack[9];
- if (itemStack.hasTagCompound()){
- NBTTagCompound nbt = itemStack.getTagCompound();
- NBTTagList list = nbt.getTagList("Items", 10);
- blueprint = new ItemStack[INV_SIZE];
- for(int i = 0;i<list.tagCount();i++)
- {
- NBTTagCompound data = list.getCompoundTagAt(i);
- int slot = data.getInteger("Slot");
- if(slot >= 0 && slot < INV_SIZE)
- {
+ if (itemStack.hasTagCompound()) {
+ final NBTTagCompound nbt = itemStack.getTagCompound();
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ blueprint = new ItemStack[IItemBlueprint.INV_SIZE];
+ for (int i = 0; i < list.tagCount(); i++) {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if (slot >= 0 && slot < IItemBlueprint.INV_SIZE) {
blueprint[slot] = ItemStack.loadItemStackFromNBT(data);
}
}
@@ -117,175 +229,72 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
return null;
}
- public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){
- ItemStack[] blueprint = craftingGrid;
- if (itemStack.hasTagCompound()){
- NBTTagCompound nbt = itemStack.getTagCompound();
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = blueprint[i];
- if(stack != null)
- {
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
- }
- }
- nbt.setTag("Items", list);
- itemStack.setTagCompound(nbt);
- return itemStack;
- }
- return null;
- }
-
@Override
- public boolean isBlueprint(ItemStack stack) {
- return true;
- }
-
- @Override
- public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output) {
+ public boolean setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) {
boolean hasBP = false;
ItemStack[] blueprint = new ItemStack[9];
- if (stack.hasTagCompound()){
- hasBP = (boolean) getNBT(stack, "mBlueprint");
- blueprint = readItemsFromNBT(stack);
+ if (stack.hasTagCompound()) {
+ hasBP = (boolean) this.getNBT(stack, "mBlueprint");
+ blueprint = this.readItemsFromNBT(stack);
}
- if (!hasBP){
+ if (!hasBP) {
try {
- for (int o=0; o<craftingTable.getSizeInventory(); o++){
+ for (int o = 0; o < craftingTable.getSizeInventory(); o++) {
blueprint[o] = craftingTable.getStackInSlot(o);
- if (blueprint[0] != null){
+ if (blueprint[0] != null) {
blueprint[0].stackSize = 0;
}
}
- writeItemsToNBT(stack, blueprint);
- if (stack.hasTagCompound()){
- if(stack.getTagCompound().getCompoundTag("Items") != null){
+ this.writeItemsToNBT(stack, blueprint);
+ if (stack.hasTagCompound()) {
+ if (stack.getTagCompound().getCompoundTag("Items") != null) {
stack.stackTagCompound.setBoolean("mBlueprint", true);
}
else {
- //Invalid BP saved?
+ // Invalid BP saved?
}
- hasBP = (boolean) getNBT(stack, "mBlueprint");
+ hasBP = (boolean) this.getNBT(stack, "mBlueprint");
}
-
- if (output != null){
- setBlueprintName(stack, output.getDisplayName());
- return (hasBP = true);
+
+ if (output != null) {
+ this.setBlueprintName(stack, output.getDisplayName());
+ return hasBP = true;
}
return false;
- } catch (Throwable t){
- return false;
+ }
+ catch (final Throwable t) {
+ return false;
}
}
return false;
}
@Override
- public void setBlueprintName(ItemStack stack, String name) {
+ public void setBlueprintName(final ItemStack stack, final String name) {
stack.stackTagCompound.setString("mName", name);
}
- @Override
- public boolean hasBlueprint(ItemStack stack) {
- if (stack.hasTagCompound()){
- return (boolean) getNBT(stack, "mBlueprint");
- }
- return false;
- }
-
- @Override
- public ItemStack[] getBlueprint(ItemStack stack) {
- ItemStack[] blueprint = new ItemStack[9];
- if (stack.hasTagCompound()){
- blueprint = readItemsFromNBT(stack);
- }
- try {
- ItemStack[] returnStack = new ItemStack[9];
- for (int o=0; o<blueprint.length; o++){
- returnStack[o] = blueprint[o];
- if (returnStack[0] != null){
- returnStack[0].stackSize = 1;
+ public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid) {
+ final ItemStack[] blueprint = craftingGrid;
+ if (itemStack.hasTagCompound()) {
+ final NBTTagCompound nbt = itemStack.getTagCompound();
+ final NBTTagList list = new NBTTagList();
+ for (int i = 0; i < IItemBlueprint.INV_SIZE; i++) {
+ final ItemStack stack = blueprint[i];
+ if (stack != null) {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
}
}
- return returnStack;
- } catch (Throwable t){
- return null;
- }
- }
-
- public boolean createNBT(ItemStack itemStack){
- if (itemStack.hasTagCompound()){
- if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){
- //No Blueprint and no name Set
- Utils.LOG_WARNING("No Blueprint and no name Set");
- return false;
- }
- else if (itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){
- //Has Blueprint but invalid name set
- Utils.LOG_WARNING("Has Blueprint but invalid name set");
- //itemStack.stackTagCompound = null;
- //createNBT(itemStack);
- return false;
- }
- else if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && itemStack.stackTagCompound.getString("mName").equals("")){
- //Has no Blueprint, but strangely has a name
- Utils.LOG_WARNING("Has no Blueprint, but strangely has a name");
- //itemStack.stackTagCompound = null;
- //createNBT(itemStack);
- return false;
- }
- return false;
- }
- else if(!itemStack.hasTagCompound()){
- int bpID = MathUtils.randInt(0, 1000);
- boolean hasRecipe = false;
- String recipeName = "";
- Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. "+bpID);
- itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setInteger("mID", bpID);
- itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
- itemStack.stackTagCompound.setString("mName", recipeName);
- return true;
+ nbt.setTag("Items", list);
+ itemStack.setTagCompound(nbt);
+ return itemStack;
}
- else {
- int bpID = MathUtils.randInt(0, 1000);
- boolean hasRecipe = false;
- String recipeName = "";
- Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID);
- itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setInteger("mID", bpID);
- itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
- itemStack.stackTagCompound.setString("mName", recipeName);
- return true;
- }
+ return null;
}
- public Object getNBT(ItemStack itemStack, String tagNBT){
- if (!itemStack.hasTagCompound()){
- return null;
- }
- Object o = null;
- if (tagNBT.equals("mID")){
- o = itemStack.stackTagCompound.getInteger(tagNBT);
- }
- else if (tagNBT.equals("mBlueprint")){
- o = itemStack.stackTagCompound.getBoolean(tagNBT);
- }
- else if (tagNBT.equals("mName")){
- o = itemStack.stackTagCompound.getString(tagNBT);
- }
- else if (tagNBT.equals("")){
- //For More Tag Support
- //o = itemStack.stackTagCompound.getInteger(tagNBT);
- }
- if (o != null)
- return o;
- return null; }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
index 5b664d181c..d0316730bf 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
@@ -21,235 +21,234 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")})
-public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{
-
- private final String unlocalizedName = "personalCloakingDevice";
- private final ItemStack thisStack;
- private final static int maxValueEU = 10000*20*500;
- protected double chargeEU = 0;
-
- public ItemCloakingDevice(double charge){
+@Optional.InterfaceList(value = {
+ @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"),
+ @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")
+})
+public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble {
+
+ private final static int maxValueEU = 10000 * 20 * 500;
+ private final String unlocalizedName = "personalCloakingDevice";
+ private final ItemStack thisStack;
+ protected double chargeEU = 0;
+
+ public ItemCloakingDevice(final double charge) {
this.chargeEU = charge;
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.setUnlocalizedName(unlocalizedName);
+ this.setUnlocalizedName(this.unlocalizedName);
this.setMaxStackSize(1);
this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice");
this.thisStack = ItemUtils.getSimpleStack(this);
- this.charge(thisStack, charge, 3, true, false);
- if (charge == 10000*20*500){
- this.setDamage(thisStack, 13);
+ this.charge(this.thisStack, charge, 3, true, false);
+ if (charge == 10000 * 20 * 500) {
+ this.setDamage(this.thisStack, 13);
}
- GameRegistry.registerItem(this, unlocalizedName+"-"+charge);
+ GameRegistry.registerItem(this, this.unlocalizedName + "-" + charge);
+ }
+
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add("");
+ list.add(EnumChatFormatting.GREEN + "Worn as a Belt within Baubles." + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + "Drains 10,000EU/t to provide invisibility." + 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 + "] Input 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 + "Time Remaining: [" + EnumChatFormatting.YELLOW + this.secondsLeft(stack)
+ + EnumChatFormatting.GRAY + " seconds]");
+ super.addInformation(stack, aPlayer, list, bool);
}
@Override
- public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) {
- if (worldObj.isRemote) {
- return;
- }
-
- if (player instanceof EntityPlayer){
- for (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);
- }
-
- }
- }
- }
-
-
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
}
@Override
- public boolean canProvideEnergy(ItemStack itemStack) {
+ public boolean canProvideEnergy(final ItemStack itemStack) {
return true;
}
@Override
- public Item getChargedItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(maxValueEU);
- return x.getItem();
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
}
@Override
- public Item getEmptyItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public double getMaxCharge(ItemStack itemStack) {
- return maxValueEU;
- }
+ public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
+ final boolean simulate) {
- @Override
- public int getTier(ItemStack itemStack) {
- return 5;
+ if (!simulate) {
+ ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
}
@Override
- public double getTransferLimit(ItemStack itemStack) {
- return 8196;
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
@Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ 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);
+ }
- return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY);
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public double getDurabilityForDisplay(ItemStack stack)
- {
- //return 1.0D - getEnergyStored(stack) / this.capacity;
- return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack);
+ public BaubleType getBaubleType(final ItemStack arg0) {
+ return BaubleType.BELT;
}
@Override
- public boolean showDurabilityBar(ItemStack stack)
- {
- return true;
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
}
-
- public int secondsLeft(ItemStack stack){
- double r = 0;
- r = getCharge(stack)/(10000*20);
- return (int) MathUtils.decimalRounding(r);
+
+ @Override
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(ItemCloakingDevice.maxValueEU);
+ return x.getItem();
}
@Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add("");
- list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY);
- list.add("");
- list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Input 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+"Time Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]");
- super.addInformation(stack, aPlayer, list, bool);
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ // return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - this.getCharge(stack) / this.getMaxCharge(stack);
}
- /*@Override
- public ItemStack getContainerItem(ItemStack itemStack)
- {
- ItemStack newItem = itemStack.copy();
- newItem.stackSize = 1;
- extractEnergy(newItem, 150000, false);
- return newItem;
- }*/
+ /*
+ * @Override public ItemStack getContainerItem(ItemStack itemStack) {
+ * ItemStack newItem = itemStack.copy(); newItem.stackSize = 1;
+ * extractEnergy(newItem, 150000, false); return newItem; }
+ */
- /*@Override
- public boolean hasContainerItem(ItemStack stack)
- {
- return true;
- }*/
+ /*
+ * @Override public boolean hasContainerItem(ItemStack stack) { return true;
+ * }
+ */
- /*@Override
- public int getBurnTime(ItemStack fuel) {
- if ((fuel == null) || (fuel.getItem() != this)) {
- return 0;
- }
- return extractEnergy(fuel, 150000, true) / 50 / 100;
- }*/
+ /*
+ * @Override public int getBurnTime(ItemStack fuel) { if ((fuel == null) ||
+ * (fuel.getItem() != this)) { return 0; } return extractEnergy(fuel,
+ * 150000, true) / 50 / 100; }
+ */
@Override
- public double charge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean simulate) {
-
- if (!simulate)
- {
- ElectricItem.manager.charge(stack, amount, tier, true, simulate);
-
- }
- return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public double discharge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean externally, boolean simulate) {
- if (!simulate)
- {
- ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
- }
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ return EnumChatFormatting.BLUE + "Personal Cloaking Device" + EnumChatFormatting.GRAY;
}
@Override
- public double getCharge(ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
+ public double getMaxCharge(final ItemStack itemStack) {
+ return ItemCloakingDevice.maxValueEU;
}
@Override
- public boolean canUse(ItemStack stack, double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ public int getTier(final ItemStack itemStack) {
+ return 5;
}
@Override
- public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
+ public String getToolTip(final ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
}
@Override
- public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 8196;
}
- @Override
- public String getToolTip(ItemStack stack) {
- return ElectricItem.manager.getToolTip(stack);
- }
+ @Override // TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
- @Override
- public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
- return true;
}
- @Override
- public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
- return true;
- }
+ @Override // TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
- @Override
- public BaubleType getBaubleType(ItemStack arg0) {
- return BaubleType.BELT;
}
- @Override //TODO
- public void onEquipped(ItemStack arg0, EntityLivingBase arg1) {
+ @Override
+ 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 (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ final IElectricItem electricItem = (IElectricItem) is.getItem();
+ this.chargeEU = ElectricItem.manager.getCharge(is);
+ }
- @Override //TODO
- public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) {
+ }
+ }
+ }
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
- @Override //TODO
- public void onWornTick(ItemStack arg0, EntityLivingBase arg1) {
- //Utils.LOG_INFO("Trying to Tick Belt. 1");
- if (!arg1.worldObj.isRemote){
- if (getCharge(arg0) >= 10000){
+ @Override // TODO
+ public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) {
+ // Utils.LOG_INFO("Trying to Tick Belt. 1");
+ if (!arg1.worldObj.isRemote) {
+ 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))){
+ if (arg1.isPotionActive(Potion.invisibility)) {
arg1.removePotionEffect(Potion.invisibility.id);
}
}
}
}
+ public int secondsLeft(final ItemStack stack) {
+ double r = 0;
+ r = this.getCharge(stack) / (10000 * 20);
+ return (int) MathUtils.decimalRounding(r);
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
index eab451bcbc..6a60809fce 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
@@ -21,208 +21,215 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-@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{
-
- private final String unlocalizedName = "personalHealingDevice";
- private final ItemStack thisStack;
- private final static int maxValueEU = 1000000000;
- protected double chargeEU = 0;
-
- public ItemHealingDevice(){
+@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 {
+
+ private final static int maxValueEU = 1000000000;
+ private final String unlocalizedName = "personalHealingDevice";
+ private final ItemStack thisStack;
+ protected double chargeEU = 0;
+
+ 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 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 void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) {
- if (worldObj.isRemote) {
- return;
- }
-
- if (player instanceof EntityPlayer){
- for (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);
- }
-
- }
- }
- }
-
-
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
}
@Override
- public boolean canProvideEnergy(ItemStack itemStack) {
+ public boolean canProvideEnergy(final ItemStack itemStack) {
return true;
}
@Override
- public Item getChargedItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(maxValueEU);
- return x.getItem();
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
}
@Override
- public Item getEmptyItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public double getMaxCharge(ItemStack itemStack) {
- return maxValueEU;
- }
+ public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
+ final boolean simulate) {
- @Override
- public int getTier(ItemStack itemStack) {
- return 5;
+ if (!simulate) {
+ ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
}
@Override
- public double getTransferLimit(ItemStack itemStack) {
- return 32784;
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
@Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ 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);
+ }
- return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET);
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public double getDurabilityForDisplay(ItemStack stack)
- {
- //return 1.0D - getEnergyStored(stack) / this.capacity;
- return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack);
+ public BaubleType getBaubleType(final ItemStack arg0) {
+ return BaubleType.AMULET;
}
@Override
- public boolean showDurabilityBar(ItemStack stack)
- {
- return true;
- }
-
- public double secondsLeft(ItemStack stack){
-
- double r = 0;
- r = getCharge(stack)/(1638400/4);
- return (int) r;
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
}
@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 +"]");
- super.addInformation(stack, aPlayer, list, bool);
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(ItemHealingDevice.maxValueEU);
+ return x.getItem();
}
@Override
- public double charge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean simulate) {
-
- if (!simulate)
- {
- ElectricItem.manager.charge(stack, amount, tier, true, simulate);
-
- }
- return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ // return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - this.getCharge(stack) / this.getMaxCharge(stack);
}
@Override
- public double discharge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean externally, boolean simulate) {
- if (!simulate)
- {
- ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
- }
-
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public double getCharge(ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
- }
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- @Override
- public boolean canUse(ItemStack stack, double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ return EnumChatFormatting.BLUE + "Personal Healing NanoBooster" + EnumChatFormatting.RESET;
}
@Override
- public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
+ public double getMaxCharge(final ItemStack itemStack) {
+ return ItemHealingDevice.maxValueEU;
}
@Override
- public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public int getTier(final ItemStack itemStack) {
+ return 5;
}
@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) {
- return true;
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 32784;
}
- @Override
- public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
- return true;
- }
+ @Override // TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
- @Override
- public BaubleType getBaubleType(ItemStack arg0) {
- return BaubleType.AMULET;
}
- @Override //TODO
- public void onEquipped(ItemStack arg0, EntityLivingBase arg1) {
+ @Override // TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
}
- @Override //TODO
- public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) {
+ @Override
+ 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 (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ final IElectricItem electricItem = (IElectricItem) is.getItem();
+ this.chargeEU = ElectricItem.manager.getCharge(is);
+ }
+ }
+ }
+ }
+
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
- @Override //TODO
- public void onWornTick(ItemStack arg0, EntityLivingBase arg1) {
- if (!arg1.worldObj.isRemote){
- if (getCharge(arg0) >= 1638400/4){
- if (arg1.getHealth() < arg1.getMaxHealth()){
- 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)+".");
+ @Override // TODO
+ public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) {
+ if (!arg1.worldObj.isRemote) {
+ if (this.getCharge(arg0) >= 1638400 / 4) {
+ if (arg1.getHealth() < arg1.getMaxHealth()) {
+ final float rx = arg1.getMaxHealth() - arg1.getHealth();
+ Utils.LOG_INFO("rx:" + rx);
+ 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) + ".");
}
}
}
}
+ public double secondsLeft(final ItemStack stack) {
+
+ double r = 0;
+ r = this.getCharge(stack) / (1638400 / 4);
+ return (int) r;
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
index fed8c7f763..a80a998aed 100644
--- a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
+++ b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
@@ -14,197 +14,168 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.FillBucketEvent;
-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);
- if (MinecraftForge.EVENT_BUS.post(event))
- {
- return p_77659_1_;
+public class NuclearFuelRodBase extends Item {
+ /** 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);
+ }
+
+ @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_;
+ }
+ }
+
+ /**
+ * 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_;
}
- if (event.getResult() == Event.Result.ALLOW)
- {
- if (p_77659_3_.capabilities.isCreativeMode)
- {
- 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_1_.stackSize <= 0) {
+ return event.result;
+ }
- if (!p_77659_3_.inventory.addItemStackToInventory(event.result))
- {
- p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false);
- }
+ if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) {
+ p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false);
+ }
- return p_77659_1_;
+ 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);
- }
- }
+ 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_;
+ }
+
+ 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();
-
- if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag)
- {
- return false;
+ }
+
+ /**
+ * 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;
}
- 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);
-
- 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);
- }
+ if (p_77875_1_.provider.isHellWorld && this.isFull == Blocks.flowing_water) {
+ 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", p_77875_2_ + Math.random(), p_77875_3_ + Math.random(),
+ p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D);
+ }
}
- else
- {
- if (!p_77875_1_.isRemote && flag && !material.isLiquid())
- {
- p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true);
- }
-
- p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3);
+ else {
+ if (!p_77875_1_.isRemote && flag && !material.isLiquid()) {
+ p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true);
+ }
+
+ p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3);
}
return true;
- }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
index 814ace1fc9..db278134de 100644
--- a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
+++ b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
@@ -23,289 +23,286 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
-public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler{
+public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler {
- public static int rfPerEU = 4;
- private final String unlocalizedName = "rfEUBattery";
- private final ItemStack thisStack;
- private final static int maxValueEU = 100000000;
- private final static int maxValueRF = maxValueEU * rfPerEU;
- protected double chargeEU = 0;
+ public static int rfPerEU = 4;
+ private final static int maxValueEU = 100000000;
+ private final static int maxValueRF = RF2EU_Battery.maxValueEU * RF2EU_Battery.rfPerEU;
+ private final String unlocalizedName = "rfEUBattery";
+ private final ItemStack thisStack;
+ protected double chargeEU = 0;
- public RF2EU_Battery(){
- super(maxValueRF, maxValueRF, maxValueRF);
+ public RF2EU_Battery() {
+ super(RF2EU_Battery.maxValueRF, RF2EU_Battery.maxValueRF, RF2EU_Battery.maxValueRF);
GameRegistry.registerFuelHandler(this);
- //this.setMaxDamage(Integer.MAX_VALUE);
- //this.setDamage(UtilsItems.getSimpleStack(this), 0);
+ // this.setMaxDamage(Integer.MAX_VALUE);
+ // this.setDamage(UtilsItems.getSimpleStack(this), 0);
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.setUnlocalizedName(unlocalizedName);
+ this.setUnlocalizedName(this.unlocalizedName);
this.setMaxStackSize(1);
this.setTextureName(CORE.MODID + ":" + "itemIngot");
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_) {
- getEnergyStored(itemStack);
- if (worldObj.isRemote) {
- return;
- }
-
- if (player instanceof EntityPlayer){
- for (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);
- }
-
- }
- }
- }
-
-
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(EnumChatFormatting.YELLOW + "IC2/EU Information" + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY + "Tier: [" + EnumChatFormatting.YELLOW + this.getTier(this.thisStack)
+ + EnumChatFormatting.GRAY + "] Current Power: [" + EnumChatFormatting.YELLOW
+ + (long) this.getCharge(stack) + EnumChatFormatting.GRAY + "/EU]");
+ list.add(EnumChatFormatting.GRAY + "Transfer Limit: [" + EnumChatFormatting.YELLOW
+ + this.getTransferLimit(this.thisStack) + EnumChatFormatting.GRAY + "Eu/t]" + "Burn Time: ["
+ + EnumChatFormatting.YELLOW + this.getBurnTime(stack) / 20 + EnumChatFormatting.GRAY + "s]");
+ list.add("");
+ list.add(EnumChatFormatting.RED + "RF Information");
+ list.add(EnumChatFormatting.GRAY + "Extraction Rate: [" + EnumChatFormatting.RED + this.maxExtract
+ + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" + EnumChatFormatting.RED + this.maxReceive
+ + EnumChatFormatting.GRAY + "Rf/t]");
+ list.add(EnumChatFormatting.GRAY + "Current Charge: [" + EnumChatFormatting.RED + this.getEnergyStored(stack)
+ + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack) + "Rf] " + EnumChatFormatting.RED
+ + MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))
+ + EnumChatFormatting.GRAY + "%");
+ super.addInformation(stack, aPlayer, list, bool);
}
@Override
- public boolean canProvideEnergy(ItemStack itemStack) {
+ public boolean canProvideEnergy(final ItemStack itemStack) {
return true;
}
@Override
- public Item getChargedItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(maxValueEU);
- return x.getItem();
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public Item getEmptyItem(ItemStack itemStack) {
- ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
+ final boolean simulate) {
+ if (stack.stackTagCompound == null) {
+ stack.stackTagCompound = new NBTTagCompound();
+ }
+ int energy = stack.stackTagCompound.getInteger("Energy");
+ final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, this.maxReceive));
+ if (!simulate) {
+ energy += energyReceived;
+ stack.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
+ ElectricItem.manager.charge(stack, energy / RF2EU_Battery.rfPerEU, 3, true, false);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate);
}
@Override
- public double getMaxCharge(ItemStack itemStack) {
- return maxValueEU;
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
@Override
- public int getTier(ItemStack itemStack) {
- return 3;
+ public double discharge(final ItemStack stack, final double amount, final int tier,
+ final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) {
+ if (stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("Energy")) {
+ final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1) {
+ return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
+ }
+ return 0;
+ }
+ int energy = stack.stackTagCompound.getInteger("Energy");
+ final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, this.maxExtract));
+ if (!simulate) {
+ energy -= energyExtracted;
+ stack.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
+ ElectricItem.manager.charge(stack, energy / RF2EU_Battery.rfPerEU, 3, true, false);
+ }
+
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public double getTransferLimit(ItemStack itemStack) {
- return 8196;
+ public int extractEnergy(final ItemStack container, final int maxExtract, final boolean simulate) {
+ if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
+ final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1) {
+ return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
+ }
+ return 0;
+ }
+ int energy = container.stackTagCompound.getInteger("Energy");
+ final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
+ if (!simulate) {
+ energy -= energyExtracted;
+ container.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
+ ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
+ }
+ return energyExtracted;
}
@Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ public int getBurnTime(final ItemStack fuel) {
+ if (fuel == null || fuel.getItem() != this) {
+ return 0;
+ }
+ return this.extractEnergy(fuel, 150000, true) / 50 / 100;
+ }
- return ("Universally Chargeable Battery");
+ @Override
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
}
@Override
- public double getDurabilityForDisplay(ItemStack stack)
- {
- //return 1.0D - getEnergyStored(stack) / this.capacity;
- return MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack));
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(RF2EU_Battery.maxValueEU);
+ return x.getItem();
}
@Override
@SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
- {
- int i = 30;
+ public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) {
+ final int i = 30;
- float f13 = (float)(Minecraft.getSystemTime() % 6000L) / 3000.0F * 3.141592F * 2.0F;
+ final float f13 = Minecraft.getSystemTime() % 6000L / 3000.0F * 3.141592F * 2.0F;
- float t = 0.9F + 0.1F * MathHelper.cos(f13);
+ final float t = 0.9F + 0.1F * MathHelper.cos(f13);
- double v = 1.0D - getDurabilityForDisplay(par1ItemStack);
+ final double v = 1.0D - this.getDurabilityForDisplay(par1ItemStack);
- int r = i + (int)(v * (255 - i) * t);
+ int r = i + (int) (v * (255 - i) * t);
if (r > 255) {
r = 255;
}
- int g = i + (int)(v * (64 - i) * t);
+ final int g = i + (int) (v * (64 - i) * t);
return r << 16 | g << 8 | i;
}
@Override
- public boolean showDurabilityBar(ItemStack stack)
- {
- return false;
+ public ItemStack getContainerItem(final ItemStack itemStack) {
+ final ItemStack newItem = itemStack.copy();
+ newItem.stackSize = 1;
+ this.extractEnergy(newItem, 150000, false);
+ return newItem;
}
@Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"/EU]");
- list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+getBurnTime(stack)/20+EnumChatFormatting.GRAY+"s]");
- list.add("");
- list.add(EnumChatFormatting.RED+"RF Information");
- list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]");
- list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%");
- super.addInformation(stack, aPlayer, list, bool);
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ // return 1.0D - getEnergyStored(stack) / this.capacity;
+ return MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack));
}
@Override
- public ItemStack getContainerItem(ItemStack itemStack)
- {
- ItemStack newItem = itemStack.copy();
- newItem.stackSize = 1;
- extractEnergy(newItem, 150000, false);
- return newItem;
- }
-
- @Override
- public boolean hasContainerItem(ItemStack stack)
- {
- return true;
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public int getBurnTime(ItemStack fuel) {
- if ((fuel == null) || (fuel.getItem() != this)) {
+ public int getEnergyStored(final ItemStack container) {
+ if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
+ final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1) {
+ return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
+ }
return 0;
}
- return extractEnergy(fuel, 150000, true) / 50 / 100;
+ final int energy = container.stackTagCompound.getInteger("Energy");
+ ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
+ ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
+ return energy;
}
@Override
- public double charge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean simulate) {
- if (stack.stackTagCompound == null) {
- stack.stackTagCompound = new NBTTagCompound();
- }
- int energy = stack.stackTagCompound.getInteger("Energy");
- int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
- if (!simulate)
- {
- energy += energyReceived;
- stack.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
- ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false);
-
- }
- return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate);
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return "Universally Chargeable Battery";
}
@Override
- public double discharge(ItemStack stack, double amount, int tier,
- boolean ignoreTransferLimit, boolean externally, boolean simulate) {
- if ((stack.stackTagCompound == null) || (!stack.stackTagCompound.hasKey("Energy"))) {
- double euCharge = getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1){
- return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
- }
- return 0;
- }
- int energy = stack.stackTagCompound.getInteger("Energy");
- int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
- if (!simulate)
- {
- energy -= energyExtracted;
- stack.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
- ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false);
- }
-
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ public double getMaxCharge(final ItemStack itemStack) {
+ return RF2EU_Battery.maxValueEU;
}
@Override
- public double getCharge(ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
+ public int getTier(final ItemStack itemStack) {
+ return 3;
}
@Override
- public boolean canUse(ItemStack stack, double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ public String getToolTip(final ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
}
@Override
- public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 8196;
}
@Override
- public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public boolean hasContainerItem(final ItemStack stack) {
+ return true;
}
@Override
- public String getToolTip(ItemStack stack) {
- return ElectricItem.manager.getToolTip(stack);
+ public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
+ final boolean p_77663_5_) {
+ this.getEnergyStored(itemStack);
+ if (worldObj.isRemote) {
+ return;
+ }
+
+ if (player instanceof EntityPlayer) {
+ for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ final IElectricItem electricItem = (IElectricItem) is.getItem();
+ this.chargeEU = ElectricItem.manager.getCharge(is);
+ }
+
+ }
+ }
+ }
+
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
@Override
- public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate)
- {
- if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
- double euCharge = getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1){
- return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
+ public int receiveEnergy(final ItemStack container, final int maxReceive, final boolean simulate) {
+ if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
+ final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1) {
+ return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
}
return 0;
}
int energy = container.stackTagCompound.getInteger("Energy");
- int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
- if (!simulate)
- {
+ final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
+ if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("Energy", energy);
ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
-
+ ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
+
}
return energyReceived;
}
@Override
- public int extractEnergy(ItemStack container, int maxExtract, boolean simulate)
- {
- if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
- double euCharge = getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1){
- return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
- }
- return 0;
- }
- int energy = container.stackTagCompound.getInteger("Energy");
- int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
- if (!simulate)
- {
- energy -= energyExtracted;
- container.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
- }
- return energyExtracted;
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return false;
}
@Override
- public int getEnergyStored(ItemStack container)
- {
- if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
- double euCharge = getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1){
- return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
- }
- return 0;
- }
- int energy = container.stackTagCompound.getInteger("Energy");
- ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
- return energy;
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
index d90a0165b7..63638d9055 100644
--- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
+++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
@@ -12,14 +12,15 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class FuelRod_Base extends Item{
-
- public int fuelRemaining = 0;
- public int maximumFuel = 0;
- public String fuelType = "";
- public float heat = 0;
- public float maxHeat = getMaxHeat();
- public FuelRod_Base(String unlocalizedName, String type, int fuelLeft, int maxFuel) {
+public class FuelRod_Base extends Item {
+
+ public int fuelRemaining = 0;
+ public int maximumFuel = 0;
+ public String fuelType = "";
+ public float heat = 0;
+ public float maxHeat = this.getMaxHeat();
+
+ public FuelRod_Base(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(1);
@@ -29,194 +30,192 @@ public class FuelRod_Base extends Item{
this.fuelType = type;
this.setCreativeTab(AddToCreativeTab.tabMachines);
}
-
- private float getMaxHeat(){
- float tempvar;
- if (fuelType == "Thorium"){
- tempvar = 2500;
- }
-
- else if (fuelType == "Uranium"){
- tempvar = 5000;
- }
-
- else if (fuelType == "Plutonium"){
- tempvar = 10000;
- }
-
- else {
- tempvar = 5000;
+
+ public boolean addFuel(final int i) {
+ final int tempFuel = this.fuelRemaining;
+ this.fuelRemaining = tempFuel + i;
+ if (this.fuelRemaining != tempFuel) {
+ return true;
}
- return tempvar;
-
+ return false;
}
-
- private void updateVars(ItemStack stack){
- if (stack.stackTagCompound != null) {
- heat = stack.stackTagCompound.getFloat("heat");
- fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining");
- }
+
+ public boolean addHeat(final float i) {
+ final float tempFuel = this.heat;
+ this.heat = tempFuel + i;
+ if (this.heat != tempFuel) {
+ return true;
+ }
+ return false;
}
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
+
+ @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) {
- Float NBT_Heat = heat;
- Float NBT_MaxHeat = maxHeat;
- int NBT_Fuel = fuelRemaining;
- String NBT_Type= fuelType;
+ Float NBT_Heat = this.heat;
+ Float NBT_MaxHeat = this.maxHeat;
+ int NBT_Fuel = this.fuelRemaining;
+ String NBT_Type = this.fuelType;
if (stack.stackTagCompound != null) {
NBT_Heat = stack.stackTagCompound.getFloat("heat");
NBT_MaxHeat = stack.stackTagCompound.getFloat("maxHeat");
NBT_Fuel = stack.stackTagCompound.getInteger("fuelRemaining");
NBT_Type = stack.stackTagCompound.getString("fuelType");
- }
-
- String tempHeat = String.valueOf(NBT_Heat);
- String tempMaxHeat = String.valueOf(NBT_MaxHeat);
- String tempFuel = String.valueOf(NBT_Fuel);
- String formattedType = EnumChatFormatting.DARK_RED+NBT_Type+EnumChatFormatting.GRAY;
- String formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY;
- String formattedMaxHeat = EnumChatFormatting.RED+tempMaxHeat+EnumChatFormatting.GRAY;
- String formattedFuelLeft = tempFuel+EnumChatFormatting.GRAY;
-
- int tempMax = maximumFuel;
- float tempCurrentHeat = heat;
- int tempFuelLeft = fuelRemaining;
-
- //Fuel Usage Formatting
- if (tempFuelLeft <= maximumFuel/3){
- formattedFuelLeft = EnumChatFormatting.RED+tempFuel+EnumChatFormatting.GRAY;
- }
- else if (tempFuelLeft >= maximumFuel/3 && tempFuelLeft <= (maximumFuel/3)*2){
- formattedFuelLeft = EnumChatFormatting.YELLOW+tempFuel+EnumChatFormatting.GRAY;
- }
- else if (tempFuelLeft >= (maximumFuel/3)*2 && tempFuelLeft <= maximumFuel){
- formattedFuelLeft = EnumChatFormatting.GREEN+tempFuel+EnumChatFormatting.GRAY;
+ }
+
+ final String tempHeat = String.valueOf(NBT_Heat);
+ final String tempMaxHeat = String.valueOf(NBT_MaxHeat);
+ final String tempFuel = String.valueOf(NBT_Fuel);
+ final String formattedType = EnumChatFormatting.DARK_RED + NBT_Type + EnumChatFormatting.GRAY;
+ String formattedHeat = EnumChatFormatting.RED + tempHeat + EnumChatFormatting.GRAY;
+ final String formattedMaxHeat = EnumChatFormatting.RED + tempMaxHeat + EnumChatFormatting.GRAY;
+ String formattedFuelLeft = tempFuel + EnumChatFormatting.GRAY;
+
+ final int tempMax = this.maximumFuel;
+ final float tempCurrentHeat = this.heat;
+ final int tempFuelLeft = this.fuelRemaining;
+
+ // Fuel Usage Formatting
+ if (tempFuelLeft <= this.maximumFuel / 3) {
+ formattedFuelLeft = EnumChatFormatting.RED + tempFuel + EnumChatFormatting.GRAY;
+ }
+ else if (tempFuelLeft >= this.maximumFuel / 3 && tempFuelLeft <= this.maximumFuel / 3 * 2) {
+ formattedFuelLeft = EnumChatFormatting.YELLOW + tempFuel + EnumChatFormatting.GRAY;
+ }
+ else if (tempFuelLeft >= this.maximumFuel / 3 * 2 && tempFuelLeft <= this.maximumFuel) {
+ formattedFuelLeft = EnumChatFormatting.GREEN + tempFuel + EnumChatFormatting.GRAY;
}
else {
- formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+EnumChatFormatting.GRAY;
+ formattedFuelLeft = EnumChatFormatting.GRAY + tempFuel + EnumChatFormatting.GRAY;
}
-
- //Heat Formatting
- if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0){
- formattedHeat = EnumChatFormatting.GRAY+tempHeat+EnumChatFormatting.GRAY;
+
+ // Heat Formatting
+ if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0) {
+ formattedHeat = EnumChatFormatting.GRAY + tempHeat + EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat <= maxHeat/3 && tempCurrentHeat > 200){
- formattedHeat = EnumChatFormatting.YELLOW+tempHeat+EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat <= this.maxHeat / 3 && tempCurrentHeat > 200) {
+ formattedHeat = EnumChatFormatting.YELLOW + tempHeat + EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat >= maxHeat/3 && tempMax < (maxHeat/3)*2 && tempCurrentHeat != 0){
- formattedHeat = EnumChatFormatting.GOLD+tempHeat+EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat >= this.maxHeat / 3 && tempMax < this.maxHeat / 3 * 2 && tempCurrentHeat != 0) {
+ formattedHeat = EnumChatFormatting.GOLD + tempHeat + EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat >= ((maxHeat/3)*2) && tempMax <= maxHeat && tempCurrentHeat != 0){
- formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat >= this.maxHeat / 3 * 2 && tempMax <= this.maxHeat && tempCurrentHeat != 0) {
+ formattedHeat = EnumChatFormatting.RED + tempHeat + EnumChatFormatting.GRAY;
}
else {
- formattedHeat = EnumChatFormatting.BLUE+tempHeat+EnumChatFormatting.GRAY;
+ formattedHeat = EnumChatFormatting.BLUE + tempHeat + EnumChatFormatting.GRAY;
}
- list.add(EnumChatFormatting.GRAY+"A "+formattedType+" Fuel Rod.");
- list.add(EnumChatFormatting.GRAY+"Running at "+formattedHeat+"/"+formattedMaxHeat+" Kelvin.");
- list.add(EnumChatFormatting.GRAY+"Fuel Remaining: "+formattedFuelLeft+"L.");
+ list.add(EnumChatFormatting.GRAY + "A " + formattedType + " Fuel Rod.");
+ list.add(EnumChatFormatting.GRAY + "Running at " + formattedHeat + "/" + formattedMaxHeat + " Kelvin.");
+ list.add(EnumChatFormatting.GRAY + "Fuel Remaining: " + formattedFuelLeft + "L.");
super.addInformation(stack, aPlayer, list, bool);
}
- public String getType(ItemStack stack){
- if (stack.stackTagCompound != null){
- return stack.stackTagCompound.getString("fuelType");
- }
- return fuelType;
+ public int getFuel(final ItemStack stack) {
+ if (stack != null) {
+ final int i = stack.getItemDamage();
+ final int r = this.maximumFuel - i;
+ return r;
+ }
+ return this.getFuelRemaining(stack);
}
- public int getFuelRemaining(ItemStack stack){
- if (stack.stackTagCompound != null){
+ public int getFuelRemaining(final ItemStack stack) {
+ if (stack.stackTagCompound != null) {
return stack.stackTagCompound.getInteger("fuelRemaining");
- }
- return 0;
- }
-
- public int getMaxFuel(){
- return maximumFuel;
+ }
+ return 0;
}
- public int getFuel(ItemStack stack){
- if (stack != null){
- int i = stack.getItemDamage();
- int r = maximumFuel - i;
- return r;
+ public float getHeat(final ItemStack value) {
+ if (value.stackTagCompound != null) {
+ return value.stackTagCompound.getFloat("heat");
}
- return getFuelRemaining(stack);
+ return 0f;
}
- public boolean setFuelRemainingExplicitly(int i){
- int tempFuel = fuelRemaining;
- fuelRemaining = i;
- if (i != tempFuel){
- return true;
- }
- return false;
+ public int getMaxFuel() {
+ return this.maximumFuel;
}
- public boolean addFuel(int i){
- int tempFuel = fuelRemaining;
- fuelRemaining = tempFuel+i;
- if (fuelRemaining != tempFuel){
- return true;
- }
- return false;
- }
+ private float getMaxHeat() {
+ float tempvar;
+ if (this.fuelType == "Thorium") {
+ tempvar = 2500;
+ }
- public float getHeat(ItemStack value){
- if (value.stackTagCompound != null){
- return value.stackTagCompound.getFloat("heat");
+ else if (this.fuelType == "Uranium") {
+ tempvar = 5000;
}
- return 0f;
- }
- public boolean addHeat(float i){
- float tempFuel = heat;
- heat = tempFuel+i;
- if (heat != tempFuel){
- return true;
- }
- return false;
+ else if (this.fuelType == "Plutonium") {
+ tempvar = 10000;
+ }
+
+ else {
+ tempvar = 5000;
+ }
+ return tempvar;
+
}
+ public String getType(final ItemStack stack) {
+ if (stack.stackTagCompound != null) {
+ return stack.stackTagCompound.getString("fuelType");
+ }
+ return this.fuelType;
+ }
- //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.
+ // 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;
*
- * 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();
- itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack));
- itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel);
- itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack));
- itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat());
- itemStack.stackTagCompound.setString("fuelType", getType(itemStack));
- updateVars(itemStack);
+ itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack));
+ itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel);
+ itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack));
+ itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat());
+ itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack));
+ this.updateVars(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) {
itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack));
- itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel);
- itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack));
- itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat());
- itemStack.stackTagCompound.setString("fuelType", getType(itemStack));
- updateVars(itemStack);
+ itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack));
+ itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel);
+ itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack));
+ itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat());
+ itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack));
+ this.updateVars(itemStack);
+ }
+
+ public boolean setFuelRemainingExplicitly(final int i) {
+ final int tempFuel = this.fuelRemaining;
+ this.fuelRemaining = i;
+ if (i != tempFuel) {
+ return true;
+ }
+ return false;
+ }
+
+ private void updateVars(final ItemStack stack) {
+ if (stack.stackTagCompound != null) {
+ this.heat = stack.stackTagCompound.getFloat("heat");
+ this.fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining");
+ }
}
-
-
}
diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
index 9b852cb1ea..a90ca5db35 100644
--- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
+++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
@@ -1,8 +1,8 @@
package gtPlusPlus.core.item.general.fuelrods;
-public class FuelRod_Thorium extends FuelRod_Base{
+public class FuelRod_Thorium extends FuelRod_Base {
- public FuelRod_Thorium(String unlocalizedName, String type, int fuelLeft, int maxFuel) {
+ public FuelRod_Thorium(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) {
super(unlocalizedName, type, fuelLeft, maxFuel);
this.setMaxDamage(maxFuel);
this.maximumFuel = maxFuel;