diff options
| author | Martin Robertz <dream-master@gmx.net> | 2021-09-17 15:58:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-17 15:58:17 +0200 |
| commit | a88ce1aa5e04d216ad023b0caafa9548ab230f09 (patch) | |
| tree | 6f123fa2423a4abe5b97c5a09c58a84cd9a50c76 /src/main | |
| parent | 0d995de2a7aa10578ada65b38c279846a43acd93 (diff) | |
| parent | 8b0125b3f625e961a4773417cca9ddf41eb8a1da (diff) | |
| download | GT5-Unofficial-a88ce1aa5e04d216ad023b0caafa9548ab230f09.tar.gz GT5-Unofficial-a88ce1aa5e04d216ad023b0caafa9548ab230f09.tar.bz2 GT5-Unofficial-a88ce1aa5e04d216ad023b0caafa9548ab230f09.zip | |
Merge pull request #29 from kuba6000/THTR-Rework
Thorium High Temperature Reactor Rework
Former-commit-id: 6cdb5936aa3df392a4a0440b9c557207820b9bf0
Diffstat (limited to 'src/main')
32 files changed, 817 insertions, 215 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 10ada4ea61..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 @@ -38,6 +38,7 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEnti 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; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaVacuumFreezer; @@ -143,7 +144,8 @@ 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 THTR; + public static ItemStack HTGR; public static ItemStack eic; public static ItemStack cal; public static ItemStack compressedHatch; @@ -185,8 +187,10 @@ 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.thtr = new GT_TileEntity_THTR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5, "THTR", "Thorium High Temperature 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])); for (int i = 0; i < GT_Values.VN.length; i++) { 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 b300adaa11..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 @@ -27,6 +27,7 @@ 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; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; @@ -746,7 +747,7 @@ public class RecipeLoader { ); GT_TileEntity_THTR.THTRMaterials.registerTHR_Recipes(); GT_ModHandler.addCraftingRecipe( - ItemRegistry.thtr, + ItemRegistry.THTR, RecipeLoader.BITSD, new Object[]{ "BZB", @@ -757,6 +758,19 @@ public class RecipeLoader { 'Z', "circuitUltimate" } ); + GT_TileEntity_HTGR.HTGRMaterials.registerTHR_Recipes(); + GT_ModHandler.addCraftingRecipe( + ItemRegistry.HTGR, + RecipeLoader.BITSD, + new Object[]{ + "BZB", + "BRB", + "BZB", + 'B', new ItemStack(GregTech_API.sBlockCasings8, 1, 5), + 'R', GT_ModHandler.getModItem("IC2", "blockGenerator", 1, 5), + 'Z', "circuitSuperconductor" + } + ); if (LoaderReference.galacticgreg) { GT_Values.RA.addAssemblylineRecipe( 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 new file mode 100644 index 0000000000..40e2a8b878 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java @@ -0,0 +1,576 @@ +/* + * 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_OutputBus; +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_LanguageManager; +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; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; + +public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_HTGR> { + + 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() + .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.sBlockCasings8, 5)) + .addElement('b', ofChain( + ofHatchAdder(GT_TileEntity_HTGR::addOutputToMachineList, BASECASINGINDEX, 1), + ofHatchAdder(GT_TileEntity_HTGR::addMaintenanceToMachineList, BASECASINGINDEX, 1), + ofHatchAdder(GT_TileEntity_HTGR::addEnergyInputToMachineList, BASECASINGINDEX, 1), + ofBlock(GregTech_API.sBlockCasings8, 5) + )) + .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; + private int emptyticksnodiff = 0; + private int coolanttaking = 0; + + public GT_TileEntity_HTGR(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + private GT_TileEntity_HTGR(String aName) { + super(aName); + } + + @Override + public boolean isCorrectMachinePart(ItemStack itemStack) { + return true; + } + + @Override + public IStructureDefinition<GT_TileEntity_HTGR> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Breeder Reactor") + .addInfo("Controller block for the High Temperature Gas-cooled Reactor (HTGR)") + .addInfo("Needs a constant supply of coolant while running") + .addInfo("Needs at least 72k Fuel pebbles to start operation (can hold up to 720k 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 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("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); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { + return ( + checkPiece("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.fueltype = aNBT.getInteger("fueltype"); + this.fuelsupply = aNBT.getInteger("fuelsupply"); + this.empty = aNBT.getBoolean("EmptyMode"); + this.coolanttaking = aNBT.getInteger("coolanttaking"); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("HeliumSupply", this.HeliumSupply); + aNBT.setInteger("fueltype", this.fueltype); + aNBT.setInteger("fuelsupply", this.fuelsupply); + aNBT.setBoolean("EmptyMode", this.empty); + aNBT.setInteger("coolanttaking", this.coolanttaking); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide() && !this.empty){ + if (this.HeliumSupply < GT_TileEntity_HTGR.HELIUM_NEEDED){ + for (FluidStack fluidStack : this.getStoredFluids()){ + if (fluidStack.isFluidEqual(Materials.Helium.getGas(1))) { + int toget = Math.min(GT_TileEntity_HTGR.HELIUM_NEEDED - this.HeliumSupply, fluidStack.amount); + fluidStack.amount -= toget; + this.HeliumSupply += toget; + if(GT_TileEntity_HTGR.HELIUM_NEEDED == this.HeliumSupply && fluidStack.amount == 0) + fluidStack = null; + } + } + } + if(this.fuelsupply < maxcapacity){ + for (ItemStack itemStack : this.getStoredInputs()) { + int type = -1; + if(itemStack == null) continue; + if(itemStack.getItem() != HTGRMaterials.aHTGR_Materials) continue; + int damage = HTGRMaterials.aHTGR_Materials.getDamage(itemStack); + if(!((damage + 1) % HTGRMaterials.MATERIALS_PER_FUEL == HTGRMaterials.USABLE_FUEL_INDEX + 1)) continue; // is fuel + type = damage / HTGRMaterials.MATERIALS_PER_FUEL; + if(this.fueltype == -1) + this.fueltype = type; + if(this.fueltype != type) + continue; + int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize); + this.fuelsupply += toget; + itemStack.stackSize -= 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_HTGR.HELIUM_NEEDED && this.fuelsupply >= mincapacity)) + return false; + + double eff = Math.min(Math.pow((double)this.fuelsupply/(double)mincapacity, 2D), 100D)/100D - ((double)(getIdealStatus() - getRepairStatus()) / 10D); + + if(eff <= 0) + 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 = (this.fueltype * HTGRMaterials.MATERIALS_PER_FUEL) + HTGRMaterials.BURNED_OUT_FUEL_INDEX; + + this.mOutputItems = new ItemStack[] { + new ItemStack(HTGRMaterials.aHTGR_Materials, burnedballs, meta), + new ItemStack(HTGRMaterials.aHTGR_Materials, toReduce, meta + 1) + }; + + //this.updateSlots(); // not needed ? + + this.coolanttaking = (int)(4000D * (((this.fueltype * 0.5D) + 1)) * eff); + + this.mEfficiency = (int)(eff*10000D); + this.mEUt=-powerUsage; + this.mMaxProgresstime=72000; + return true; + } + + private int runningtick = 0; + + @Override + public boolean onRunningTick(ItemStack aStack) { + runningtick++; + + if (this.empty){ + if(emptyticksnodiff > 20 && emptyticksnodiff % 20 != 0){ + emptyticksnodiff++; + return true; + } + if(this.HeliumSupply > 0){ + this.addOutput(Materials.Helium.getGas(this.HeliumSupply)); + this.HeliumSupply = 0; + } + if(this.fuelsupply > 0) + { + ItemStack iStack = new ItemStack(HTGRMaterials.aHTGR_Materials, this.fuelsupply, (HTGRMaterials.MATERIALS_PER_FUEL * this.fueltype) + HTGRMaterials.USABLE_FUEL_INDEX); + boolean storedAll = false; + for (GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if(!isValidMetaTileEntity(tHatch)) + continue; + if (tHatch.storeAll(iStack)){ + storedAll = true; + break; + } + } + if(!storedAll){ + if(this.fuelsupply == iStack.stackSize) emptyticksnodiff++; + else {this.fuelsupply = iStack.stackSize; emptyticksnodiff = 0;} + } + else{ + this.fuelsupply = 0; + this.fueltype = -1; + this.coolanttaking = 0; + } + } + return true; + } + + if(!super.onRunningTick(aStack)) // USE DA POWAH + return false; + + if(runningtick % 20 == 0) + { + 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(); + + if(takecoolant > 0) + this.stopMachine(); + } + + 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_HTGR(this.mName); + } + + + @Override + public String[] getInfoData() { + return new String[]{ + "Mode:", this.empty ? "Emptying" : "Normal", + "Progress:", GT_Utility.formatNumbers(this.mProgresstime / 20) + "s / " + GT_Utility.formatNumbers(this.mMaxProgresstime / 20) + "s", + "Fuel type:", (this.fueltype == -1 ? "NONE" : ("TRISO (" + HTGRMaterials.sHTGR_Fuel[this.fueltype].sEnglish) + ")"), + "Fuel amount:", GT_Utility.formatNumbers(this.fuelsupply) + " pcs.", + "Helium-Level:", GT_Utility.formatNumbers(this.HeliumSupply) + "L / " + GT_Utility.formatNumbers(GT_TileEntity_HTGR.HELIUM_NEEDED) + "L", + "Coolant:", GT_Utility.formatNumbers(coolanttaking) + "L/s", + "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_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 + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if(this.mMaxProgresstime > 0) + { + GT_Utility.sendChatToPlayer(aPlayer, "HTGR mode cannot be changed while the machine is running."); + return; + } + this.empty = !this.empty; + GT_Utility.sendChatToPlayer(aPlayer, "HTGR is now running in " + (this.empty ? "emptying mode." : "normal Operation")); + } + + + + public static class HTGRMaterials{ + + private static class CustomHTGRSimpleSubItemClass extends SimpleSubItemClass{ + HashMap<Integer, String> tooltip = null; + public CustomHTGRSimpleSubItemClass(HashMap<Integer, String> tooltip, String... tex){ + super(tex); + this.tooltip = tooltip; + } + @Override + @SuppressWarnings("unchecked") + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + if(tooltip.containsKey(getDamage(p_77624_1_))) + aList.add(tooltip.get(getDamage(p_77624_1_))); + aList.add("Material for High Temperature Gas-cooled Reactor"); + super.addInformation(p_77624_1_, p_77624_2_, aList, p_77624_4_); + } + } + + private static class Base_{ + public String sName; + public String sEnglish; + public String sTooltip; + public Base_(String a, String b){ + this.sName = a; + this.sEnglish = b; + this.sTooltip = ""; + } + public Base_(String a, String b, String c){ + this.sName = a; + this.sEnglish = b; + this.sTooltip = c; + } + } + static class Fuel_{ + public String sName; + public String sEnglish; + public ItemStack mainItem; + public ItemStack secondaryItem; + public ItemStack[] recycledItems = { GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI }; + public FluidStack recycledFluid; + public int[] recycleChances; + public String tooltip; + public Fuel_(String sName, String sEnglish, ItemStack mainItem, ItemStack secondaryItem, FluidStack recycledFluid, ItemStack[] recycledItems, int[] recycleChances, String tooltip){ + this.sName = sName; + this.sEnglish = sEnglish; + this.mainItem = mainItem; + this.secondaryItem = secondaryItem; + this.recycledFluid = recycledFluid; + for(int i = 0; i < recycledItems.length; i++) + this.recycledItems[i] = recycledItems[i]; + this.recycleChances = recycleChances; + this.tooltip = tooltip; + } + } + private static class LangEntry_{ + public String sName; + public String sEnglish; + public LangEntry_(String a, String b){ + this.sName = a; + this.sEnglish = b; + } + } + + static final Base_[] sHTGR_Bases = new Base_[]{ + new Base_("HTGRFuelMixture", "HTGR fuel mixture"), + new Base_("BISOPebbleCompound", "BISO pebble compound"), + new Base_("TRISOPebbleCompound", "TRISO pebble compound"), + new Base_("TRISOBall", "TRISO ball"), + new Base_("TRISOPebble", "TRISO pebble"), + new Base_("BurnedOutTRISOBall", "Burned out TRISO Ball"), + new Base_("BurnedOutTRISOPebble", "Burned out TRISO Pebble"), + }; + static final int MATERIALS_PER_FUEL = sHTGR_Bases.length; + static final int USABLE_FUEL_INDEX = 4; + static final int BURNED_OUT_FUEL_INDEX = 5; + static final Fuel_[] sHTGR_Fuel = new Fuel_[]{ + new Fuel_("Thorium", "Thorium", WerkstoffLoader.Thorium232.get(OrePrefixes.dust, 64), Materials.Uranium235.getDust(4), + GT_Values.NF, new ItemStack[]{ + Materials.Silicon.getDust(1), Materials.Graphite.getDust(1), Materials.Carbon.getDust(1), + Materials.Lutetium.getDust(1), WerkstoffLoader.Thorium232.get(OrePrefixes.dust,1)}, + new int[]{9000, 9000, 9000, 9000, 1000}, "Multiplies coolant by 1"), + new Fuel_("Uranium", "Uranium", Materials.Uranium.getDust(64), Materials.Uranium235.getDust(8), + FluidRegistry.getFluidStack("krypton", 8), new ItemStack[]{ + Materials.Silicon.getDust(1), Materials.Graphite.getDust(1), Materials.Carbon.getDust(1), + Materials.Lead.getDust(1), + Materials.Uranium.getDust(1)}, + new int[]{9000, 9000, 9000, 7000, 1000}, "Multiplies coolant by 1.5"), + new Fuel_("Plutonium", "Plutonium", Materials.Plutonium.getDust(64), Materials.Plutonium241.getDust(4), + FluidRegistry.getFluidStack("xenon", 8), new ItemStack[]{ + Materials.Silicon.getDust(1), Materials.Graphite.getDust(1), Materials.Carbon.getDust(1), + Materials.Lead.getDust(1), + Materials.Plutonium.getDust(1)}, + new int[]{9000, 9000, 9000, 7000, 1000}, "Multiplies coolant by 2"), + }; + static final CustomHTGRSimpleSubItemClass aHTGR_Materials; + static final ArrayList<LangEntry_> aHTGR_Localizations = new ArrayList<LangEntry_>(); + static{ |
