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.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import reactor.items.CoolantCell; +import reactor.items.FuelRod; +import reactor.items.HeatExchanger; +import reactor.items.HeatPipe; +import reactor.items.HeatVent; +import reactor.items.NeutronReflector; + +@Mod(modid = KekzCore.MODID, name = KekzCore.NAME, version = KekzCore.VERSION, + dependencies = "required-after:IC2; " + + "required-after:gregtech" + ) +public class KekzCore { + + public static final String NAME = "KekzTech"; + public static final String MODID = "kekztech"; + public static final String VERSION = "0.1a"; + + @Mod.Instance("kekztech") + public static KekzCore instance; + + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) { + ErrorItem.getInstance().registerItem(); + MetaItem_ReactorComponent.getInstance().registerItem(); + MetaItem_CraftingComponent.getInstance().registerItem(); + } + + @Mod.EventHandler + public void init(FMLInitializationEvent event ) { + + } + + @Mod.EventHandler + public void postInit(FMLPostInitializationEvent event) { + for(GTRecipe recipe : HeatPipe.RECIPE) { + GT_Values.RA.addLatheRecipe(recipe.getInputItem(), recipe.getOutputItem(), null, recipe.getDuration(), recipe.getEuPerTick()); + } + + for(GTRecipe recipe : HeatExchanger.RECIPE) { + GT_Values.RA.addAssemblerRecipe( + recipe.getInputItems(), recipe.getInputFluid(), recipe.getOutputItem(), recipe.getDuration(), recipe.getEuPerTick()); + } + + // Heat Vents + final ItemStack[] t1HeatVent = { + MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.CopperHeatPipe.getMetaID(), 2), + ItemList.Electric_Motor_MV.get(1L, (Object[]) null), + Util.getStackofAmountFromOreDict("rotorSteel", 1), + Util.getStackofAmountFromOreDict("plateDoubleSteel", 2), + Util.getStackofAmountFromOreDict("screwSteel", 8), + Util.getStackofAmountFromOreDict("circuitGood", 1) + }; + GT_Values.RA.addAssemblerRecipe(t1HeatVent, + FluidRegistry.getFluidStack("molten.copper", 144), + MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1HeatVent.getMetaID()), + 200, 120 + ); + + } + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/kekztech/MetaItem_CraftingComponent.java b/src/main/java/kekztech/MetaItem_CraftingComponent.java new file mode 100644 index 0000000000..89a015998f --- /dev/null +++ b/src/main/java/kekztech/MetaItem_CraftingComponent.java @@ -0,0 +1,103 @@ +package kekztech; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import reactor.items.HeatPipe; + +public class MetaItem_CraftingComponent extends Item { + + private static MetaItem_CraftingComponent instance = new MetaItem_CraftingComponent(); + private final IIcon[] icons = new IIcon[16]; + + private MetaItem_CraftingComponent() { + // I am a singleton + } + + public static MetaItem_CraftingComponent getInstance() { + return instance; + } + + public void registerItem() { + super.setHasSubtypes(true); + final String unlocalizedName = "kekztech_crafting_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(64); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + int counter = 0; + // Raw heat pipes + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + HeatPipe.RESOURCE_NAMES[0]); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + HeatPipe.RESOURCE_NAMES[1]); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + HeatPipe.RESOURCE_NAMES[2]); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + HeatPipe.RESOURCE_NAMES[3]); + // Dust + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "AmineCarbamateDust"); + // Crystal + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideCrystal"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondCrystal"); + // Ceramics + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YttriaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "ZirconiaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "CeriaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicPlate"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicPlate"); + } + + @Override + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < icons.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("Crafting component for KekzTech things"); + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return 0.0d; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + public ItemStack getStackFromDamage(int meta) { + return new ItemStack(getInstance(), 1, meta); + } + + public ItemStack getStackOfAmountFromDamage(int meta, int amount) { + return new ItemStack(getInstance(), amount, meta); + } + +} diff --git a/src/main/java/kekztech/MetaItem_ReactorComponent.java b/src/main/java/kekztech/MetaItem_ReactorComponent.java new file mode 100644 index 0000000000..16f3f1403f --- /dev/null +++ b/src/main/java/kekztech/MetaItem_ReactorComponent.java @@ -0,0 +1,139 @@ +package kekztech; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import reactor.items.CoolantCell; +import reactor.items.FuelRod; +import reactor.items.HeatExchanger; +import reactor.items.HeatVent; +import reactor.items.NeutronReflector; + +public class MetaItem_ReactorComponent extends Item { + + private static MetaItem_ReactorComponent instance = new MetaItem_ReactorComponent(); + private final IIcon[] icons = new IIcon[50]; + + private MetaItem_ReactorComponent() { + // I am a singleton + } + + public static MetaItem_ReactorComponent getInstance() { + return instance; + } + + public void registerItem() { + super.setHasSubtypes(true); + final String unlocalizedName = "kekztech_reactor_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(1); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + int counter = 0; + for(String s : HeatVent.RESOURCE_NAMES) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for(String s : HeatExchanger.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for(String s : FuelRod.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for(String s : FuelRod.RESOURCE_NAME_DEPLETED) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for(String s : NeutronReflector.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for(String s : CoolantCell.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < icons.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("Part for the Modular Nuclear Reactor"); + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + NBTTagCompound nbt = (stack.getTagCompound() == null) ? new NBTTagCompound() : stack.getTagCompound(); + if(nbt.getInteger("HEALTH") != 0 && nbt.getInteger("MAXHEALTH") != 0) { + return 1 - (double) (nbt.getInteger("HEALTH") / nbt.getInteger("MAXHEALTH")); + } else { + return 0.0d; + } + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + final int meta = stack.getItemDamage(); + if(meta >= 31 && meta <= 45) { + return false; + } else { + return true; + } + } + + public ItemStack getStackFromDamage(int meta) { + return new ItemStack(getInstance(), 1, meta); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/kekztech/Util.java b/src/main/java/kekztech/Util.java new file mode 100644 index 0000000000..c1243cadd8 --- /dev/null +++ b/src/main/java/kekztech/Util.java @@ -0,0 +1,50 @@ +package kekztech; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +public class Util { + + public static ItemStack getStackofAmountFromOreDict(String oredictName, final int amount){ + final ArrayList<ItemStack> list = OreDictionary.getOres(oredictName); + if(!list.isEmpty()) { + final ItemStack ret = list.get(0).copy(); + ret.stackSize = amount; + return ret; + } + System.err.println("Failed to find " + oredictName + " in OreDict"); + return new ItemStack(ErrorItem.getInstance(), amount); + } + + public static ItemStack[] toItemStackArray(List<ItemStack> stacksList) { + if(stacksList.size() == 0) { + return null; + } + + ItemStack[] ret = new ItemStack[stacksList.size()]; + Iterator<ItemStack> iterator = stacksList.iterator(); + for(int i = 0; i < ret.length; i++ ) { + ret[i] = iterator.next(); + } + return ret; + } + + public static FluidStack[] toFluidStackArray(List<FluidStack> stacksList) { + if(stacksList.size() == 0) { + return null; + } + + FluidStack[] ret = new FluidStack[stacksList.size()]; + Iterator<FluidStack> iterator = stacksList.iterator(); + for(int i = 0; i < ret.length; i++ ) { + ret[i] = iterator.next(); + } + return ret; + } + +} diff --git a/src/main/java/reactor/ButtonSlot.java b/src/main/java/reactor/ButtonSlot.java new file mode 100644 index 0000000000..6d777ca280 --- /dev/null +++ b/src/main/java/reactor/ButtonSlot.java @@ -0,0 +1,14 @@ +package reactor; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +public class ButtonSlot extends Slot { + + public ButtonSlot(IInventory playerIventory, int slotID, int posX, int posY) { + super(playerIventory, slotID, posX, posY); + + + } + +} diff --git a/src/main/java/reactor/Container_ModularNuclearReactor.java b/src/main/java/reactor/Container_ModularNuclearReactor.java new file mode 100644 index 0000000000..4ecfe61836 --- /dev/null +++ b/src/main/java/reactor/Container_ModularNuclearReactor.java @@ -0,0 +1,68 @@ +package reactor; + +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +public class Container_ModularNuclearReactor extends GT_Container_MultiMachine { + + private final GTMTE_ModularNuclearReactor REACTOR_TILE; + private final IInventory PLAYER_INVENTORY; + + private int nextSlotID = 0; + private final Slot[] REACTOR_SLOTS = new Slot[54]; + private final Slot SLOT_CONFIGURATION; + private final Slot BUTTON_EU_MODE; + private final Slot BUTTON_FLUID_MODE; + private final Slot BUTTON_CONDITION; + private final Slot BUTTON_CONFIGURE; + private final Slot BUTTON_RESET; + + + public Container_ModularNuclearReactor(InventoryPlayer inventoryPlayer, IGregTechTileEntity reactorTile) { + + super(inventoryPlayer, reactorTile); + + this.REACTOR_TILE = (GTMTE_ModularNuclearReactor) reactorTile; + this.PLAYER_INVENTORY = inventoryPlayer; + + // Add the reactor chamber + for(int x = 0; x < 9; x++) { + for(int y = 0; y < 6; y++){ + REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(PLAYER_INVENTORY, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); + } + } + // Add the configuration slot + SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + + // Add buttons (they're also slots) + BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(PLAYER_INVENTORY, getNextSlotID(), 0, 0)); + + } + + private int getNextSlotID() { + nextSlotID++; + return nextSlotID - 1; + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (REACTOR_TILE.getBaseMetaTileEntity().isServerSide() == false) { + return; + } + } + +} diff --git a/src/main/java/reactor/GTMTE_ModularNuclearReactor.java b/src/main/java/reactor/GTMTE_ModularNuclearReactor.java new file mode 100644 index 0000000000..f3d9a2a00c --- /dev/null +++ b/src/main/java/reactor/GTMTE_ModularNuclearReactor.java @@ -0,0 +1,188 @@ +package reactor; + +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; + +public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase { + + final Block CASING = GregTech_API.sBlockCasings3; + final int CASING_META = 12; + final int CASING_TEXTURE_ID = 44; + + private boolean euMode = true; + + public GTMTE_ModularNuclearReactor(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + + } + + public GTMTE_ModularNuclearReactor(String aName) { + super(aName); + + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { + return new GTMTE_ModularNuclearReactor(super.mName); + } + + @Override + public String[] getDescription() { + return new String[] { + "Modular Nuclear Reactor", + "------------------------------------------", + "EU-MODE - Turn nuclear fuel into directly into electricity.", + "", + "COOLANT-MODE - Heat up coolant for other applications", + "HU to Hot Coolant ratio is 1HU = 1L Hot Coolant", + "------------------------------------------", + "Dimensions: 5x5x5 (WxHxL)", + "Structure:", + " 80x Radiation Proof Machine Casing (at least)", + " Controller front center", + " Dynamo Hatch (ONLY in EU-mode, at least one)", + " Input Bus, Output Bus (optional)", + " Input Hatch, Output Hatch (ONLY in Coolant-Mode, at least one each)" + }; + } + + @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]}; + } + + 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; + } + + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + + final byte SIDE_LENGTH = 5; + final byte MAX_OFFSET = (byte) Math.floor(SIDE_LENGTH / 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 = 92; + 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(euMode) { + if(this.mDynamoHatches.size() == 0) { + System.out.println("Dynamo hatches are required in EU mode!"); + checklist = false; + } + if(this.mInputHatches.size() > 0) { + System.out.println("Input hatches are only allowed in coolant mode!"); + checklist = false; + } + if(this.mOutputHatches.size() > 0) { + System.out.println("Output hatches are only allowed in coolant mode!"); + checklist = false; + } + } else { + if(this.mDynamoHatches.size() > 0) { + System.out.println("Dynamo hatches are only allowed in EU mode!"); + checklist = false; + } + if(this.mInputHatches.size() == 0) { + System.out.println("Coolant input hatches are required in coolant mode!"); + checklist = false; + } + if(this.mOutputHatches.size() == 0) { + System.out.println("Hot coolant output hatches are required in coolant mode!"); + 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/reactor/GUIContainer_ModularNuclearReactor.java b/src/main/java/reactor/GUIContainer_ModularNuclearReactor.java new file mode 100644 index 0000000000..1f8248e5bb --- /dev/null +++ b/src/main/java/reactor/GUIContainer_ModularNuclearReactor.java @@ -0,0 +1,53 @@ +package reactor; + +import org.lwjgl.opengl.GL11; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUIContainer_ModularNuclearReactor extends GT_GUIContainerMetaTile_Machine { + + private final String resourceName; + private final ResourceLocation texture; + + public GUIContainer_ModularNuclearReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, + String aName, String aTextureFile) { + + super(new Container_ModularNuclearReactor(aInventoryPlayer, aTileEntity), aTextureFile); + + this.resourceName = aTextureFile; + this.texture = new ResourceLocation(KekzCore.MODID, "textures/gui/" + resourceName); + } + + @SuppressWarnings("unchecked") + @Override + public void initGui() { + super.initGui(); + + // The parameters of GuiButton are (id, x, y, width, height, text) + super.buttonList.add(new GuiButton(1, 100, 200, 100, 20, "Hello")); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize); + final int y = (super.height - super.ySize); + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + + } + +} diff --git a/src/main/java/reactor/items/CoolantCell.java b/src/main/java/reactor/items/CoolantCell.java new file mode 100644 index 0000000000..64b979acc4 --- /dev/null +++ b/src/main/java/reactor/items/CoolantCell.java @@ -0,0 +1,26 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_ReactorComponent; + +public class CoolantCell { + + public static String TYPE = "CoolantCell"; + + public static String[] RESOURCE_NAME = { + "HeliumCoolantCell360k", "NaKCoolantCell360k" + }; + + public static int[] HEAT_CAPACITY = { + 360000, 360000 + }; + + public static GTRecipe[] RECIPE = { + new GTRecipe().setDuration(1200).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.HeliumCoolantCell360k.getMetaID())), + new GTRecipe().setDuration(1200).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.NaKCoolantCell360k.getMetaID())) + }; + +} diff --git a/src/main/java/reactor/items/FuelRod.java b/src/main/java/reactor/items/FuelRod.java new file mode 100644 index 0000000000..adef6f3409 --- /dev/null +++ b/src/main/java/reactor/items/FuelRod.java @@ -0,0 +1,114 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_ReactorComponent; + +public class FuelRod { + + public static final int METAOFFSET = 17; + public static final int METAOFFSET_DEPLETED = 29; + + public static final String TYPE = "FuelRod"; + public static final String TYPE_DEPLETED = "DepletedFuelRod"; + public static final String LIFETIME = "LIFETIME"; + public static final String PULSES = "PULSES"; + public static final String HEAT_PER_SECOND = "HEAT_PER_SECOND"; + public static final String HEAT_PER_PULSE = "HEAT_PER_PULSE"; + public static final String HEAT_BOOST_RATE = "HEAT_BOOST_RATE"; + public static final String EU_PER_TICK = "EU_PER_TICK"; + public static final String EU_PER_PULSE = "EU_PER_PULSE"; + + + public static final String[] RESOURCE_NAME = { + "UraniumFuelRod", "UraniumDualFuelRod", "UraniumQuadFuelRod", + "ThoriumFuelRod", "ThoriumDualFuelRod", "ThoriumQuadFuelRod", + "MOXFuelRod", "MOXDualFuelRod", "MOXQuadFuelRod", + "NaquadahFuelRod", "NaquadahDualFuelRod", "NaquadahQuadFuelRod", + "Th_MOXFuelRod", "Th_MOXDualFuelRod", "Th_MOXQuadFuelRod" + }; + + public static final String[] RESOURCE_NAME_DEPLETED = { + "DepletedUraniumFuelRod", "DepletedUraniumDualFuelRod", "DepletedUraniumQuadFuelRod", + "DepletedThoriumFuelRod", "DepletedThoriumDualFuelRod", "DepletedThoriumQuadFuelRod", + "DepletedMOXFuelRod", "DepletedMOXDualFuelRod", "DepletedMOXQuadFuelRod", + "DepletedNaquadahFuelRod", "DepletedNaquadahDualFuelRod", "DepletedNaquadahQuadFuelRod", + "Th_DepletedMOXFuelRod", "Th_DepletedMOXDualFuelRod", "Th_DepletedMOXQuadFuelRod" + }; + + public static final int[] VALUES_LIFETIME = { + 20000, 20000, 20000, 100000, 100000, 100000, + 10000, 10000, 10000, 100000, 100000, 100000, + 50000, 50000, 50000 + }; + + public static final int[] VALUES_PULSES = { + 1, 2, 4, 1, 2, 4, + 1, 2, 4, 1, 2, 4, + 1, 2, 4 + }; + + public static final int[] VALUES_HEAT_PER_SECOND = { + 4, 24, 96, 1, 6, 24, + 4, 24, 96, 80, 480, 1920, + 1, 6, 24 + }; + + public static final int[] VALUES_HEAT_PER_PULSE = { + 4, 4, 4, 1, 1, 1, + 4, 4, 4, 80, 80, 80, + 1, 1, 1 + + }; + + public static final double[] VALUES_HEAT_BOOST_RATE = { + 1, 1, 1, 1, 1, 1, + 5, 5, 5, 1, 1, 1, + 2, 2, 2 + }; + + public static final int[] VALUES_EU_PER_TICK = { + 50, 200, 600, 10, 40, 120, + 50, 200, 600, 100, 400, 1200, + 10, 40, 120 + }; + + public static final int[] VALUES_EU_PER_PULSE = { + 50, 50, 50, 10, 10, 10, + 50, 50, 50, 100, 100, 100, + 10, 10, 10 + }; + + public static final GTRecipe[] RECIPE = { + // Uranium Fuel Rod + new GTRecipe().setDuration(600).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.UraniumFuelRod.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.UraniumDualFuelRod.getMetaID())), + new GTRecipe().setDuration(1000).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.UraniumQuadFuelRod.getMetaID())), + // Thorium Fuel Rod + new GTRecipe().setDuration(600).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.ThoriumFuelRod.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.ThoriumDualFuelRod.getMetaID())), + new GTRecipe().setDuration(1000).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.ThoriumQuadFuelRod.getMetaID())), + // MOX Fuel Rod + new GTRecipe().setDuration(600).setEUPerTick(1920) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.MOXFuelRod.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(1920) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.MOXDualFuelRod.getMetaID())), + new GTRecipe().setDuration(1000).setEUPerTick(1920) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.MOXQuadFuelRod.getMetaID())), + // Naquadah Fuel Rod + new GTRecipe().setDuration(600).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.NaquadahFuelRod.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.NaquadahDualFuelRod.getMetaID())), + new GTRecipe().setDuration(1000).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.NaquadahQuadFuelRod.getMetaID())), + // Thorium MOX Fuel Rod + }; + +} diff --git a/src/main/java/reactor/items/HeatExchanger.java b/src/main/java/reactor/items/HeatExchanger.java new file mode 100644 index 0000000000..b34baf25cf --- /dev/null +++ b/src/main/java/reactor/items/HeatExchanger.java @@ -0,0 +1,60 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_CraftingComponent; +import kekztech.MetaItem_ReactorComponent; +import kekztech.Util; +import net.minecraftforge.fluids.FluidRegistry; + +public class HeatExchanger { + + public static String TYPE = "HeatExchanger"; + + public static String[] RESOURCE_NAME = { + "T1HeatExchanger", "T2HeatExchanger", "T3HeatExchanger", "T4HeatExchanger" + }; + + public static int[] HEAT_CAPACITY = { + 2000, 8000, 32000, 128000 + }; + + public static int[] COMPONENT_EXCHANGE_RATE = { + 12, 24, 96, 384 + }; + + public static int[] HULL_EXCHANGE_RATE = { + 4, 8, 32, 128 + }; + + public static GTRecipe[] RECIPE = { + new GTRecipe().setDuration(200).setEUPerTick(120) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.CopperHeatPipe.getMetaID(), 4)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDenseCopper", 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.copper", 576)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1HeatExchanger.getMetaID())), + new GTRecipe().setDuration(400).setEUPerTick(480) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.SilverHeatPipe.getMetaID(), 4)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDenseSilver", 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.silver", 576)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T2HeatExchanger.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(7680) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.BoronArsenideHeatPipe.getMetaID(), 4)) + .addInputItem(Util.getStackofAmountFromOreDict("pipeTinyCopper", 4)) + .addInputItem(Util.getStackofAmountFromOreDict("wireFineSilver", 16)) + //.addInputItem(new ItemStack(ItemList.Pump_EV.getItem(), 1)) + .addInputFluid(FluidRegistry.getFluidStack("ic2coolant", 720)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T3HeatExchanger.getMetaID())), + new GTRecipe().setDuration(1600).setEUPerTick(30720) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.DiamondHeatPipe.getMetaID(), 4)) + .addInputItem(Util.getStackofAmountFromOreDict("frameGTHSSE", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("plateHSSE", 6)) + .addInputItem(Util.getStackofAmountFromOreDict("screwOsmiridium", 24)) + .addInputItem(Util.getStackofAmountFromOreDict("pipeTinyEnderium", 4)) + //.addInputItem(new ItemStack(ItemList.Pump_LuV.getItem(), 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.gallium", 1152)) + .addInputFluid(FluidRegistry.getFluidStack("helium", 10000)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T4HeatExchanger.getMetaID())) + }; + +} diff --git a/src/main/java/reactor/items/HeatPipe.java b/src/main/java/reactor/items/HeatPipe.java new file mode 100644 index 0000000000..5f907b02fc --- /dev/null +++ b/src/main/java/reactor/items/HeatPipe.java @@ -0,0 +1,29 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_CraftingComponent; +import kekztech.Util; + +public class HeatPipe { + + public static String[] RESOURCE_NAMES = { + "CopperHeatPipe", "SilverHeatPipe", "BoronArsenideHeatPipe", "DiamondHeatPipe" + }; + + public static final GTRecipe[] RECIPE = { + new GTRecipe().setEUPerTick(120).setDuration(120) + .addInputItem(Util.getStackofAmountFromOreDict("stickCopper", 1)) + .addOutputItem(MetaItem_CraftingComponent.getInstance().getStackFromDamage(Items.CopperHeatPipe.getMetaID())), + new GTRecipe().setEUPerTick(480).setDuration(120) + .addInputItem(Util.getStackofAmountFromOreDict("stickSilver", 1)) + .addOutputItem(MetaItem_CraftingComponent.getInstance().getStackFromDamage(Items.SilverHeatPipe.getMetaID())), + new GTRecipe().setEUPerTick(1920).setDuration(1200) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.BoronArsenideCrystal.getMetaID(), 4)) + .addOutputItem(MetaItem_CraftingComponent.getInstance().getStackFromDamage(Items.BoronArsenideHeatPipe.getMetaID())), + new GTRecipe().setEUPerTick(7680).setDuration(1200) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondCrystal.getMetaID(), 4)) + .addOutputItem(MetaItem_CraftingComponent.getInstance().getStackFromDamage(Items.DiamondHeatPipe.getMetaID())) + }; + +} diff --git a/src/main/java/reactor/items/HeatVent.java b/src/main/java/reactor/items/HeatVent.java new file mode 100644 index 0000000000..e6ad50fb95 --- /dev/null +++ b/src/main/java/reactor/items/HeatVent.java @@ -0,0 +1,111 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_CraftingComponent; +import kekztech.MetaItem_ReactorComponent; +import kekztech.Util; +import net.minecraftforge.fluids.FluidRegistry; + +public class HeatVent { + + public static final String TYPE = "HeatVent"; + public static final String HEAT = "HEAT"; + public static final String RESOURCE_NAME = "RESOURCE_NAME"; + public static final String HEAT_CAPACITY = "HEAT_CAPACITY"; + public static final String COMPONENT_VENT_RATE = "COMPONENT_VENT_RATE"; + public static final String HULL_DRAW_RATE = "HULL_DRAW_RATE"; + public static final String SELF_COOL_RATE = "SELF_COOL_RATE"; + + + public static String[] RESOURCE_NAMES = { + "T1HeatVent", "T2HeatVent", "T3HeatVent", "T4HeatVent", + "T1ComponentHeatVent", "T2ComponentHeatVent", "T3ComponentHeatVent", "T4ComponentHeatVent", + "T1OverclockedHeatVent", "T2OverclockedHeatVent", "T3OverclockedHeatVent", "T4OverclockedHeatVent" + }; + + public static int[] HEAT_CAPACITIES = { + 1000, 4000, 8000, 32000, + 1000, 4000, 8000, 32000, + 1000, 4000, 8000, 32000 + }; + + public static int[] COMPONENT_VENT_RATES = { + 0, 0, 0, 0, + 6, 12, 48, 96, + 0, 0, 0, 0 + }; + + public static int[] HULL_DRAW_RATES = { + 0, 0, 0, 0, + 0, 0, 0, 0, + 18, 36, 144, 288 + }; + + public static int[] SELF_COOL_RATES = { + 6, 12, 48, 96, + 0, 0, 0, 0, + 10, 20, 80, 160 + }; + + public static final GTRecipe[] RECIPE = { + // Heat Vents + new GTRecipe().setDuration(200).setEUPerTick(120) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.CopperHeatPipe.getMetaID(), 2)) + // MV Motor + .addInputItem(Util.getStackofAmountFromOreDict("rotorSteel", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDoubleSteel", 2)) + .addInputItem(Util.getStackofAmountFromOreDict("screwSteel", 8)) + .addInputItem(Util.getStackofAmountFromOreDict("circuitGood", 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.copper", 144)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1HeatVent.getMetaID())), + new GTRecipe().setDuration(400).setEUPerTick(480) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.SilverHeatPipe.getMetaID(), 2)) + // HV Motor + .addInputItem(Util.getStackofAmountFromOreDict("rotorAluminium", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDoubleAluminium", 2)) + .addInputItem(Util.getStackofAmountFromOreDict("screwAluminium", 8)) + .addInputItem(Util.getStackofAmountFromOreDict("circuitAdvanced", 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.silver", 144)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T2HeatVent.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(7680) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.BoronArsenideHeatPipe.getMetaID(), 2)) + // EV Motor + .addInputItem(Util.getStackofAmountFromOreDict("rotorTungstenSteel", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDoubleTungstenSteel", 2)) + .addInputItem(Util.getStackofAmountFromOreDict("screwTungsten", 8)) + .addInputItem(Util.getStackofAmountFromOreDict("circuitData", 1)) + .addInputFluid(FluidRegistry.getFluidStack("molten.gallium", 288)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T3HeatVent.getMetaID())), + new GTRecipe().setDuration(400).setEUPerTick(30720) + .addInputItem(MetaItem_CraftingComponent.getInstance().getStackOfAmountFromDamage(Items.DiamondHeatPipe.getMetaID(), 2)) + // LuV Motor + .addInputItem(Util.getStackofAmountFromOreDict("rotorHSSS", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("frameGTHSSS", 1)) + .addInputItem(Util.getStackofAmountFromOreDict("plateDoubleIridium", 6)) + .addInputItem(Util.getStackofAmountFromOreDict("screwOsmiridium", 24)) + .addInputItem(Util.getStackofAmountFromOreDict("circuitMaster", 1)) + .addInputFluid(FluidRegistry.getFluidStack("lubricant", 1000)) + .addInputFluid(FluidRegistry.getFluidStack("molten.gallium", 1152)) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T4HeatVent.getMetaID())), + // Component Heat Vents + new GTRecipe().setDuration(200).setEUPerTick(120) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1ComponentHeatVent.getMetaID())), + new GTRecipe().setDuration(400).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T2ComponentHeatVent.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T3ComponentHeatVent.getMetaID())), + new GTRecipe().setDuration(1600).setEUPerTick(30720) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T4ComponentHeatVent.getMetaID())), + // OC Heat Vents + new GTRecipe().setDuration(200).setEUPerTick(120) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1OverclockedHeatVent.getMetaID())), + new GTRecipe().setDuration(400).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T2OverclockedHeatVent.getMetaID())), + new GTRecipe().setDuration(800).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T3OverclockedHeatVent.getMetaID())), + new GTRecipe().setDuration(1600).setEUPerTick(30720) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T4OverclockedHeatVent.getMetaID())), + }; + +} diff --git a/src/main/java/reactor/items/NeutronReflector.java b/src/main/java/reactor/items/NeutronReflector.java new file mode 100644 index 0000000000..0066a93917 --- /dev/null +++ b/src/main/java/reactor/items/NeutronReflector.java @@ -0,0 +1,26 @@ +package reactor.items; + +import kekztech.GTRecipe; +import kekztech.Items; +import kekztech.MetaItem_ReactorComponent; + +public class NeutronReflector { + + public static String TYPE = "NeutronReflector"; + + public static String[] RESOURCE_NAME = { + "T1NeutronReflector", "T2NeutronReflector" + }; + + public static int[] DURABILITY = { + 512000, 2147483647 + }; + + public static GTRecipe[] RECIPE = { + new GTRecipe().setDuration(1200).setEUPerTick(480) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T1NeutronReflector.getMetaID())), + new GTRecipe().setDuration(4800).setEUPerTick(7680) + .addOutputItem(MetaItem_ReactorComponent.getInstance().getStackFromDamage(Items.T2NeutronReflector.getMetaID())) + }; + +} |