Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
HTGR Buffing (#193)
Browse files Browse the repository at this point in the history
* Buff htgr

* More buff + Fake recipe map

* fix

* spotlessApply (#194)

Co-authored-by: Jakub <[email protected]>
Co-authored-by: GitHub GTNH Actions <>

* bw

* Fix

* Bigger buff, fixes

* Fix insane time

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Former-commit-id: eb255c885d901d1d541ad694e022aa96d002d202
  • Loading branch information
kuba6000 and github-actions[bot] authored Aug 29, 2022
1 parent 6d924ce commit 579b4f7
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
/*
* Copyright (c) 2018-2020 bartimaeusnek
* Copyright (C) 2022 kuba6000
*
* 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:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.github.bartimaeusnek.bartworks.common.tileentities.multis;
Expand Down Expand Up @@ -50,6 +45,7 @@
import gregtech.api.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -239,6 +235,22 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
// GregTech_API.sBlockCasings8, 5))
.build();

public static final GT_Recipe.GT_Recipe_Map fakeRecipeMap = new GT_Recipe.GT_Recipe_Map(
new HashSet<>(),
"bw.recipe.htgr",
"High Temperature Gas-cooled Reactor",
null,
"gregtech:textures/gui/basicmachines/Default",
1,
1,
1,
0,
1,
"",
1,
"",
false,
false);
private static final int HELIUM_NEEDED = 730000;
private static final int powerUsage = BW_Util.getMachineVoltageFromTier(6);
private static final int maxcapacity = 720000;
Expand Down Expand Up @@ -273,11 +285,13 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
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("You can clear internal buffer by changing the mode with a screwdriver")
.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("Consumes up to 2.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("and affects total recipe time (at 100% eff, -50% total recipe time")
.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")
Expand Down Expand Up @@ -344,18 +358,19 @@ public void saveNBTData(NBTTagCompound aNBT) {
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide() && !this.empty) {
boolean updateneeded = false;
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;
updateneeded = true;
}
}
}
if (this.fuelsupply < maxcapacity) {

for (ItemStack itemStack : this.getStoredInputs()) {
int type = -1;
if (itemStack == null) continue;
Expand All @@ -369,9 +384,10 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize);
this.fuelsupply += toget;
itemStack.stackSize -= toget;
updateneeded = true;
}
this.updateSlots();
}
if (updateneeded) this.updateSlots();
}
}

Expand All @@ -393,7 +409,7 @@ public boolean checkRecipe(ItemStack controllerStack) {

if (eff <= 0) return false;

int toReduce = MathUtils.floorInt((double) this.fuelsupply * 0.005D * eff);
int toReduce = MathUtils.floorInt((double) this.fuelsupply * 0.025D * eff);

this.fuelsupply -= toReduce;
int burnedballs = toReduce / 64;
Expand All @@ -411,8 +427,9 @@ public boolean checkRecipe(ItemStack controllerStack) {
this.coolanttaking = (int) (4000D * (((this.fueltype * 0.5D) + 1)) * eff);

this.mEfficiency = (int) (eff * 10000D);
this.mEfficiencyIncrease = 0;
this.mEUt = -powerUsage;
this.mMaxProgresstime = 72000;
this.mMaxProgresstime = (int) (72000 * (1d - (eff / 2d)));
return true;
}

Expand Down Expand Up @@ -458,9 +475,11 @@ public boolean onRunningTick(ItemStack aStack) {
}
return true;
}

if (!super.onRunningTick(aStack)) // USE DA POWAH
return false;
// USE DA POWAH
if (!drainEnergyInput(-mEUt)) {
criticalStopMachine();
return false;
}

if (runningtick % 20 == 0) {
int takecoolant = coolanttaking;
Expand Down Expand Up @@ -604,18 +623,10 @@ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List a
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;
}
}

Expand Down Expand Up @@ -645,7 +656,7 @@ public Fuel_(
this.mainItem = mainItem;
this.secondaryItem = secondaryItem;
this.recycledFluid = recycledFluid;
for (int i = 0; i < recycledItems.length; i++) this.recycledItems[i] = recycledItems[i];
System.arraycopy(recycledItems, 0, this.recycledItems, 0, recycledItems.length);
this.recycleChances = recycleChances;
this.tooltip = tooltip;
}
Expand Down Expand Up @@ -687,45 +698,45 @@ public LangEntry_(String a, String b) {
Materials.Lutetium.getDust(1),
WerkstoffLoader.Thorium232.get(OrePrefixes.dust, 1)
},
new int[] {9000, 9000, 9000, 9000, 1000},
new int[] {9900 / 4, 9900 / 4, 9900 / 4, 9900 / 4, 162 / 4},
"Multiplies coolant by 1"),
new Fuel_(
"Uranium",
"Uranium",
Materials.Uranium.getDust(64),
Materials.Uranium235.getDust(8),
FluidRegistry.getFluidStack("krypton", 8),
FluidRegistry.getFluidStack("krypton", 4),
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},
new int[] {9900 / 4, 9900 / 4, 9900 / 4, 5000 / 4, 5000 / 4},
"Multiplies coolant by 1.5"),
new Fuel_(
"Plutonium",
"Plutonium",
Materials.Plutonium.getDust(64),
Materials.Plutonium241.getDust(4),
FluidRegistry.getFluidStack("xenon", 8),
FluidRegistry.getFluidStack("xenon", 4),
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},
new int[] {9900 / 4, 9900 / 4, 9900 / 4, 5000 / 4, 5000 / 4},
"Multiplies coolant by 2"),
};
static final CustomHTGRSimpleSubItemClass aHTGR_Materials;
static final ArrayList<LangEntry_> aHTGR_Localizations = new ArrayList<LangEntry_>();
static final ArrayList<LangEntry_> aHTGR_Localizations = new ArrayList<>();

static {
String[] sHTGR_Materials = new String[sHTGR_Bases.length * sHTGR_Fuel.length];
HashMap<Integer, String> tooltip = new HashMap<Integer, String>();
HashMap<Integer, String> tooltip = new HashMap<>();
int i = 0;
for (Fuel_ fuel : sHTGR_Fuel)
for (Base_ base : sHTGR_Bases) {
Expand All @@ -734,7 +745,7 @@ public LangEntry_(String a, String b) {
"item." + sHTGR_Materials[i] + ".name", base.sEnglish + " (" + fuel.sEnglish + ")"));
if (((i + 1) % MATERIALS_PER_FUEL == (USABLE_FUEL_INDEX + 1))
&& fuel.tooltip != null
&& fuel.tooltip != "") tooltip.put(i, fuel.tooltip);
&& !fuel.tooltip.isEmpty()) tooltip.put(i, fuel.tooltip);
i++;
}
aHTGR_Materials = new CustomHTGRSimpleSubItemClass(tooltip, sHTGR_Materials);
Expand All @@ -750,23 +761,20 @@ public static void registerTHR_Recipes() {
GT_Values.RA.addAssemblerRecipe(
new ItemStack[] {
new ItemStack(GregTech_API.sBlockCasings3, 1, 12),
GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 6),
GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Europium, 6),
GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Europium, 24)
},
Materials.Lead.getMolten(1296),
Materials.Lead.getMolten(864),
new ItemStack(GregTech_API.sBlockCasings8, 1, 5),
200,
BW_Util.getMachineVoltageFromTier(6));
int i = 0;
for (Fuel_ fuel : sHTGR_Fuel) {
GT_Values.RA.addMixerRecipe(
fuel.mainItem,
fuel.secondaryItem,
GT_Utility.getIntegratedCircuit(1),
null,
new ItemStack[] {fuel.mainItem, fuel.secondaryItem, GT_Utility.getIntegratedCircuit(1)},
null,
new ItemStack[] {new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 1, i)},
null,
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 1, i),
400,
30);
GT_Values.RA.addFormingPressRecipe(
Expand All @@ -793,12 +801,17 @@ public static void registerTHR_Recipes() {
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 1, i + 3),
GT_Utility.getIntegratedCircuit(17)
},
new ItemStack[] {new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4)},
new ItemStack[] {
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4),
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4),
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4),
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4)
},
null,
null,
null,
null,
32000,
12000,
30,
0);
GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.addRecipe(
Expand All @@ -812,9 +825,19 @@ public static void registerTHR_Recipes() {
null,
null,
null,
48000,
3000,
30,
0);
fakeRecipeMap.addFakeRecipe(
false,
new ItemStack[] {new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 64, i + 4)},
new ItemStack[] {new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 1, i + 5)},
null,
null,
null,
72000,
powerUsage,
0);
GT_Values.RA.addCentrifugeRecipe(
new ItemStack(GT_TileEntity_HTGR.HTGRMaterials.aHTGR_Materials, 1, i + 6),
GT_Values.NI,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.bartimaeusnek.bartworks.neiHandler;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import com.github.bartimaeusnek.bartworks.MainMod;
import cpw.mods.fml.common.event.FMLInterModComms;
import gregtech.api.util.GT_Recipe;
import gregtech.nei.GT_NEI_DefaultHandler;

public class BW_NEI_HTGRHandler extends GT_NEI_DefaultHandler {
public BW_NEI_HTGRHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) {
super(aRecipeMap);
if (!NEI_BW_Config.sIsAdded) {
FMLInterModComms.sendRuntimeMessage(
MainMod.instance,
"NEIPlugins",
"register-crafting-handler",
"bartworks@" + this.getRecipeName() + "@" + this.getOverlayIdentifier());
GuiCraftingRecipe.craftinghandlers.add(this);
GuiUsageRecipe.usagehandlers.add(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
package com.github.bartimaeusnek.bartworks.neiHandler;

import com.github.bartimaeusnek.bartworks.MainMod;
import cpw.mods.fml.common.event.FMLInterModComms;
import net.minecraft.nbt.NBTTagCompound;

public class IMCForNEI {
public static void IMCSender() {
sendCatalyst("gt.recipe.largechemicalreactor", "gregtech:gt.blockmachines:13366", -10);
sendCatalyst("gt.recipe.craker", "gregtech:gt.blockmachines:13367", -10);
sendHandler("bw.recipe.htgr", "gregtech:gt.blockmachines:12791");
sendCatalyst("bw.recipe.htgr", "gregtech:gt.blockmachines:12791");
}

private static void sendHandler(String name, String block) {
NBTTagCompound aNBT = new NBTTagCompound();
aNBT.setString("handler", name);
aNBT.setString("modName", MainMod.NAME);
aNBT.setString("modId", MainMod.MOD_ID);
aNBT.setBoolean("modRequired", true);
aNBT.setString("itemName", block);
aNBT.setInteger("handlerHeight", 135);
aNBT.setInteger("handlerWidth", 166);
aNBT.setInteger("maxRecipesPerPage", 2);
aNBT.setInteger("yShift", 6);
FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT);
}

private static void sendCatalyst(String aName, String aStack, int aPriority) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github.bartimaeusnek.bartworks.MainMod;
import com.github.bartimaeusnek.bartworks.common.loaders.FluidLoader;
import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry;
import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_HTGR;
import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader;
import com.github.bartimaeusnek.bartworks.util.BWRecipes;
import gregtech.api.enums.OrePrefixes;
Expand Down Expand Up @@ -87,6 +88,7 @@ public void loadConfig() {
new BW_NEI_OreHandler();
new BW_NEI_BioVatHandler(BWRecipes.instance.getMappingsFor(BWRecipes.BACTERIALVATBYTE));
new BW_NEI_BioLabHandler(BWRecipes.instance.getMappingsFor(BWRecipes.BIOLABBYTE));
new BW_NEI_HTGRHandler(GT_TileEntity_HTGR.fakeRecipeMap);
NEI_BW_Config.sIsAdded = true;
}

Expand Down

0 comments on commit 579b4f7

Please sign in to comment.