diff options
Diffstat (limited to 'src')
12 files changed, 497 insertions, 31 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index d277862e9a..fbb2f6320b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -37,6 +37,7 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.debug.CreativeScan import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_CircuitAssemblyLine; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_DEHP; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor; +import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_THTR; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_HTGR; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaBlastFurnace; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaDistillTower; @@ -143,6 +144,7 @@ public class ItemRegistry { public static ItemStack[] megaMachines = new ItemStack[3]; public static ItemStack dehp; public static ItemStack[] voidminer = new ItemStack[3]; + public static ItemStack THTR; public static ItemStack HTGR; public static ItemStack eic; public static ItemStack cal; @@ -185,7 +187,9 @@ public class ItemRegistry { if (ConfigHandler.creativeScannerID != 0) new CreativeScanner(ConfigHandler.creativeScannerID,"Creative Debug Scanner","Creative Debug Scanner",20); ItemRegistry.eic = new GT_TileEntity_ElectricImplosionCompressor(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 6, "ElectricImplosionCompressor", "Electric Implosion Compressor").getStackForm(1L); - ItemRegistry.HTGR = new GT_TileEntity_HTGR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5, "HTGR", "High Temperature Gas-cooled Reactor").getStackForm(1L); + ItemRegistry.THTR = new GT_TileEntity_THTR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5, "THTR", "Thorium High Temperature Reactor").getStackForm(1L); + GT_TileEntity_THTR.THTRMaterials.registeraTHR_Materials(); + ItemRegistry.HTGR = new GT_TileEntity_HTGR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 15 + 48, "HTGR", "High Temperature Gas-cooled Reactor").getStackForm(1L); GT_TileEntity_HTGR.HTGRMaterials.registeraTHR_Materials(); GT_OreDictUnificator.add(OrePrefixes.block, Materials.BorosilicateGlass, new ItemStack(ItemRegistry.bw_glasses[0], 1, 0)); GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.NickelZincFerrite, new ItemStack(ItemRegistry.BW_BLOCKS[2])); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index dbbb5f7853..ac747e00b0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -26,6 +26,7 @@ import com.github.bartimaeusnek.bartworks.API.LoaderReference; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_LESU; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ManualTrafo; +import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_THTR; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_HTGR; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_Windmill; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; @@ -744,6 +745,19 @@ public class RecipeLoader { 'G', GT_OreDictUnificator.get(OrePrefixes.gearGt, Materials.Iron, 1L), } ); + GT_TileEntity_THTR.THTRMaterials.registerTHR_Recipes(); + GT_ModHandler.addCraftingRecipe( + ItemRegistry.THTR, + RecipeLoader.BITSD, + new Object[]{ + "BZB", + "BRB", + "BZB", + 'B', new ItemStack(GregTech_API.sBlockCasings3, 1, 12), + 'R', GT_ModHandler.getModItem("IC2", "blockGenerator", 1, 5), + 'Z', "circuitUltimate" + } + ); GT_TileEntity_HTGR.HTGRMaterials.registerTHR_Recipes(); GT_ModHandler.addCraftingRecipe( ItemRegistry.HTGR, @@ -752,7 +766,7 @@ public class RecipeLoader { "BZB", "BRB", "BZB", - 'B', new ItemStack(GregTech_API.sBlockCasings3, 1, 12), + 'B', new ItemStack(GregTech_API.sBlockCasings8, 1, 5), 'R', GT_ModHandler.getModItem("IC2", "blockGenerator", 1, 5), 'Z', "circuitSuperconductor" } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java index 95df799c0b..40e2a8b878 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -69,7 +70,7 @@ import java.util.HashMap; public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_HTGR> { - private static final int BASECASINGINDEX = 44; + private static final int BASECASINGINDEX = 181; private static final String STRUCTURE_PIECE_MAIN = "main"; private static final IStructureDefinition<GT_TileEntity_HTGR> STRUCTURE_DEFINITION = StructureDefinition.<GT_TileEntity_HTGR>builder() @@ -87,16 +88,20 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, {" bbb~bbb "," bbbbbbbbb ","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb"," bbbbbbbbb "," bbbbbbb "}, })) - .addElement('c', ofBlock(GregTech_API.sBlockCasings3, 12)) + .addElement('c', ofBlock(GregTech_API.sBlockCasings8, 5)) .addElement('b', ofChain( ofHatchAdder(GT_TileEntity_HTGR::addOutputToMachineList, BASECASINGINDEX, 1), ofHatchAdder(GT_TileEntity_HTGR::addMaintenanceToMachineList, BASECASINGINDEX, 1), - ofBlock(GregTech_API.sBlockCasings3, 12) + ofHatchAdder(GT_TileEntity_HTGR::addEnergyInputToMachineList, BASECASINGINDEX, 1), + ofBlock(GregTech_API.sBlockCasings8, 5) )) - .addElement('B', ofHatchAdderOptional(GT_TileEntity_HTGR::addInputToMachineList, BASECASINGINDEX, 2, GregTech_API.sBlockCasings3, 12)) + .addElement('B', ofHatchAdderOptional(GT_TileEntity_HTGR::addInputToMachineList, BASECASINGINDEX, 2, GregTech_API.sBlockCasings8, 5)) .build(); private static final int HELIUM_NEEDED = 730000; + private static final int powerUsage = BW_Util.getMachineVoltageFromTier(6); + private static final int maxcapacity = 720000; + private static final int mincapacity = maxcapacity/10; private int HeliumSupply; private int fueltype = -1, fuelsupply = 0; private boolean empty; @@ -131,22 +136,29 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase .addInfo("Consumes up to 0.5% of total Fuel Pellets per Operation depending on efficiency") .addInfo("Efficiency is calculated exponentially depending on the amount of pebbles in the internal buffer") .addInfo("Reactor will take 4 000L/s of coolant multiplied by efficiency and by fuel coolant value (check tooltips)") + .addInfo("Uses " + GT_Utility.formatNumbers(powerUsage) + " EU/t") .addInfo("One Operation takes 1 hour") .addSeparator() .beginStructureBlock(11, 12, 11, true) .addController("Front bottom center") - .addCasingInfo("Radiation Proof Casings", 0) + .addCasingInfo("Europium Reinforced Radiation Proof Casings", 0) .addStructureInfo("Corners and the 2 touching blocks are air (cylindric)") .addInputBus("Any top layer casing", 2) .addInputHatch("Any top layer casing", 2) .addOutputBus("Any bottom layer casing", 1) .addOutputHatch("Any bottom layer casing", 1) + .addEnergyHatch("Any bottom layer casing", 1) .addMaintenanceHatch("Any bottom layer casing", 1) .toolTipFinisher("Bartworks"); return tt; } @Override + protected IAlignmentLimits getInitialAlignmentLimits() { + return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped(); + } + + @Override public void construct(ItemStack stackSize, boolean hintsOnly) { buildPiece("main", stackSize, hintsOnly, 5, 11, 0); } @@ -159,7 +171,8 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase this.mInputHatches.size() > 0 && this.mOutputHatches.size() > 0 && this.mInputBusses.size() > 0 && - this.mOutputBusses.size() > 0 + this.mOutputBusses.size() > 0 && + this.mEnergyHatches.size() > 0 ); } @@ -198,7 +211,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase } } } - if(this.fuelsupply < 720000){ + if(this.fuelsupply < maxcapacity){ for (ItemStack itemStack : this.getStoredInputs()) { int type = -1; if(itemStack == null) continue; @@ -210,7 +223,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase this.fueltype = type; if(this.fueltype != type) continue; - int toget = Math.min(720000 - this.fuelsupply, itemStack.stackSize); + int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize); this.fuelsupply += toget; itemStack.stackSize -= toget; } @@ -224,14 +237,17 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase if(this.empty) { - this.mEfficiency = 10000; - this.mMaxProgresstime = 100; - return true; + if(this.HeliumSupply > 0 || this.fuelsupply > 0){ + this.mEfficiency = 10000; + this.mMaxProgresstime = 100; + return true; + } + return false; } - if (!(this.HeliumSupply >= GT_TileEntity_HTGR.HELIUM_NEEDED && this.fuelsupply >= 72000)) + if (!(this.HeliumSupply >= GT_TileEntity_HTGR.HELIUM_NEEDED && this.fuelsupply >= mincapacity)) return false; - double eff = Math.min(Math.pow((double)this.fuelsupply/72000D, 2D), 100D)/100D - ((double)(getIdealStatus() - getRepairStatus()) / 10D); + double eff = Math.min(Math.pow((double)this.fuelsupply/(double)mincapacity, 2D), 100D)/100D - ((double)(getIdealStatus() - getRepairStatus()) / 10D); if(eff <= 0) return false; @@ -250,12 +266,12 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase new ItemStack(HTGRMaterials.aHTGR_Materials, toReduce, meta + 1) }; - this.updateSlots(); + //this.updateSlots(); // not needed ? this.coolanttaking = (int)(4000D * (((this.fueltype * 0.5D) + 1)) * eff); this.mEfficiency = (int)(eff*10000D); - this.mEUt=0; + this.mEUt=-powerUsage; this.mMaxProgresstime=72000; return true; } @@ -300,6 +316,9 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase return true; } + if(!super.onRunningTick(aStack)) // USE DA POWAH + return false; + if(runningtick % 20 == 0) { int takecoolant = coolanttaking; @@ -373,7 +392,18 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX), TextureFactory.of(aActive ? TextureFactory.of(TextureFactory.of(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE), TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).glow().build()) : TextureFactory.of(TextureFactory.of(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER), TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).glow().build()))} : new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX)}; + if (aSide == aFacing) { + if (aActive) + return new ITexture[]{ + Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()}; + return new ITexture[]{ + Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()}; + } + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX)}; } @Override @@ -509,22 +539,15 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase } public static void registerTHR_Recipes(){ - GT_Values.RA.addCentrifugeRecipe( - Materials.Thorium.getDust(1),GT_Values.NI,GT_Values.NF,GT_Values.NF, - Materials.Thorium.getDustSmall(2),Materials.Thorium.getDustSmall(1), - WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1),WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1), - WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1),Materials.Lutetium.getDustTiny(1), - new int[]{1600,1500,200,200,50,50}, - 10000, BW_Util.getMachineVoltageFromTier(4)); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ - GT_OreDictUnificator.get(OrePrefixes.plateDense,Materials.Lead,6), - GT_OreDictUnificator.get(OrePrefixes.frameGt,Materials.TungstenSteel,1), + new ItemStack(GregTech_API.sBlockCasings3,1,12), + GT_OreDictUnificator.get(OrePrefixes.plate,Materials.Europium,6), GT_OreDictUnificator.get(OrePrefixes.screw,Materials.Europium,24) }, - Materials.Concrete.getMolten(1296), - new ItemStack(GregTech_API.sBlockCasings3,1,12), - 40, - BW_Util.getMachineVoltageFromTier(5) + Materials.Lead.getMolten(1296), + new ItemStack(GregTech_API.sBlockCasings8,1,5), + 200, + BW_Util.getMachineVoltageFromTier(6) ); int i = 0; for(Fuel_ fuel : sHTGR_Fuel){ diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java new file mode 100644 index 0000000000..cb0a454dce --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java @@ -0,0 +1,417 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.common.tileentities.multis; + +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.IStructureElement; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.github.bartimaeusnek.bartworks.common.items.SimpleSubItemClass; +import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; +import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; +import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.bartworks.util.MathUtils; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +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_EnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.objects.XSTR; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; + +import java.util.Arrays; + +public class GT_TileEntity_THTR extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_THTR> { + + private static final int BASECASINGINDEX = 44; + + private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final IStructureDefinition<GT_TileEntity_THTR> STRUCTURE_DEFINITION = StructureDefinition.<GT_TileEntity_THTR>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ + {" BBBBBBB "," BBBBBBBBB ","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB"," BBBBBBBBB "," BBBBBBB "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" bbb~bbb "," bbbbbbbbb ","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb"," bbbbbbbbb "," bbbbbbb "}, + })) + .addElement('c', ofBlock(GregTech_API.sBlockCasings3, 12)) + .addElement('b', ofChain( + ofHatchAdder(GT_TileEntity_THTR::addOutputToMachineList, BASECASINGINDEX, 1), + ofHatchAdder(GT_TileEntity_THTR::addMaintenanceToMachineList, BASECASINGINDEX, 1), + ofHatchAdder(GT_TileEntity_THTR::addEnergyInputToMachineList, BASECASINGINDEX, 1), + ofBlock(GregTech_API.sBlockCasings3, 12) + )) + .addElement('B', ofHatchAdderOptional(GT_TileEntity_THTR::addInputToMachineList, BASECASINGINDEX, 2, GregTech_API.sBlockCasings3, 12)) + .build(); + + + + + private static final int HELIUM_NEEDED = 730000; + private static final int powerUsage = BW_Util.getMachineVoltageFromTier(5)/2; + private static final int maxcapacity = 675000; + private static final int mincapacity = 100000; + private int HeliumSupply; + private int fuelsupply; + private boolean empty; + private int coolanttaking = 0; + + public GT_TileEntity_THTR(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + private GT_TileEntity_THTR(String aName) { + super(aName); + } + + @Override + public boolean isCorrectMachinePart(ItemStack itemStack) { + return true; + } + + @Override + public IStructureDefinition<GT_TileEntity_THTR> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("High Temperature Reactor") + .addInfo("Controller block for the Thorium High Temperature Reactor (THTR)") + .addInfo("Needs a constant supply of coolant while running") + .addInfo("Needs at least 100k Fuel pebbles to start operation (can hold up to 675k pebbles)") + .addInfo("Consumes up to 0.5% of total Fuel Pellets per Operation depending on efficiency") + .addInfo("Efficiency is calculated exponentially depending on the amount of pebbles in the internal buffer") + .addInfo("Reactor will take 4 800L/t of coolant multiplied by efficiency") + .addInfo("Uses " + GT_Utility.formatNumbers(powerUsage) + " EU/t") + .addInfo("One Operation takes 9 hour") + .addSeparator() + .beginStructureBlock(11, 12, 11, true) + .addController("Front bottom center") + .addCasingInfo("Radiation Proof Casings", 0) + .addStructureInfo("Corners and the 2 touching blocks are air (cylindric)") + .addInputBus("Any top layer casing", 2) + .addInputHatch("Any top layer casing", 2) + .addOutputBus("Any bottom layer casing", 1) + .addOutputHatch("Any bottom layer casing", 1) + .addEnergyHatch("Any bottom layer casing", 1) + .addMaintenanceHatch("Any bottom layer casing", 1) + .toolTipFinisher("Bartworks"); + return tt; + } + + @Override + protected IAlignmentLimits getInitialAlignmentLimits() { + return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped(); + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 5, 11, 0); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { + return ( + checkPiece(STRUCTURE_PIECE_MAIN, 5, 11, 0) && + this.mMaintenanceHatches.size() == 1 && + this.mInputHatches.size() > 0 && + this.mOutputHatches.size() > 0 && + this.mInputBusses.size() > 0 && + this.mOutputBusses.size() > 0 && + this.mEnergyHatches.size() > 0 + ); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.HeliumSupply = aNBT.getInteger("HeliumSupply"); + this.fuelsupply = aNBT.getInteger("fuelsupply"); + this.coolanttaking = aNBT.getInteger("coolanttaking"); + this.empty = aNBT.getBoolean("EmptyMode"); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("HeliumSupply", this.HeliumSupply); + aNBT.setInteger("fuelsupply", this.fuelsupply); + aNBT.setInteger("coolanttaking", this.coolanttaking); + aNBT.setBoolean("EmptyMode", this.empty); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide() && !this.empty){ + if (this.HeliumSupply < GT_TileEntity_THTR.HELIUM_NEEDED){ + for (FluidStack fluidStack : this.getStoredFluids()){ + if (fluidStack.isFluidEqual(Materials.Helium.getGas(1))) { + int toget = Math.min(GT_TileEntity_THTR.HELIUM_NEEDED - this.HeliumSupply, fluidStack.amount); + fluidStack.amount -= toget; + this.HeliumSupply += toget; + if(GT_TileEntity_THTR.HELIUM_NEEDED == this.HeliumSupply && fluidStack.amount == 0) + fluidStack = null; + } + } + } + if(this.fuelsupply < maxcapacity){ + for (ItemStack itemStack : this.getStoredInputs()) { + if (GT_Utility.areStacksEqual(itemStack, new ItemStack(THTRMaterials.aTHTR_Materials, 1, THTRMaterials.MATERIAL_FUEL_INDEX))) { + int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize); + if(toget == 0) continue; + itemStack.stackSize -= toget; + this.fuelsupply += toget; + } + } + this.updateSlots(); + } + } + } + + @Override + public boolean checkRecipe(ItemStack controllerStack) { + + if(this.empty) + { + if(this.HeliumSupply > 0 || this.fuelsupply > 0){ + this.mEfficiency = 10000; + this.mMaxProgresstime = 100; + return true; + } + return false; + } + if (!(this.HeliumSupply >= GT_TileEntity_THTR.HELIUM_NEEDED && this.fuelsupply >= mincapacity)) + return false; + + double eff = Math.min(Math.pow((double)(this.fuelsupply - mincapacity)/((maxcapacity-mincapacity)/10D), 2D)+1, 100D)/100D - ((double)(getIdealStatus() - getRepairStatus()) / 10D); + if(eff <= 0D) + return false; + + int toReduce = MathUtils.floorInt((double)this.fuelsupply * 0.005D * eff); + + this.fuelsupply -= toReduce; + int burnedballs = toReduce/64; + if(burnedballs > 0) + toReduce -= burnedballs*64; + + int meta = THTRMaterials.MATERIAL_USED_FUEL_INDEX; + + this.mOutputItems = new ItemStack[] { + new ItemStack(THTRMaterials.aTHTR_Materials, burnedballs, meta), + new ItemStack(THTRMaterials.aTHTR_Materials, toReduce, meta + 1) + }; + + // this.updateSlots(); not needed ? + + this.coolanttaking = (int)(4800D * eff); + this.mEfficiency = (int)(eff*10000D); + this.mEUt=-powerUsage; + this.mMaxProgresstime=648000; + return true; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + + if (this.empty){ + this.addOutput(Materials.Helium.getGas(this.HeliumSupply)); + this.addOutput(new ItemStack(THTRMaterials.aTHTR_Materials, this.fuelsupply, THTRMaterials.MATERIAL_FUEL_INDEX)); + this.HeliumSupply = 0; + this.fuelsupply = 0; + this.updateSlots(); + return true; + } + + if(!super.onRunningTick(aStack)) + return false; + + int takecoolant = coolanttaking; + int drainedamount = 0; + + for(GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches){ + if (isValidMetaTileEntity(tHatch)) { + FluidStack tLiquid = tHatch.getFluid(); + if (tLiquid != null && tLiquid.isFluidEqual(FluidRegistry.getFluidStack("ic2coolant",1))){ + FluidStack drained = tHatch.drain(takecoolant, true); + takecoolant -= drained.amount; + drainedamount += drained.amount; + if(takecoolant <= 0) + break; + } + } + } + + if(drainedamount > 0) + addOutput(FluidRegistry.getFluidStack("ic2hotcoolant", drainedamount)); + + this.updateSlots(); + + return true; + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack itemStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack itemStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack itemStack) { + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new GT_TileEntity_THTR(this.mName); + } + + + @Override + public String[] getInfoData() { + return new String[]{ + "Progress:", GT_Utility.formatNumbers(this.mProgresstime / 20) + "secs /" + GT_Utility.formatNumbers(this.mMaxProgresstime / 20) + "secs", + "TRISO-Pebbles:", GT_Utility.formatNumbers(this.fuelsupply) + "pcs. / " + GT_Utility.formatNumbers(this.fuelsupply) + "psc.", + "Helium-Level:", GT_Utility.formatNumbers(this.HeliumSupply) + "L / " + GT_Utility.formatNumbers(GT_TileEntity_THTR.HELIUM_NEEDED) + "L", + "Coolant/t:", GT_Utility.formatNumbers(this.mProgresstime == 0 ? 0 : coolanttaking) + "L/t", + "Problems:", String.valueOf(this.getIdealStatus() - this.getRepairStatus()) + }; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aActive) + return new ITexture[]{ + Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_THTR.BASECASINGINDEX), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()}; + return new ITexture[]{ + Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_THTR.BASECASINGINDEX), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), + TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()}; + } + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_THTR.BASECASINGINDEX)}; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if(this.mMaxProgresstime > 0) + { + GT_Utility.sendChatToPlayer(aPlayer, "THTR mode cannot be changed while the machine is running."); + return; + } + this.empty = !this.empty; + GT_Utility.sendChatToPlayer(aPlayer, "THTR is now running in " + (this.empty ? "emptying mode." : "normal Operation")); + } + + public static class THTRMaterials{ + static final SimpleSubItemClass aTHTR_Materials = new SimpleSubItemClass( + "BISOPelletCompound", // 0 + "BISOPelletBall", // 1 + "TRISOPelletCompound", // 2 + "TRISOPelletBall", // 3 + "TRISOPellet", // 4 + "BurnedOutTRISOPelletBall", // 5 + "BurnedOutTRISOPellet" // 6 + ); + public static final int MATERIAL_FUEL_INDEX = 4; + public static final int MATERIAL_USED_FUEL_INDEX = 5; + public static void registeraTHR_Materials(){ + GameRegistry.registerItem(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,"bw.THTRMaterials"); + } + + public static void registerTHR_Recipes(){ + GT_Values.RA.addCentrifugeRecipe( + Materials.Thorium.getDust(1),GT_Values.NI,GT_Values.NF,GT_Values.NF, + Materials.Thorium.getDustSmall(2),Materials.Thorium.getDustSmall(1), + WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1),WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1), + WerkstoffLoader.Thorium232.get(OrePrefixes.dustTiny,1),GT_Values.NI, + new int[]{1600,1500,200,200,50}, + 10000, BW_Util.getMachineVoltageFromTier(4)); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.plateDense,Materials.Lead,6), + GT_OreDictUnificator.get(OrePrefixes.frameGt,Materials.TungstenSteel,1) + }, + Materials.Concrete.getMolten(1296), + new ItemStack(GregTech_API.sBlockCasings3,1,12), + 40, + BW_Util.getMachineVoltageFromTier(5) + ); + GT_Values.RA.addMixerRecipe(WerkstoffLoader.Thorium232.get(OrePrefixes.dust,10),Materials.Uranium235.getDust(1),GT_Utility.getIntegratedCircuit(2),null,null,null,new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials),400,30); + GT_Values.RA.addFormingPressRecipe(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials),Materials.Graphite.getDust(64),new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,1),40,30); + GT_Values.RA.addFormingPressRecipe(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,1),Materials.Silicon.getDust(64),new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,2),40,30); + GT_Values.RA.addFormingPressRecipe(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,2),Materials.Graphite.getDust(64),new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,3),40,30); + ItemStack[] pellets = new ItemStack[6]; + Arrays.fill(pellets,new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,64,4)); + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(false,new ItemStack[]{new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,3),GT_Utility.getIntegratedCircuit(17)}, pellets,null,null,null,null,48000,30,0); + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(false,new ItemStack[]{new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,1,5),GT_Utility.getIntegratedCircuit(17)}, new ItemStack[]{new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials,64,6)},null,null,null,null,48000,30,0); + GT_Values.RA.addCentrifugeRecipe( + new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials, 1, 6), GT_Values.NI, GT_Values.NF, GT_Values.NF, + Materials.Lead.getDust(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, + new int[]{300}, + 1200, 30); + } + + } +} diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 984477d20f..b2a671cd20 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -144,6 +144,14 @@ tile.radiohatch.name=Radio Hatch tile.bw.windmill.name=Windmill tile.manutrafo.name=Manual Trafo +item.TRISOPellet.name=TRISO pebble +item.TRISOPelletBall.name=TRISO pebble ball +item.BISOPelletBall.name=BISO pebble ball +item.TRISOPelletCompound.name=TRISO pebble compound +item.BISOPelletCompound.name=BISO pebble compound +item.BurnedOutTRISOPelletBall.name=Burned Out TRISO pebble ball +item.BurnedOutTRISOPellet.name=Burned Out TRISO pebble + itemGroup.bartworksMetaMaterials=BartWorks' Meta Materials tooltip.tile.eic.0.name=Controller Block for the Electric Implosion Compressor;Size(WxHxD): 3x9x3;Uses Electricity instead of Explosives;Controller: Layer 3, front, center;Layer 1 and Layer 9: Solid Steel Machine Casings, each: 1 Energy Hatch in the middle;Layer 2,3,7,8: Middle: Nickel-Zinc-Ferrit Blocks, Outer: Transformer-Winding Blocks;Layer 4,5,6: Neutronium Blocks;1+ Input Bus, 1+ Output Bus, 1 Maintenance Hatch at any Solid Steel Machine Casing;Do NOT Obstruct or mine the Moving parts while in Operation, will explode if you do so! diff --git a/src/main/resources/assets/bartworks/textures/items/BISOPelletBall.png b/src/main/resources/assets/bartworks/textures/items/BISOPelletBall.png Binary files differnew file mode 100644 index 0000000000..ea113e3f22 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/BISOPelletBall.png diff --git a/src/main/resources/assets/bartworks/textures/items/BISOPelletCompound.png b/src/main/resources/assets/bartworks/textures/items/BISOPelletCompound.png Binary files differnew file mode 100644 index 0000000000..029d895f31 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/BISOPelletCompound.png diff --git a/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPellet.png b/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPellet.png Binary files differnew file mode 100644 index 0000000000..73abda00dd --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPellet.png diff --git a/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPelletBall.png b/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPelletBall.png Binary files differnew file mode 100644 index 0000000000..eb5e37eaa1 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/BurnedOutTRISOPelletBall.png diff --git a/src/main/resources/assets/bartworks/textures/items/TRISOPellet.png b/src/main/resources/assets/bartworks/textures/items/TRISOPellet.png Binary files differnew file mode 100644 index 0000000000..26109fc979 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/TRISOPellet.png diff --git a/src/main/resources/assets/bartworks/textures/items/TRISOPelletBall.png b/src/main/resources/assets/bartworks/textures/items/TRISOPelletBall.png Binary files differnew file mode 100644 index 0000000000..0aea0500cf --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/TRISOPelletBall.png diff --git a/src/main/resources/assets/bartworks/textures/items/TRISOPelletCompound.png b/src/main/resources/assets/bartworks/textures/items/TRISOPelletCompound.png Binary files differnew file mode 100644 index 0000000000..6b2835d100 --- /dev/null +++ b/src/main/resources/assets/bartworks/textures/items/TRISOPelletCompound.png |