diff options
| author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
| commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
| tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/core/slots | |
| parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
| download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip | |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/core/slots')
28 files changed, 1203 insertions, 1226 deletions
diff --git a/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java b/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java index 92e9bebe21..8ad0b000bc 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java @@ -7,24 +7,23 @@ import net.minecraft.item.ItemStack; public class SlotAirFilter extends Slot { - public SlotAirFilter(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } + public SlotAirFilter(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + } - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack == null) { - return false; - } - if (itemstack.getItem() instanceof ItemAirFilter){ - return true; - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } + @Override + public boolean isItemValid(final ItemStack itemstack) { + if (itemstack == null) { + return false; + } + if (itemstack.getItem() instanceof ItemAirFilter) { + return true; + } + return false; + } + @Override + public int getSlotStackLimit() { + return 1; + } } diff --git a/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java index 532f2f0822..56d39233e7 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -1,31 +1,29 @@ package gtPlusPlus.core.slots; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.interfaces.IItemBlueprint; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.interfaces.IItemBlueprint; - public class SlotBlueprint extends Slot { - public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof IItemBlueprint) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); - return false; - } + public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { + super(inventory, x, y, z); + } - @Override - public int getSlotStackLimit() { - return 1; - } + @Override + public boolean isItemValid(final ItemStack itemstack) { + if (itemstack.getItem() instanceof IItemBlueprint) { + Logger.WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); + return true; + } + Logger.WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); + return false; + } + @Override + public int getSlotStackLimit() { + return 1; + } } diff --git a/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java index 94b0b9ecc7..0caee5e6d0 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -1,77 +1,73 @@ package gtPlusPlus.core.slots; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.OrePrefixes; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.common.items.GT_MetaGenerated_Item_02; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; public class SlotBuzzSaw extends Slot { - public SAWTOOL currentTool = SAWTOOL.NONE; - - public SlotBuzzSaw(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - - } + public SAWTOOL currentTool = SAWTOOL.NONE; - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; + public SlotBuzzSaw(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + } - 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.110") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { - if (itemstack.getItemDamage() == 10) { - isValid = true; - this.currentTool = SAWTOOL.SAW; - } - else if (itemstack.getItemDamage() == 110) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 112) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 114) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 140) { - isValid = true; - this.currentTool = SAWTOOL.BUZZSAW; - } - return isValid; - } - } - } - } - this.currentTool = SAWTOOL.NONE; - return isValid; - } + @Override + public boolean isItemValid(final ItemStack itemstack) { + boolean isValid = false; - @Override - public int getSlotStackLimit() { - return 1; - } + 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.110") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { + if (itemstack.getItemDamage() == 10) { + isValid = true; + this.currentTool = SAWTOOL.SAW; + } else if (itemstack.getItemDamage() == 110) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } else if (itemstack.getItemDamage() == 112) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } else if (itemstack.getItemDamage() == 114) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } else if (itemstack.getItemDamage() == 140) { + isValid = true; + this.currentTool = SAWTOOL.BUZZSAW; + } + return isValid; + } + } + } + } + this.currentTool = SAWTOOL.NONE; + return isValid; + } - public enum SAWTOOL { - NONE, SAW, BUZZSAW, CHAINSAW - } + @Override + public int getSlotStackLimit() { + return 1; + } + public enum SAWTOOL { + NONE, + SAW, + BUZZSAW, + CHAINSAW + } } diff --git a/src/main/java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java b/src/main/java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java index 1029d37a78..4bfda45170 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java @@ -10,36 +10,35 @@ import net.minecraftforge.fluids.FluidStack; public class SlotChemicalPlantInput extends Slot { - public SlotChemicalPlantInput(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - } + public SlotChemicalPlantInput(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + } - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValidForChemicalPlantSlot(itemstack); - } - - public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { - boolean validItem = GTPP_Recipe_Map.sChemicalPlantRecipes.containsInput(aStack); - if (!validItem) { - for (GT_Recipe f : GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { - if (f.mFluidInputs.length > 0) { - for (FluidStack g : f.mFluidInputs) { - if (g != null) { - if (FluidContainerRegistry.containsFluid(aStack, g)) { - return true; - } - } - } - } - } - } - return validItem; - } + @Override + public boolean isItemValid(final ItemStack itemstack) { + return isItemValidForChemicalPlantSlot(itemstack); + } - @Override - public int getSlotStackLimit() { - return 64; - } + public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { + boolean validItem = GTPP_Recipe_Map.sChemicalPlantRecipes.containsInput(aStack); + if (!validItem) { + for (GT_Recipe f : GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { + if (f.mFluidInputs.length > 0) { + for (FluidStack g : f.mFluidInputs) { + if (g != null) { + if (FluidContainerRegistry.containsFluid(aStack, g)) { + return true; + } + } + } + } + } + } + return validItem; + } + @Override + public int getSlotStackLimit() { + return 64; + } } diff --git a/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java b/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java index 42b7b585e2..8d7c0946ec 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java @@ -1,7 +1,6 @@ package gtPlusPlus.core.slots; import cpw.mods.fml.common.FMLCommonHandler; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -9,143 +8,149 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.*; import net.minecraft.stats.AchievementList; - import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; 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. - */ - 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_) { - 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. - */ - @Override - 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. - */ - @Override - public ItemStack decrStackSize(final int p_75209_1_) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); - } - - return super.decrStackSize(p_75209_1_); - } - - /** - * 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_) { - 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. - */ - @Override - 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)) { - this.thePlayer.addStat(AchievementList.buildWorkBench, 1); - } - - if (p_75208_1_.getItem() instanceof ItemPickaxe) { - this.thePlayer.addStat(AchievementList.buildPickaxe, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) { - this.thePlayer.addStat(AchievementList.buildFurnace, 1); - } - - if (p_75208_1_.getItem() instanceof ItemHoe) { - this.thePlayer.addStat(AchievementList.buildHoe, 1); - } - - if (p_75208_1_.getItem() == Items.bread) { - this.thePlayer.addStat(AchievementList.makeBread, 1); - } - - 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)) { - this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); - } - - if (p_75208_1_.getItem() instanceof ItemSword) { - this.thePlayer.addStat(AchievementList.buildSword, 1); - } - - 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)) { - this.thePlayer.addStat(AchievementList.bookcase, 1); - } - } - - @Override - 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) { - final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - - if (itemstack1 != null) { - this.craftMatrix.decrStackSize(i, 1); - - if (itemstack1.getItem().hasContainerItem(itemstack1)) { - final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - - 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) { - this.craftMatrix.setInventorySlotContents(i, itemstack2); - } else { - this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); - } - } - } - } - } - } -}
\ No newline at end of file + /** 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. + */ + 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_) { + 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. + */ + @Override + 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. + */ + @Override + public ItemStack decrStackSize(final int p_75209_1_) { + if (this.getHasStack()) { + this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); + } + + return super.decrStackSize(p_75209_1_); + } + + /** + * 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_) { + 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. + */ + @Override + 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)) { + this.thePlayer.addStat(AchievementList.buildWorkBench, 1); + } + + if (p_75208_1_.getItem() instanceof ItemPickaxe) { + this.thePlayer.addStat(AchievementList.buildPickaxe, 1); + } + + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) { + this.thePlayer.addStat(AchievementList.buildFurnace, 1); + } + + if (p_75208_1_.getItem() instanceof ItemHoe) { + this.thePlayer.addStat(AchievementList.buildHoe, 1); + } + + if (p_75208_1_.getItem() == Items.bread) { + this.thePlayer.addStat(AchievementList.makeBread, 1); + } + + 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)) { + this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); + } + + if (p_75208_1_.getItem() instanceof ItemSword) { + this.thePlayer.addStat(AchievementList.buildSword, 1); + } + + 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)) { + this.thePlayer.addStat(AchievementList.bookcase, 1); + } + } + + @Override + 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) { + final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); + + if (itemstack1 != null) { + this.craftMatrix.decrStackSize(i, 1); + + if (itemstack1.getItem().hasContainerItem(itemstack1)) { + final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); + + 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) { + this.craftMatrix.setInventorySlotContents(i, itemstack2); + } else { + this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); + } + } + } + } + } + } +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java b/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java index 3608c3724c..cf96dd69e2 100644 --- a/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java +++ b/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java @@ -1,7 +1,6 @@ package gtPlusPlus.core.slots; import cpw.mods.fml.common.FMLCommonHandler; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -10,138 +9,138 @@ import net.minecraft.item.*; import net.minecraft.stats.AchievementList; 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. - */ - private int amountCrafted; - - 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. - */ - @Override - 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. - */ - @Override - public ItemStack decrStackSize(int amount) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(amount, this.getStack().stackSize); - } - - return super.decrStackSize(amount); - } - - /** - * 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(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. - */ - @Override - 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)) { - this.thePlayer.addStat(AchievementList.buildWorkBench, 1); - } - - if (output.getItem() instanceof ItemPickaxe) { - this.thePlayer.addStat(AchievementList.buildPickaxe, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.furnace)) { - this.thePlayer.addStat(AchievementList.buildFurnace, 1); - } - - if (output.getItem() instanceof ItemHoe) { - this.thePlayer.addStat(AchievementList.buildHoe, 1); - } - - if (output.getItem() == Items.bread) { - this.thePlayer.addStat(AchievementList.makeBread, 1); - } - - 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) { - this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); - } - - if (output.getItem() instanceof ItemSword) { - this.thePlayer.addStat(AchievementList.buildSword, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) { - this.thePlayer.addStat(AchievementList.enchantments, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) { - this.thePlayer.addStat(AchievementList.bookcase, 1); - } - } - - @Override - 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 PlayerDe |
