diff options
Diffstat (limited to 'src/main/java')
20 files changed, 1905 insertions, 0 deletions
diff --git a/src/main/java/fuelcell/GTMTE_SOFuelCellMK1.java b/src/main/java/fuelcell/GTMTE_SOFuelCellMK1.java new file mode 100644 index 0000000000..91acd82893 --- /dev/null +++ b/src/main/java/fuelcell/GTMTE_SOFuelCellMK1.java @@ -0,0 +1,172 @@ +package fuelcell; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import reactor.GUIContainer_ModularNuclearReactor; + +public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_MultiBlockBase { + + final Block CASING = GregTech_API.sBlockCasings4; + final int CASING_META = 1; + final int CASING_TEXTURE_ID = 49; + + public GTMTE_SOFuelCellMK1(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + + } + + public GTMTE_SOFuelCellMK1(String aName) { + super(aName); + + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { + return new GTMTE_SOFuelCellMK1(super.mName); + } + + @Override + public String[] getDescription() { + return new String[] { + "Solid-oxide Fuel Cell MkI", + "------------------------------------------", + "Oxidizes gas fuels to generate electricity without polluting the environment", + "29,480EU worth of fuel are consumed each second", + "Outputs 1024EU/t and 18,000L/t Steam", + "Additionally requires 360L/s Oxygen gas", + "------------------------------------------", + "Dimensions: 3x3x5 (WxHxL)", + "Structure:", + " 3x Solid YSZ Ceramic Electrolyte Unit (center 1x1x3)", + " 12x Clean Stainless Steel Machine Casing (at least)", + " Controller front center", + " Dynamo Hatch back center", + " Maintenance Hatch, Input Hatches, Output Hatches" + }; + } + + //TODO + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return aSide == aFacing + ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID], + new GT_RenderedTexture(aActive ? + Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE + : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)} + : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]}; + } + + //TODO + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUIContainer_ModularNuclearReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), + "MultiblockDisplay.png"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack stack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack stack) { + return false; + } + + //TODO + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + + final byte SIDE_LENGTH_W = 3; + final byte SIDE_LENGTH_L = 5; + final byte MAX_OFFSET = (byte) Math.floor(SIDE_LENGTH_W / 2); + final int XDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX * MAX_OFFSET; + final int ZDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ * MAX_OFFSET; + + int minCasingAmount = 12; + boolean checklist = true; // if this is still true at the end, machine is good to go :) + + for (int leftToRight = -MAX_OFFSET; leftToRight <= MAX_OFFSET; leftToRight++) { + + for (int frontToBack = -MAX_OFFSET; frontToBack <= MAX_OFFSET; frontToBack++) { + + for (int thisY = -MAX_OFFSET; thisY <= MAX_OFFSET; thisY++) { + + // Center 3x3x3 air cube + if((leftToRight > -2 && leftToRight < 2) && (frontToBack > -2 && frontToBack < 2) && (thisY > -2 && thisY < 2)) { + if(!thisController.getAirOffset(XDIR_BACKFACE + leftToRight, thisY, ZDIR_BACKFACE + frontToBack)) { + checklist = false; + } + } else if (!(XDIR_BACKFACE + leftToRight == 0 && ZDIR_BACKFACE + frontToBack == 0 && thisY == 0)) { // Make sure this isn't the controller + // Get next TE + final int THIS_X = XDIR_BACKFACE + leftToRight; + final int THIS_Z = ZDIR_BACKFACE + frontToBack; + IGregTechTileEntity currentTE = + thisController.getIGregTechTileEntityOffset(THIS_X, thisY, THIS_Z);// x, y ,z + + // Tries to add TE as either of those kinds of hatches. + // The number is the texture index number for the texture that needs to be painted over the hatch texture (TAE for GT++) + if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addDynamoToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + if ((thisController.getBlockOffset(THIS_X, thisY, THIS_Z) == CASING) && (thisController.getMetaIDOffset(THIS_X, thisY, THIS_Z) == CASING_META)) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + checklist = false; + } + } + } + } + } + } + + if(minCasingAmount > 0) { + checklist = false; + } + + if(this.mDynamoHatches.size() < 1) { + System.out.println("At least one dynamo hatch is required!"); + checklist = false; + } + if(this.mInputHatches.size() < 2) { + System.out.println("At least two input hatches are required!"); + checklist = false; + } + + return checklist; + } + + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } + +} diff --git a/src/main/java/fuelcell/GTMTE_SOFuelCellMK2.java b/src/main/java/fuelcell/GTMTE_SOFuelCellMK2.java new file mode 100644 index 0000000000..dbe16c3795 --- /dev/null +++ b/src/main/java/fuelcell/GTMTE_SOFuelCellMK2.java @@ -0,0 +1,172 @@ +package fuelcell; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import reactor.GUIContainer_ModularNuclearReactor; + +public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_MultiBlockBase { + + final Block CASING = GregTech_API.sBlockCasings4; + final int CASING_META = 0; + final int CASING_TEXTURE_ID = 48; + + public GTMTE_SOFuelCellMK2(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + + } + + public GTMTE_SOFuelCellMK2(String aName) { + super(aName); + + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { + return new GTMTE_SOFuelCellMK2(super.mName); + } + + @Override + public String[] getDescription() { + return new String[] { + "Solid-oxide Fuel Cell Mk2", + "------------------------------------------", + "Oxidizes gas fuels to generate electricity without polluting the environment", + "375,680EU worth of fuel are consumed each second", + "Outputs 16,384EU/t and 96,000L/t Steam", + "Additionally requires 1920L/s Oxygen gas", + "------------------------------------------", + "Dimensions: 3x3x5 (WxHxL)", + "Structure:", + " 3x Solid GDC Ceramic Electrolyte Unit (center 1x1x3)", + " 12x Robust Tungstensteel Machine Casing (at least)", + " Controller front center", + " Dynamo Hatch back center", + " Maintenance Hatch, Input Hatches, Output Hatches" + }; + } + + //TODO + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return aSide == aFacing + ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID], + new GT_RenderedTexture(aActive ? + Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE + : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)} + : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]}; + } + + //TODO + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUIContainer_ModularNuclearReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), + "MultiblockDisplay.png"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack stack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack stack) { + return false; + } + + //TODO + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + + final byte SIDE_LENGTH_W = 3; + final byte SIDE_LENGTH_L = 5; + final byte MAX_OFFSET = (byte) Math.floor(SIDE_LENGTH_W / 2); + final int XDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX * MAX_OFFSET; + final int ZDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ * MAX_OFFSET; + + int minCasingAmount = 12; + boolean checklist = true; // if this is still true at the end, machine is good to go :) + + for (int leftToRight = -MAX_OFFSET; leftToRight <= MAX_OFFSET; leftToRight++) { + + for (int frontToBack = -MAX_OFFSET; frontToBack <= MAX_OFFSET; frontToBack++) { + + for (int thisY = -MAX_OFFSET; thisY <= MAX_OFFSET; thisY++) { + + // Center 3x3x3 air cube + if((leftToRight > -2 && leftToRight < 2) && (frontToBack > -2 && frontToBack < 2) && (thisY > -2 && thisY < 2)) { + if(!thisController.getAirOffset(XDIR_BACKFACE + leftToRight, thisY, ZDIR_BACKFACE + frontToBack)) { + checklist = false; + } + } else if (!(XDIR_BACKFACE + leftToRight == 0 && ZDIR_BACKFACE + frontToBack == 0 && thisY == 0)) { // Make sure this isn't the controller + // Get next TE + final int THIS_X = XDIR_BACKFACE + leftToRight; + final int THIS_Z = ZDIR_BACKFACE + frontToBack; + IGregTechTileEntity currentTE = + thisController.getIGregTechTileEntityOffset(THIS_X, thisY, THIS_Z);// x, y ,z + + // Tries to add TE as either of those kinds of hatches. + // The number is the texture index number for the texture that needs to be painted over the hatch texture (TAE for GT++) + if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addDynamoToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + if ((thisController.getBlockOffset(THIS_X, thisY, THIS_Z) == CASING) && (thisController.getMetaIDOffset(THIS_X, thisY, THIS_Z) == CASING_META)) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + checklist = false; + } + } + } + } + } + } + + if(minCasingAmount > 0) { + checklist = false; + } + + if(this.mDynamoHatches.size() < 1) { + System.out.println("At least one dynamo hatch is required!"); + checklist = false; + } + if(this.mInputHatches.size() < 2) { + System.out.println("At least two input hatches are required!"); + checklist = false; + } + + return checklist; + } + + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } + +} diff --git a/src/main/java/kekztech/ErrorItem.java b/src/main/java/kekztech/ErrorItem.java new file mode 100644 index 0000000000..7047d3f057 --- /dev/null +++ b/src/main/java/kekztech/ErrorItem.java @@ -0,0 +1,41 @@ +package kekztech; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ErrorItem extends Item { + + private static final ErrorItem instance = new ErrorItem(); + + private ErrorItem() { + // I am a singleton + } + + public static ErrorItem getInstance() { + return instance; + } + + public void registerItem() { + super.setHasSubtypes(false); + final String unlocalizedName = "kekztech_error_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(64); + super.setTextureName(KekzCore.MODID + ":" + "Error"); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("Placeholder item in case something went wrong"); + list.add("You may report this to:"); + list.add("https://github.com/kekzdealer/KekzTech"); + } + +} diff --git a/src/main/java/kekztech/GTMultiController.java b/src/main/java/kekztech/GTMultiController.java new file mode 100644 index 0000000000..e27c2c39bd --- /dev/null +++ b/src/main/java/kekztech/GTMultiController.java @@ -0,0 +1,300 @@ +package kekztech; + +import java.util.ArrayList; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GTMultiController { + + private final GTRecipe GT_RECIPE = new GTRecipe(); + + private boolean running = false; + private boolean structureValid = false; + + public final ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); + public final ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); + + protected GTRecipe getGT_RECIPE() { + return GT_RECIPE; + } + + protected abstract boolean checkStructure(); + protected abstract String[] getDescription(); + + protected long getMaxInputVoltage() { + long voltage = 0L; + for(GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) { + voltage += energyHatch.getBaseMetaTileEntity().getInputVoltage(); + } + return voltage; + } + + private void updateDynamoHatches() { + if(GT_RECIPE.getEuPerTick() > 0) { + long remOutput = GT_RECIPE.getEuPerTick(); + for(GT_MetaTileEntity_Hatch_Dynamo dynamoHatch : mDynamoHatches) { + final long deltaCapacity = dynamoHatch.getBaseMetaTileEntity().getEUCapacity() + - dynamoHatch.getBaseMetaTileEntity().getStoredEU(); + final long toOutput = Math.min(deltaCapacity, GT_RECIPE.getEuPerTick()); + dynamoHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(toOutput, false); + remOutput -= toOutput; + } + } + } + + private void updateEnergyHatches() { + if(GT_RECIPE.getEuPerTick() < 0) { + long remConsumption = GT_RECIPE.getEuPerTick(); + for(GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) { + if(remConsumption > 0) { + final long toConsume = Math.min(remConsumption, energyHatch.getBaseMetaTileEntity().getStoredEU()); + energyHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(toConsume, false); + remConsumption -= toConsume; + } + } + } + } + + private void updateInputBusses() { + if(GT_RECIPE.getInputItems() != null) { + // Check for each input stack... + for(ItemStack inputStack : GT_RECIPE.getInputItems()) { + int remainingRequired = inputStack.stackSize; + // ...Each slot in each input bus... + for(GT_MetaTileEntity_Hatch_InputBus inputBus : mInputBusses) { + for(int slot = 0; slot <= inputBus.getBaseMetaTileEntity().getSizeInventory(); slot++) { + + final ItemStack slotStack = inputBus.getBaseMetaTileEntity().getStackInSlot(slot); + if(GT_Utility.isStackValid(slotStack)) { + if(GT_Utility.areStacksEqual(inputStack, slotStack)) { + // Found correct slot + final int toConsume = Math.min(slotStack.stackSize, inputStack.stackSize); + final ItemStack retrievedStack = inputBus.getBaseMetaTileEntity().decrStackSize(slot, toConsume); + } + } + } + } + } + } + } + + private void updateInputHatches() { + if(GT_RECIPE.getInputFluids() != null) { + // Check for each input stack + for(FluidStack inputStack : GT_RECIPE.getInputFluids()) { + int remainingRequired = inputStack.amount; + // ...In each input hatch... + for(GT_MetaTileEntity_Hatch_Input inputHatch : mInputHatches) { + + FluidStack slotStack = inputHatch.getFluid(); + if(slotStack.amount > 0 && slotStack.isFluidEqual(inputStack)) { + // Found correct hatch + final int toConsume = Math.min(slotStack.amount, remainingRequired); + inputHatch.drain(toConsume, true); + remainingRequired -= toConsume; + } + } + } + } + } + + private void updateOutputBusses() { + if(GT_RECIPE.getOutputItems() != null) { + + } + } + + private void updateOutputHatches() { + if(GT_RECIPE.getOutputFluids() != null) { + // Find for each output stack... + for(FluidStack outputStack : GT_RECIPE.getOutputFluids()) { + // ...an output hatch that can accept the stack + for(GT_MetaTileEntity_Hatch_Output outputHatch : mOutputHatches) { + + } + } + } + } + + protected boolean tryAddHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + final IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + } + + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } else { + return aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler + ? this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity) + : false; + } + } + } + } + + protected boolean tryAddMaintenanceHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddEnergyHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddDynamoHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddMufflerHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddInputBus(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddInputHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddOutputBus(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } else { + return false; + } + } + } + + protected boolean tryAddOutputHatch(IGregTechTileEntity hatch, int aBaseCasingIndex) { + if (hatch == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = hatch.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } else { + return false; + } + } + } +} diff --git a/src/main/java/kekztech/GTRecipe.java b/src/main/java/kekztech/GTRecipe.java new file mode 100644 index 0000000000..4b287499f5 --- /dev/null +++ b/src/main/java/kekztech/GTRecipe.java @@ -0,0 +1,103 @@ +package kekztech; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class GTRecipe { + + private int euPerTick = 0; + private int duration = 0; + + private ArrayList<ItemStack> inputItems; + private ArrayList<FluidStack> inputFluids; + private ArrayList<ItemStack> outputItems; + private ArrayList<FluidStack> outputFluids; + + public int getEuPerTick() { + return euPerTick; + } + public int getDuration() { + return duration; + } + public ItemStack[] getInputItems() { + return Util.toItemStackArray(inputItems); + } + public FluidStack[] getInputFluids() { + return Util.toFluidStackArray(inputFluids); + } + public ItemStack[] getOutputItems() { + return Util.toItemStackArray(outputItems); + } + public FluidStack[] getOutputFluids() { + return Util.toFluidStackArray(outputFluids); + } + public ItemStack getInputItem() { + final ItemStack[] s = Util.toItemStackArray(inputItems); + return s[0]; + } + public FluidStack getInputFluid() { + final FluidStack[] s = Util.toFluidStackArray(inputFluids); + return s[0]; + } + public ItemStack getOutputItem() { + final ItemStack[] s = Util.toItemStackArray(outputItems); + return s[0]; + } + public FluidStack getOutputFluid() { + final FluidStack[] s = Util.toFluidStackArray(outputFluids); + return s[0]; + } + + public GTRecipe addInputItem(ItemStack inputItem) { + if(inputItems == null) { + inputItems = new ArrayList<ItemStack>(); + inputItems.add(inputItem); + } else { + inputItems.add(inputItem); + } + return this; + } + + public GTRecipe addOutputItem(ItemStack outputItem) { + if(outputItems == null) { + outputItems = new ArrayList<ItemStack>(); + outputItems.add(outputItem); + } else { + outputItems.add(outputItem); + } + return this; + } + + public GTRecipe addInputFluid(FluidStack inputFluid) { + if(inputFluids == null) { + inputFluids = new ArrayList<FluidStack>(); + inputFluids.add(inputFluid); + } else { + inputFluids.add(inputFluid); + } + return this; + } + + public GTRecipe addOutputFluid(FluidStack outputFluid) { + if(outputFluids == null) { + outputFluids = new ArrayList<FluidStack>(); + outputFluids.add(outputFluid); + } else { + outputFluids.add(outputFluid); + } + return this; + } + + public GTRecipe setEUPerTick(int euPerTick) { + this.euPerTick = euPerTick; + return this; + } + + public GTRecipe setDuration(int duration) { + this.duration = duration; + return this; + } + +} diff --git a/src/main/java/kekztech/Items.java b/src/main/java/kekztech/Items.java new file mode 100644 index 0000000000..f7ce2e883a --- /dev/null +++ b/src/main/java/kekztech/Items.java @@ -0,0 +1,43 @@ +package kekztech; + +public enum Items { + // Heat Vents + T1HeatVent(0), T2HeatVent(1), T3HeatVent(2), T4HeatVent(3), + T1ComponentHeatVent(4), T2ComponentHeatVent(5), T3ComponentHeatVent(6), T4ComponentHeatVent(7), + T1OverclockedHeatVent(8), T2OverclockedHeatVent(9), T3OverclockedHeatVent(10), T4OverclockedHeatVent(11), + // Heat Exchanger + T1HeatExchanger(12), T2HeatExchanger(13), T3HeatExchanger(14), T4HeatExchanger(15), + // Fuel Rods + UraniumFuelRod(16), UraniumDualFuelRod(17), UraniumQuadFuelRod(18), + ThoriumFuelRod(19), ThoriumDualFuelRod(20), ThoriumQuadFuelRod(21), + MOXFuelRod(22), MOXDualFuelRod(23), MOXQuadFuelRod(24), + NaquadahFuelRod(25), NaquadahDualFuelRod(26), NaquadahQuadFuelRod(27), + Th_MOXFuelRod(28), Th_MOXDualFuelRod(29), Th_MOXQuadFuelRod(30), + // Depleted Fuel Rods + DepletedUraniumFuelRod(31), DepletedUraniumDualFuelRod(32), DepletedUraniumQuadFuelRod(33), + DepletedThoriumFuelRod(34), DepletedThoriumDualFuelRod(35), DepletedThoriumQuadFuelRod(36), + DepletedMOXFuelRod(37), DepletedMOXDualFuelRod(38), DepletedMOXQuadFuelRod(39), + DepletedNaquadahFuelRod(40), DepletedNaquadahDualFuelRod(41), DepletedNaquadahQuadFuelRod(42), + Th_DepletedMOXFuelRod(43), Th_DepletedMOXDualFuelRod(44), Th_DepletedMOXQuadFuelRod(45), + // Neutron Reflectors + T1NeutronReflector(46), T2NeutronReflector(47), + // Coolant Cells + HeliumCoolantCell360k(48), NaKCoolantCell360k(49), + // Heat Pipes + CopperHeatPipe(0), SilverHeatPipe(1), BoronArsenideHeatPipe(2), DiamondHeatPipe(3), + BoronArsenideDust(4), IsotopicallyPureDiamondDust(5), AmineCarbamiteDust(6), + BoronArsenideCrystal(7), IsotopicallyPureDiamondCrystal(8), + // Error Item + Error(9); + + private final int metaID; + + private Items(int metaID) { + this.metaID = metaID; + } + + public int getMetaID() { + return metaID; + } + +} diff --git a/src/main/java/kekztech/KekzCore.java b/src/main/java/kekztech/KekzCore.java new file mode 100644 index 0000000000..8d191a5901 --- /dev/null +++ b/src/main/java/kekztech/KekzCore.java @@ -0,0 +1,93 @@ +package kekztech; + +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.event.FMLInitializationEve |
