aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2022-08-29 06:39:02 +0200
committerGitHub <noreply@github.com>2022-08-29 06:39:02 +0200
commit0bd94a1cde3c333b36d832f4c4572cd3ab0f0985 (patch)
treee92ab93dcabce3a493d502a273b07421a1113ccd
parentb5fb58403e9feb92018a737b9b6a77c559c5eda7 (diff)
downloadGT5-Unofficial-0bd94a1cde3c333b36d832f4c4572cd3ab0f0985.tar.gz
GT5-Unofficial-0bd94a1cde3c333b36d832f4c4572cd3ab0f0985.tar.bz2
GT5-Unofficial-0bd94a1cde3c333b36d832f4c4572cd3ab0f0985.zip
HTGR Buffing (#193)
* Buff htgr * More buff + Fake recipe map * fix * spotlessApply (#194) Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com> 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: eb92fbdb92cce66cd32e6b51b46a0bfb2aed36a1
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java127
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_HTGRHandler.java23
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/IMCForNEI.java17
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/NEI_BW_Config.java2
4 files changed, 117 insertions, 52 deletions
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 6344ed5e6f..d2f174991d 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
@@ -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;
@@ -50,6 +45,7 @@ import gregtech.api.render.TextureFactory;
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;
@@ -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;
@@ -273,11 +285,13 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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")
@@ -344,18 +358,19 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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;
@@ -369,9 +384,10 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize);
this.fuelsupply += toget;
itemStack.stackSize -= toget;
+ updateneeded = true;
}
- this.updateSlots();
}
+ if (updateneeded) this.updateSlots();
}
}
@@ -393,7 +409,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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;
@@ -411,8 +427,9 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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;
}
@@ -458,9 +475,11 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
}
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;
@@ -604,18 +623,10 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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;
}
}
@@ -645,7 +656,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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;
}
@@ -687,14 +698,14 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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),
@@ -702,14 +713,14 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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),
@@ -717,15 +728,15 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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) {
@@ -734,7 +745,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
"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);
@@ -750,23 +761,20 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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(
@@ -793,12 +801,17 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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(
@@ -812,9 +825,19 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase
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,
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_HTGRHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_HTGRHandler.java
new file mode 100644
index 0000000000..56ad735bcd
--- /dev/null
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/BW_NEI_HTGRHandler.java
@@ -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);
+ }
+ }
+}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/IMCForNEI.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/IMCForNEI.java
index 8622f18462..ff7fc3f1d1 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/IMCForNEI.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/IMCForNEI.java
@@ -1,5 +1,6 @@
package com.github.bartimaeusnek.bartworks.neiHandler;
+import com.github.bartimaeusnek.bartworks.MainMod;
import cpw.mods.fml.common.event.FMLInterModComms;
import net.minecraft.nbt.NBTTagCompound;
@@ -7,6 +8,22 @@ 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) {
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/NEI_BW_Config.java b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/NEI_BW_Config.java
index fad6574627..55533b1c38 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/NEI_BW_Config.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/neiHandler/NEI_BW_Config.java
@@ -28,6 +28,7 @@ import codechicken.nei.api.IConfigureNEI;
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;
@@ -87,6 +88,7 @@ public class NEI_BW_Config implements IConfigureNEI {
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;
}