diff options
| author | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-12 19:38:06 +0100 |
|---|---|---|
| committer | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-12 19:38:06 +0100 |
| commit | 311ab89f93558233a40079f7cb16605b141b5346 (patch) | |
| tree | c5f44ef47f441a57c5f57aa801f639c7879ed760 /src/main/java/gtPlusPlus/core/slots | |
| parent | 896143b96132f5ac54aa8d8f7386f27487e5e530 (diff) | |
| download | GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.gz GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.bz2 GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.zip | |
Move sources and resources
Diffstat (limited to 'src/main/java/gtPlusPlus/core/slots')
28 files changed, 1561 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java b/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java new file mode 100644 index 0000000000..92e9bebe21 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.slots; + +import gtPlusPlus.core.item.general.ItemAirFilter; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +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); + } + + @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 new file mode 100644 index 0000000000..532f2f0822 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -0,0 +1,31 @@ +package gtPlusPlus.core.slots; + +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; + } + + @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 new file mode 100644 index 0000000000..94b0b9ecc7 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -0,0 +1,77 @@ +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; + +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); + + } + + @Override + 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.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 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 new file mode 100644 index 0000000000..1029d37a78 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.slots; + +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; +import gregtech.api.util.GT_Recipe; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +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); + } + + @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 int getSlotStackLimit() { + return 64; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java b/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java new file mode 100644 index 0000000000..42b7b585e2 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotCrafting.java @@ -0,0 +1,151 @@ +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; +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 diff --git a/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java b/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java new file mode 100644 index 0000000000..3608c3724c --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java @@ -0,0 +1,147 @@ +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; +import net.minecraft.inventory.IInventory; +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 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 + public boolean canTakeStack(EntityPlayer player) { + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/slots/SlotDataStick.java b/src/main/java/gtPlusPlus/core/slots/SlotDataStick.java new file mode 100644 index 0000000000..ce97a2fdbf --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotDataStick.java @@ -0,0 +1,42 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.recipe.common.CI; + +public class SlotDataStick extends Slot { + + public SlotDataStick(final IInventory inventory, final int slot, final int x, final int y) { + super(inventory, slot, x, y); + + } + + public static ItemStack[] mDataItems = new ItemStack[2]; + + @Override + public synchronized boolean isItemValid(final ItemStack itemstack) { + boolean isValid = false; + if (itemstack != null) { + if (mDataItems[0] == null) { + mDataItems[0] = CI.getDataStick(); + } + if (mDataItems[1] == null) { + mDataItems[1] = CI.getDataOrb(); + } + if (mDataItems[0] != null && mDataItems[1] != null) { + if (GT_Utility.areStacksEqual(itemstack, mDataItems[0], true) || GT_Utility.areStacksEqual(itemstack, mDataItems[1], true) ) { + isValid = true; + } + } + } + return isValid; + } + + @Override + public int getSlotStackLimit() { + return 1; + } +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotElectric.java b/src/main/java/gtPlusPlus/core/slots/SlotElectric.java new file mode 100644 index 0000000000..a747432a74 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotElectric.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; + +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +public class SlotElectric extends Slot { + + public SlotElectric(final IInventory inventory, final int x, final int y, final int z) { + super(inventory, x, y, z); + } + + public SlotElectric(IGregTechTileEntity mTileEntity, int i, int j, int k) { + this(mTileEntity.getIInventory(mTileEntity.getXCoord(), mTileEntity.getYCoord(), mTileEntity.getZCoord()), i, j, k); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + if ((accepts(itemstack)) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { + return true; + } + return false; + } + + public boolean accepts(final ItemStack stack) { + if (stack == null) { + return false; + } + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) + || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotFrame.java b/src/main/java/gtPlusPlus/core/slots/SlotFrame.java new file mode 100644 index 0000000000..4168ded5bc --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotFrame.java @@ -0,0 +1,26 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import forestry.api.apiculture.IHiveFrame; + +public class SlotFrame extends Slot { + + public SlotFrame(final IInventory inventory, final int x, final int y, final int z) { + super(inventory, x, y, z); + + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + return itemstack.getItem() instanceof IHiveFrame; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java b/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java new file mode 100644 index 0000000000..b50b679665 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java @@ -0,0 +1,55 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import gregtech.api.enums.ItemList; + +import ic2.core.Ic2Items; + +public class SlotFuelRod extends Slot { + + public SlotFuelRod(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + boolean returnValue = false; + // Uranium Rods + if (itemstack.getItem() == Ic2Items.reactorUraniumSimple.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == Ic2Items.reactorUraniumDual.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == Ic2Items.reactorUraniumQuad.getItem()) { + returnValue = true; + } + + // Mox Rods + if (itemstack.getItem() == Ic2Items.reactorMOXSimple.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == Ic2Items.reactorMOXDual.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == Ic2Items.reactorMOXQuad.getItem()) { + returnValue = true; + } + + // Thorium Rods + if (itemstack.getItem() == ItemList.ThoriumCell_1.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == ItemList.ThoriumCell_2.getItem()) { + returnValue = true; + } else if (itemstack.getItem() == ItemList.ThoriumCell_4.getItem()) { + returnValue = true; + } + return returnValue; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotGeneric.java b/src/main/java/gtPlusPlus/core/slots/SlotGeneric.java new file mode 100644 index 0000000000..533539d914 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotGeneric.java @@ -0,0 +1,23 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotGeneric extends Slot { + + public SlotGeneric(final IInventory inventory, final int aSlotID, final int x, final int y) { + super(inventory, aSlotID, x, y); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + return true; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java b/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java new file mode 100644 index 0000000000..54e25362db --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java @@ -0,0 +1,33 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import gregtech.api.items.GT_MetaGenerated_Tool; + +import gtPlusPlus.api.objects.Logger; + +public class SlotGtTool extends Slot { + + public SlotGtTool(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 GT_MetaGenerated_Tool) { + Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); + return true; + } + Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); + return false; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/main/java/gtPlusPlus/core/slots/SlotGtToolElectric.java new file mode 100644 index 0000000000..c0e3340769 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/slots/SlotGtToolElectric.java @@ -0,0 +1,94 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +import gregtech.api.items.GT_MetaGenerated_Tool; + +import gtPlusPlus.api.objects.Logger; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; + +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) { + super(base, x, y, z); + this.tier = tier; + this.allowRedstoneDust = allowRedstoneDust; + } + + public boolean accepts(final ItemStack stack) { + if (stack == null) { + return false; + } + if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) { + return false; + } + return (Info.itemEnergy.getEnergyValue(st |
