Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove weak turbine cutoff #3739

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/main/java/gtPlusPlus/core/config/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class Configuration {

public static final Debug debug = new Debug();
public static final Machines machines = new Machines();
public static final Gregtech gregtech = new Gregtech();
public static final Features features = new Features();
public static final Visual visual = new Visual();
public static final Worldgen worldgen = new Worldgen();
Expand Down Expand Up @@ -49,14 +48,6 @@ public static class Machines {
public int boilerSteamPerSecond;
}

@Config.Comment("GregTech section")
public static class Gregtech {

@Config.Comment("Rotors below this durability will be removed, prevents NEI clutter. Minimum Durability is N * x, where N is the new value set and x is the turbine size, where 1 is Tiny and 4 is Huge. Set to 0 to disable.")
@Config.DefaultInt(25_500)
public int turbineCutoffBase;
}

@Config.Comment("Features section")
public static class Features {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ public static void postInit(FMLPostInitializationEvent postinit) {

public static void onLoadComplete(FMLLoadCompleteEvent event) {
HandlerGT.onLoadComplete(event);
RecipeRemovals.onLoadComplete();
}
}
92 changes: 0 additions & 92 deletions src/main/java/gtPlusPlus/recipes/RecipeRemovals.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
package gtPlusPlus.recipes;

import static gtPlusPlus.core.util.minecraft.MaterialUtils.getMaterialName;

import java.util.Collection;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import org.apache.commons.lang3.ArrayUtils;

import advsolar.common.AdvancedSolarPanel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Mods;
import gregtech.api.items.MetaGeneratedTool;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.util.GTRecipe;
import gregtech.common.items.MetaGeneratedTool01;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.config.Configuration;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;

Expand All @@ -28,80 +12,4 @@ public static void postInit() {
RecipeUtils.removeRecipeByOutput(ItemUtils.getSimpleStack(AdvancedSolarPanel.blockMolecularTransformer));
}
}

public static void onLoadComplete() {
removeCrudeTurbineRotors();
}

// Doesn't actually remove recipes, just hide them
private static void removeCrudeTurbineRotors() {
int aRemoved = 0;
int CUT = Configuration.gregtech.turbineCutoffBase;
Item aU;
Collection<GTRecipe> aAssRecipes = RecipeMaps.assemblerRecipes.getAllRecipes();
// 170, 172, 174, 176
if (!aAssRecipes.isEmpty()) {
for (GTRecipe aG : aAssRecipes) {
if (ArrayUtils.isNotEmpty(aG.mOutputs)) {
for (ItemStack aI : aG.mOutputs) {
if (aI == null) {
continue;
}
aU = aI.getItem();
if (aU == null) {
continue;
}
if (aU instanceof MetaGeneratedTool01) {
int aMeta = aI.getItemDamage();
// Found a Turbine
if (aMeta >= 170 && aMeta <= 176) {
int aCutoff;
String aType;
switch (aMeta) {
case 170 -> {
aCutoff = CUT;
aType = "Small ";
}
case 172 -> {
aCutoff = 2 * CUT;
aType = "";
}
case 174 -> {
aCutoff = 3 * CUT;
aType = "Large ";
}
default -> { // 176
aCutoff = 4 * CUT;
aType = "Huge ";
}
}
Materials aMainMaterial = MetaGeneratedTool.getPrimaryMaterial(aI);
Materials aSecondaryMaterial = MetaGeneratedTool.getSecondaryMaterial(aI);
long rotorDurabilityMax = MetaGeneratedTool.getToolMaxDamage(aI);
if (rotorDurabilityMax < aCutoff) {
Logger.WARNING(
"[Turbine Cleanup] " + getMaterialName(aMainMaterial)
+ " "
+ aType
+ "Turbines have "
+ rotorDurabilityMax
+ ", which is below the cutoff durability of "
+ aCutoff
+ ", disabling.");
aG.mEnabled = false;
aG.mHidden = true;
aG.mCanBeBuffered = false;
aRemoved++;
} else {
break;
}
}
}
}
}
}
}

Logger.INFO("Removed " + aRemoved + " useless Turbines.");
}
}
Loading