diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
18 files changed, 228 insertions, 282 deletions
diff --git a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java index 2b03e851e1..eef37387f5 100644 --- a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java +++ b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java @@ -16,18 +16,18 @@ public class AddToCreativeTab { public static CreativeTabs tabOther; public static CreativeTabs tabBOP; - public static void initialiseTabs(){ + public static void initialiseTabs() { tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab"); tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab"); tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); - if (LoadedMods.BiomesOPlenty){ + if (LoadedMods.BiomesOPlenty) { tabBOP = new MiscUtilsBOPTab("MiscUtilBOP"); } - if (CORE.DEBUG){ - //tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab"); + if (CORE.DEBUG) { + // tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab"); } } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java index 99c6eca8df..0b8235fcd8 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotBlueprint extends Slot{ +public class SlotBlueprint extends Slot { public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); @@ -14,11 +14,11 @@ public class SlotBlueprint extends Slot{ @Override public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof IItemBlueprint){ - Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Blueprint."); + if (itemstack.getItem() instanceof IItemBlueprint) { + Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Blueprint."); + Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java index f55a759b8f..3578eaedf1 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -7,7 +7,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotBuzzSaw extends Slot{ +public class SlotBuzzSaw extends Slot { public SAWTOOL currentTool = SAWTOOL.NONE; @@ -20,33 +20,34 @@ public class SlotBuzzSaw extends Slot{ public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; - if (itemstack != null){ - if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_02) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool)){ - //Buzzsaw Blade //TODO - /*if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){ - isValid = false; - }*/ - if (OrePrefixes.craftingTool.contains(itemstack)){ - if (itemstack.getDisplayName().toLowerCase().contains("saw") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")){ - if (itemstack.getItemDamage() == 10){ + if (itemstack != null) { + if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_02) + || (itemstack.getItem() instanceof GT_MetaGenerated_Tool)) { + // Buzzsaw Blade //TODO + /* + * if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){ isValid + * = false; } + */ + if (OrePrefixes.craftingTool.contains(itemstack)) { + if (itemstack.getDisplayName().toLowerCase().contains("saw") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { + if (itemstack.getItemDamage() == 10) { isValid = true; this.currentTool = SAWTOOL.SAW; } - if (itemstack.getItemDamage() == 140){ + if (itemstack.getItemDamage() == 140) { isValid = true; this.currentTool = SAWTOOL.BUZZSAW; } } - } - else { + } else { this.currentTool = SAWTOOL.NONE; } - } - else { + } else { this.currentTool = SAWTOOL.NONE; } - } - else { + } else { this.currentTool = SAWTOOL.NONE; } return isValid; @@ -58,9 +59,7 @@ public class SlotBuzzSaw extends Slot{ } public enum SAWTOOL { - NONE, - SAW, - BUZZSAW + NONE, SAW, BUZZSAW } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java index 6bcf3ed58c..4ad26d6093 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java +++ b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java @@ -11,41 +11,41 @@ import net.minecraft.stats.AchievementList; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -public class SlotCrafting extends Slot -{ +public class SlotCrafting extends Slot { /** The craft matrix inventory linked to this result slot. */ private final IInventory craftMatrix; /** The player that is using the GUI where this slot resides. */ private final EntityPlayer thePlayer; - /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ + /** + * The number of items that have been crafted so far. Gets passed to + * ItemStack.onCrafting before being reset. + */ private int amountCrafted; private static final String __OBFID = "CL_00001761"; - public SlotCrafting(final EntityPlayer p_i1823_1_, final IInventory p_i1823_2_, final IInventory p_i1823_3_, final int p_i1823_4_, final int p_i1823_5_, final int p_i1823_6_) - { + public SlotCrafting(final EntityPlayer p_i1823_1_, final IInventory p_i1823_2_, final IInventory p_i1823_3_, + final int p_i1823_4_, final int p_i1823_5_, final int p_i1823_6_) { super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_); this.thePlayer = p_i1823_1_; this.craftMatrix = p_i1823_2_; } /** - * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + * Check if the stack is a valid item for this slot. Always true beside for + * the armor slots. */ @Override - public boolean isItemValid(final ItemStack p_75214_1_) - { + public boolean isItemValid(final ItemStack p_75214_1_) { return false; } /** - * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new - * stack. + * Decrease the size of the stack in slot (first int arg) by the amount of + * the second int arg. Returns the new stack. */ @Override - public ItemStack decrStackSize(final int p_75209_1_) - { - if (this.getHasStack()) - { + public ItemStack decrStackSize(final int p_75209_1_) { + if (this.getHasStack()) { this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); } @@ -53,108 +53,92 @@ public class SlotCrafting extends Slot } /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an - * internal count then calls onCrafting(item). + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. Typically increases an internal count then calls + * onCrafting(item). */ @Override - protected void onCrafting(final ItemStack p_75210_1_, final int p_75210_2_) - { + protected void onCrafting(final ItemStack p_75210_1_, final int p_75210_2_) { this.amountCrafted += p_75210_2_; this.onCrafting(p_75210_1_); } /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. */ @Override - protected void onCrafting(final ItemStack p_75208_1_) - { + protected void onCrafting(final ItemStack p_75208_1_) { p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) - { + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) { this.thePlayer.addStat(AchievementList.buildWorkBench, 1); } - if (p_75208_1_.getItem() instanceof ItemPickaxe) - { + if (p_75208_1_.getItem() instanceof ItemPickaxe) { this.thePlayer.addStat(AchievementList.buildPickaxe, 1); } - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) - { + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) { this.thePlayer.addStat(AchievementList.buildFurnace, 1); } - if (p_75208_1_.getItem() instanceof ItemHoe) - { + if (p_75208_1_.getItem() instanceof ItemHoe) { this.thePlayer.addStat(AchievementList.buildHoe, 1); } - if (p_75208_1_.getItem() == Items.bread) - { + if (p_75208_1_.getItem() == Items.bread) { this.thePlayer.addStat(AchievementList.makeBread, 1); } - if (p_75208_1_.getItem() == Items.cake) - { + if (p_75208_1_.getItem() == Items.cake) { this.thePlayer.addStat(AchievementList.bakeCake, 1); } - if ((p_75208_1_.getItem() instanceof ItemPickaxe) && (((ItemPickaxe)p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD)) - { + if ((p_75208_1_.getItem() instanceof ItemPickaxe) + && (((ItemPickaxe) p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD)) { this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); } - if (p_75208_1_.getItem() instanceof ItemSword) - { + if (p_75208_1_.getItem() instanceof ItemSword) { this.thePlayer.addStat(AchievementList.buildSword, 1); } - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) - { + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) { this.thePlayer.addStat(AchievementList.enchantments, 1); } - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) - { + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) { this.thePlayer.addStat(AchievementList.bookcase, 1); } } @Override - public void onPickupFromSlot(final EntityPlayer p_82870_1_, final ItemStack p_82870_2_) - { + public void onPickupFromSlot(final EntityPlayer p_82870_1_, final ItemStack p_82870_2_) { FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, this.craftMatrix); this.onCrafting(p_82870_2_); - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) - { + for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - if (itemstack1 != null) - { + if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); - if (itemstack1.getItem().hasContainerItem(itemstack1)) - { + if (itemstack1.getItem().hasContainerItem(itemstack1)) { final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - if ((itemstack2 != null) && itemstack2.isItemStackDamageable() && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) - { + if ((itemstack2 != null) && itemstack2.isItemStackDamageable() + && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) { MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); continue; } - if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) - { - if (this.craftMatrix.getStackInSlot(i) == null) - { + if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) + || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { + if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); - } - else - { + } else { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java b/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java index 8ab1a48277..879ba87a0b 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java +++ b/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java @@ -12,38 +12,38 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.stats.AchievementList; -public class SlotCraftingNoCollect extends SlotCrafting -{ +public class SlotCraftingNoCollect extends SlotCrafting { /** The craft matrix inventory linked to this result slot. */ private final IInventory craftMatrix; /** The player that is using the GUI where this slot resides. */ private EntityPlayer thePlayer; - /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ + /** + * The number of items that have been crafted so far. Gets passed to + * ItemStack.onCrafting before being reset. + */ private int amountCrafted; - public SlotCraftingNoCollect(EntityPlayer player, IInventory inventory, IInventory inventory2, int x, int y, int z) - { + public SlotCraftingNoCollect(EntityPlayer player, IInventory inventory, IInventory inventory2, int x, int y, + int z) { super(player, inventory, inventory2, x, y, z); this.thePlayer = player; this.craftMatrix = inventory; } /** - * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + * Check if the stack is a valid item for this slot. Always true beside for + * the armor slots. */ - public boolean isItemValid(ItemStack p_75214_1_) - { + public boolean isItemValid(ItemStack p_75214_1_) { return false; } /** - * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new - * stack. + * Decrease the size of the stack in slot (first int arg) by the amount of + * the second int arg. Returns the new stack. */ - public ItemStack decrStackSize(int amount) - { - if (this.getHasStack()) - { + public ItemStack decrStackSize(int amount) { + if (this.getHasStack()) { this.amountCrafted += Math.min(amount, this.getStack().stackSize); } @@ -51,111 +51,91 @@ public class SlotCraftingNoCollect extends SlotCrafting } /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an - * internal count then calls onCrafting(item). + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. Typically increases an internal count then calls + * onCrafting(item). */ - protected void onCrafting(ItemStack output, int amount) - { + protected void onCrafting(ItemStack output, int amount) { this.amountCrafted += amount; this.onCrafting(output); } /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. */ - protected void onCrafting(ItemStack output) - { + protected void onCrafting(ItemStack output) { output.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; - if (output.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) - { + if (output.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) { this.thePlayer.addStat(AchievementList.buildWorkBench, 1); } - if (output.getItem() instanceof ItemPickaxe) - { + if (output.getItem() instanceof ItemPickaxe) { this.thePlayer.addStat(AchievementList.buildPickaxe, 1); } - if (output.getItem() == Item.getItemFromBlock(Blocks.furnace)) - { + if (output.getItem() == Item.getItemFromBlock(Blocks.furnace)) { this.thePlayer.addStat(AchievementList.buildFurnace, 1); } - if (output.getItem() instanceof ItemHoe) - { + if (output.getItem() instanceof ItemHoe) { this.thePlayer.addStat(AchievementList.buildHoe, 1); } - if (output.getItem() == Items.bread) - { + if (output.getItem() == Items.bread) { this.thePlayer.addStat(AchievementList.makeBread, 1); } - if (output.getItem() == Items.cake) - { + if (output.getItem() == Items.cake) { this.thePlayer.addStat(AchievementList.bakeCake, 1); } - if (output.getItem() instanceof ItemPickaxe && ((ItemPickaxe)output.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) - { + if (output.getItem() instanceof ItemPickaxe + && ((ItemPickaxe) output.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) { this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); } - if (output.getItem() instanceof ItemSword) - { + if (output.getItem() instanceof ItemSword) { this.thePlayer.addStat(AchievementList.buildSword, 1); } - if (output.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) - { + if (output.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) { this.thePlayer.addStat(AchievementList.enchantments, 1); } - if (output.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) - { + if (output.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) { this.thePlayer.addStat(AchievementList.bookcase, 1); } } - public void onPickupFromSlot(EntityPlayer player, ItemStack output) - { + public void onPickupFromSlot(EntityPlayer player, ItemStack output) { FMLCommonHandler.instance().firePlayerCraftingEvent(player, output, craftMatrix); this.onCrafting(output); - /*for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) - { - ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - - if (itemstack1 != null) - { - this.craftMatrix.decrStackSize(i, 1); - - if (itemstack1.getItem().hasContainerItem(itemstack1)) - { - ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - - if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) - { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); - continue; - } - - if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) - { - if (this.craftMatrix.getStackInSlot(i) == null) - { - this.craftMatrix.setInventorySlotContents(i, itemstack2); - } - else - { - this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); - } - } - } - } - }*/ + /* + * for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { + * ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); + * + * if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); + * + * if (itemstack1.getItem().hasContainerItem(itemstack1)) { ItemStack + * itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); + * + * if (itemstack2 != null && itemstack2.isItemStackDamageable() && + * itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { + * MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, + * itemstack2)); continue; } + * + * if + * (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) + * || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { + * if (this.craftMatrix.getStackInSlot(i) == null) { + * this.craftMatrix.setInventorySlotContents(i, itemstack2); } else { + * this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } + * } } } + */ } @Override diff --git a/src/Java/gtPlusPlus/core/slots/SlotDataStick.java b/src/Java/gtPlusPlus/core/slots/SlotDataStick.java index b32bc02624..26a7261f91 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotDataStick.java +++ b/src/Java/gtPlusPlus/core/slots/SlotDataStick.java @@ -8,7 +8,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotDataStick extends Slot{ +public class SlotDataStick extends Slot { public SlotDataStick(final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); @@ -19,15 +19,17 @@ public class SlotDataStick extends Slot{ public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; - if (itemstack != null){ - if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_01 && itemstack.getItemDamage() == 32708) - || (itemstack == ItemList.Tool_DataStick.get(1)) - || (itemstack == GregtechItemList.Old_Tool_DataStick.get(1)) - || (itemstack.getItem() instanceof MetaGeneratedGregtechItems && itemstack.getItemDamage() == 32208)){ + if (itemstack != null) { + if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_01 && itemstack.getItemDamage() == 32708) + || (itemstack == ItemList.Tool_DataStick.get(1)) + || (itemstack == GregtechItemList.Old_Tool_DataStick.get(1)) + || (itemstack.getItem() instanceof MetaGeneratedGregtechItems + && itemstack.getItemDamage() == 32208)) { isValid = true; } } - //Utils.LOG_INFO("Tried inserting "+itemstack.getDisplayName()+" | "+itemstack.getItemDamage()+" | "); + // Utils.LOG_INFO("Tried inserting "+itemstack.getDisplayName()+" | + // "+itemstack.getItemDamage()+" | "); return isValid; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotFrame.java b/src/Java/gtPlusPlus/core/slots/SlotFrame.java index bb2cabc61f..590a68fbb7 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotFrame.java +++ b/src/Java/gtPlusPlus/core/slots/SlotFrame.java @@ -5,7 +5,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotFrame extends Slot{ +public class SlotFrame extends Slot { public SlotFrame(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); diff --git a/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java b/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java index 7933ea136e..94a8b8ce0a 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java +++ b/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotFuelRod extends Slot{ +public class SlotFuelRod extends Slot { public SlotFuelRod(final IInventory inventory, final int index, final int x, final int y) { super(inventory, index, x, y); @@ -16,36 +16,30 @@ public class SlotFuelRod extends Slot{ @Override public boolean isItemValid(final ItemStack itemstack) { boolean returnValue = false; - //Uranium Rods - if (itemstack.getItem() == Ic2Items.reactorUraniumSimple.getItem()){ + // Uranium Rods + if (itemstack.getItem() == Ic2Items.reactorUraniumSimple.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == Ic2Items.reactorUraniumDual.getItem()){ + } else if (itemstack.getItem() == Ic2Items.reactorUraniumDual.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == Ic2Items.reactorUraniumQuad.getItem()){ + } else if (itemstack.getItem() == Ic2Items.reactorUraniumQuad.getItem()) { returnValue = true; } - - //Mox Rods - if (itemstack.getItem() == Ic2Items.reactorMOXSimple.getItem()){ + + // Mox Rods + if (itemstack.getItem() == Ic2Items.reactorMOXSimple.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == Ic2Items.reactorMOXDual.getItem()){ + } else if (itemstack.getItem() == Ic2Items.reactorMOXDual.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == Ic2Items.reactorMOXQuad.getItem()){ + } else if (itemstack.getItem() == Ic2Items.reactorMOXQuad.getItem()) { returnValue = true; } - - //Thorium Rods - if (itemstack.getItem() == ItemList.ThoriumCell_1.getItem()){ + + // Thorium Rods + if (itemstack.getItem() == ItemList.ThoriumCell_1.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == ItemList.ThoriumCell_2.getItem()){ + } else if (itemstack.getItem() == ItemList.ThoriumCell_2.getItem()) { returnValue = true; - } - else if (itemstack.getItem() == ItemList.ThoriumCell_4.getItem()){ + } else if (itemstack.getItem() == ItemList.ThoriumCell_4.getItem()) { returnValue = true; } return returnValue; diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java index 7ff350845e..d4c389d9cc 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java @@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotGeneric extends Slot{ +public class SlotGeneric extends Slot { public SlotGeneric(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java index a2fd83baee..cfa501eb1e 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotGtTool extends Slot{ +public class SlotGtTool extends Slot { public SlotGtTool(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); @@ -15,11 +15,11 @@ public class SlotGtTool extends Slot{ @Override public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){ - Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool."); + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { + Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); + Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java index 46ceb3209e..7fab32903a 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java @@ -13,26 +13,25 @@ public class SlotGtToolElectric extends SlotGtTool { public int tier; private ItemStack content; - public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier, final boolean allowRedstoneDust) - { + public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier, + final boolean allowRedstoneDust) { super(base, x, y, z); this.tier = tier; this.allowRedstoneDust = allowRedstoneDust; } - public boolean accepts(final ItemStack stack) - { + public boolean accepts(final ItemStack stack) { if (stack == null) { return false; } if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) { return false; } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D); + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) + || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D); } - public double discharge(final double amount, final boolean ignoreLimit) - { + public double discharge(final double amount, final boolean ignoreLimit) { if (amount <= 0.0D) { throw new IllegalArgumentException("Amount must be > 0."); } @@ -41,8 +40,7 @@ public class SlotGtToolElectric extends SlotGtTool { return 0.0D; } double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false); - if (realAmount <= 0.0D) - { + if (realAmount <= 0.0D) { realAmount = Info.itemEnergy.getEnergyValue(stack); if (realAmount <= 0.0D) { return 0.0D; @@ -55,43 +53,39 @@ public class SlotGtToolElectric extends SlotGtTool { return realAmount; } - public void setTier(final int tier1) - { + public void setTier(final int tier1) { this.tier = tier1; } public boolean allowRedstoneDust = true; - public ItemStack get() - { + public ItemStack get() { return this.get(0); } - public ItemStack get(final int index) - { + public ItemStack get(final int index) { return this.content; } - public void put(final ItemStack content) - { + public void put(final ItemStack content) { this.put(0, content); } - public void put(final int index, final ItemStack content) - { + public void put(final int index, final ItemStack content) { this.content = content; this.onChanged(); } - public void onChanged() {} + public void onChanged() { + } @Override public boolean isItemValid(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)){ - Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool."); + if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { + Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); + Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java index fbc3e36aef..bc74e65844 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java +++ b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java @@ -5,10 +5,8 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotItemBackpackInv extends Slot -{ - public SlotItemBackpackInv(final IInventory inv, final int index, final int xPos, final int yPos) - { +public class SlotItemBackpackInv extends Slot { + public SlotItemBackpackInv(final IInventory inv, final int index, final int xPos, final int yPos) { super(inv, index, xPos, yPos); } @@ -20,8 +18,7 @@ public class SlotItemBackpackInv extends Slot * Check if the stack is a valid item for this slot. */ @Override - public boolean isItemValid(final ItemStack itemstack) - { + public boolean isItemValid(final ItemStack itemstack) { // Everything returns true except an instance of our Item return !(itemstack.getItem() instanceof BaseItemBackpack); } diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java b/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java index 8a87552d0f..88735aaa55 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java +++ b/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java @@ -5,7 +5,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotModularBauble extends Slot{ +public class SlotModularBauble extends Slot { public SlotModularBauble(final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); @@ -16,8 +16,8 @@ public class SlotModularBauble extends Slot{ public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; - if (itemstack != null){ - if (itemstack.getItem() instanceof ModularBauble){ + if (itemstack != null) { + if (itemstack.getItem() instanceof ModularBauble) { isValid = true; } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java index 5b36bc48ff..4716701e16 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java +++ b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java @@ -14,7 +14,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotModularBaubleUpgrades extends Slot{ +public class SlotModularBaubleUpgrades extends Slot { public SlotModularBaubleUpgrades(final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); @@ -24,27 +24,27 @@ public class SlotModularBaubleUpgrades extends Slot{ @Override public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; - if (itemstack != null){ - Utils.LOG_INFO("trying to insert "+itemstack.getDisplayName()); - Utils.LOG_INFO("Valid Upgrade count: "+mValidUpgradeList.size()); - + if (itemstack != null) { + Utils.LOG_INFO("trying to insert " + itemstack.getDisplayName()); + Utils.LOG_INFO("Valid Upgrade count: " + mValidUpgradeList.size()); + Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); while (it.hasNext()) { Entry<ItemStack, BT> pair = it.next(); if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()){ + && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { isValid = true; } } - + Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); while (it2.hasNext()) { Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()){ + && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { isValid = true; } - } + } } return isValid; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java index db0630c4cd..1a1cf62e2b 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java @@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotNoInput extends Slot{ +public class SlotNoInput extends Slot { public SlotNoInput(final IInventory inventory, final int index, final int x, final int y) { super(inventory, index, x, y); diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java index 9219b50261..018df63a4c 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotOutput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotOutput.java @@ -8,88 +8,81 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -public class SlotOutput extends SlotCrafting{ +public class SlotOutput extends SlotCrafting { private final IInventory craftMatrix; private final EntityPlayer thePlayer; private int amountCrafted; - - public SlotOutput(final EntityPlayer player, final InventoryCrafting craftingInventory, final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) - { + public SlotOutput(final EntityPlayer player, final InventoryCrafting craftingInventory, + final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) { super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition); this.thePlayer = player; this.craftMatrix = craftingInventory; } + /** - * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + * Check if the stack is a valid item for this slot. Always true beside for + * the armor slots. */ @Override - public boolean isItemValid(final ItemStack par1ItemStack) - { + public boolean isItemValid(final ItemStack par1ItemStack) { return false; } + /** - * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new - * stack. + * Decrease the size of the stack in slot (first int arg) by the amount of + * the second int arg. Returns the new stack. */ @Override - public ItemStack decrStackSize(final int par1) - { - if (this.getHasStack()) - { + public ItemStack decrStackSize(final int par1) { + if (this.getHasStack()) { this.amountCrafted += Math.min(par1, this.getStack().stackSize); } return super.decrStackSize(par1); } + /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an - * internal count then calls onCrafting(item). + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. Typically increases an internal count then calls + * onCrafting(item). */ @Override - protected void onCrafting(final ItemStack par1ItemStack, final int par2) - { + protected void onCrafting(final ItemStack par1ItemStack, final int par2) { this.amountCrafted += par2; this.onCrafting(par1ItemStack); } + /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, + * not ore and wood. */ @Override - protected void onCrafting(final ItemStack stack) - { + protected void onCrafting(final ItemStack stack) { stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; } @Override - public void onPickupFromSlot(final EntityPlayer playerIn, final ItemStack stack) - { + public void onPickupFromSlot(final EntityPlayer playerIn, final ItemStack stack) { { FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix); this.onCrafting(stack); - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) - { + for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - if (itemstack1 != null) - { + if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); - if (itemstack1.getItem().hasContainerItem(itemstack1)) - { + if (itemstack1.getItem().hasContainerItem(itemstack1)) { ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - if (itemstack2.isItemStackDamageable() && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) - { + if (itemstack2.isItemStackDamageable() + && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) { MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); itemstack2 = null; } - if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) - { - if (this.craftMatrix.getStackInSlot(i) == null) - { + if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { + if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); - } - else - { + } else { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotRTG.java b/src/Java/gtPlusPlus/core/slots/SlotRTG.java index 398bae08a5..66d41a147c 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotRTG.java +++ b/src/Java/gtPlusPlus/core/slots/SlotRTG.java @@ -5,7 +5,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotRTG extends Slot{ +public class SlotRTG extends Slot { public SlotRTG(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index 6eb1942493..6dd948bcd1 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -11,13 +11,16 @@ import gtPlusPlus.core.util.Utils; public class ModTileEntities { - - public static void init(){ + public static void init() { Utils.LOG_INFO("Registering Tile Entities."); - //GameRegistry.registerTileEntity(TileEntityReverter.class, "TE_blockGriefSaver"); - //GameRegistry.registerTileEntity(TileEntityReverter.class, "Tower Reverter"); - //GameRegistry.registerTileEntity(TileEntityNHG.class, "NuclearFueledHeliumGenerator"); - //GameRegistry.registerTileEntity(TileEntityCharger.class, "TE_Charger"); + // GameRegistry.registerTileEntity(TileEntityReverter.class, + // "TE_blockGriefSaver"); + // GameRegistry.registerTileEntity(TileEntityReverter.class, "Tower + // Reverter"); + // GameRegistry.registerTileEntity(TileEntityNHG.class, + // "NuclearFueledHeliumGenerator"); + // GameRegistry.registerTileEntity(TileEntityCharger.class, + // "TE_Charger"); GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "HeliumGenerator"); GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); @@ -27,7 +30,7 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable"); GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable"); GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable"); - + } } |