Skip to content

Commit

Permalink
Fixes for GTNH 2.7.0 (#16)
Browse files Browse the repository at this point in the history
* fixed problems for gtnh 2.7.0

- updated all the deps to latest.
- fixed problems caused by new gt.
- removed LargeTurbine tweaks and Rocket Fuel Recipe tweaks, because I don't know how to fix them.

* refactor the project structure

- moved mixin classes to mixin source set
- added Large Processing Factory (id: 860), untested!

* updates for v2.7.0

- updated tooltips in the machines added back by gtnn
- updated reversed recipe logic
- added the Large Processing Factory recipe
  • Loading branch information
Taskeren authored Dec 9, 2024
1 parent 6dc7835 commit 10ba3d0
Show file tree
Hide file tree
Showing 32 changed files with 865 additions and 542 deletions.
28 changes: 15 additions & 13 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,34 @@
dependencies {
// generated code start - DON'T CHANGE!
// CodeChickenCore
implementation("com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev")
implementation("com.github.GTNewHorizons:CodeChickenCore:1.3.10:dev")
// CodeChickenLib
implementation("com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev")
// implementation("com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev")
// Gregtech
implementation("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.163:dev")
implementation("com.github.GTNewHorizons:GT5-Unofficial:5.09.50.103:dev")
// GT++
implementation("com.github.GTNewHorizons:GTplusplus:1.11.58:dev")
// implementation("com.github.GTNewHorizons:GTplusplus:1.12.11:dev")
// GTNHLib
implementation("com.github.GTNewHorizons:GTNHLib:0.2.11:dev")
implementation("com.github.GTNewHorizons:GTNHLib:0.5.21:dev")
// NewHorizonsCore
implementation("com.github.GTNewHorizons:NewHorizonsCoreMod:2.3.50:dev")
implementation("com.github.GTNewHorizons:NewHorizonsCoreMod:2.6.88:dev")
// GoodGenerator
implementation("com.github.GTNewHorizons:GoodGenerator:0.8.22:dev")
// implementation("com.github.GTNewHorizons:GoodGenerator:0.9.5:dev")
// TecTech
implementation("com.github.GTNewHorizons:TecTech:5.3.45:dev")
// implementation("com.github.GTNewHorizons:TecTech:5.4.3:dev")
// Forestry
implementation("com.github.GTNewHorizons:ForestryMC:4.8.9:api") { transitive = false }
implementation("com.github.GTNewHorizons:ForestryMC:4.9.19:api") { transitive = false }
// Railcraft
implementation("com.github.GTNewHorizons:Railcraft:9.15.8:dev") { transitive = false }
implementation("com.github.GTNewHorizons:Railcraft:9.15.15:dev") { transitive = false }
// Buildcraft
implementation("com.github.GTNewHorizons:BuildCraft:7.1.39:dev") { transitive = false }
// EnderIO
implementation("com.github.GTNewHorizons:EnderIO:2.7.4:dev") { transitive = false }
implementation("com.github.GTNewHorizons:EnderIO:2.8.22:dev") { transitive = false }
// ProjectRed
implementation("com.github.GTNewHorizons:ProjectRed:4.9.5-GTNH:dev") { transitive = false }
implementation("com.github.GTNewHorizons:ProjectRed:4.10.5-GTNH:dev") { transitive = false }
// TinkerConstruct
implementation("com.github.GTNewHorizons:TinkersConstruct:1.11.15-GTNH:dev") { transitive = false }
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.16-GTNH:dev") { transitive = false }
// AppleCore
implementation("com.github.GTNewHorizons:AppleCore:3.3.4:api")
// generated code end
}
13 changes: 12 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = true

# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet = mixin

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false

Expand Down Expand Up @@ -108,9 +113,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true

# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.28'
}

include("depTools")
10 changes: 5 additions & 5 deletions src/main/java/cn/taskeren/gtnn/GTNN.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import cn.taskeren.gtnn.common.CommonProxy;
import cn.taskeren.gtnn.common.command.NoNerfCommand;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;
import net.minecraft.util.EnumChatFormatting;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(modid = GTNN.MOD_ID, name = GTNN.MOD_NAME, dependencies = GTNN.DEPENDENCIES)
public class GTNN {

public static Logger logger = LogManager.getFormatterLogger("GTNN");
public static Logger logger = LogManager.getLogger("GTNN");

static final String MOD_ID = "gtnn";
static final String MOD_NAME = "GT-NO-NERF";
Expand All @@ -36,9 +36,9 @@ public class GTNN {
public GTNN() {
}

public static boolean isLwjgl3ifyLoaded() {
return Loader.isModLoaded("Lwjgl3ify");
}
public static final String MOD_NAME_TOOLTIP = EnumChatFormatting.GOLD + "GTNH-NO-NERF";

public static final String NOT_DEPRECATED_TOOLTIP = EnumChatFormatting.GREEN + "Not Deprecated! Brought back by " + MOD_NAME_TOOLTIP + EnumChatFormatting.GREEN + "!";

@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package cn.taskeren.gtnn.mod.gt5u.util;
package cn.taskeren.gtnn;

import gregtech.api.interfaces.IItemContainer;
import gregtech.api.util.*;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;

import java.util.Locale;

import static gregtech.api.enums.GT_Values.NI;
import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.GTValues.NI;
import static gregtech.api.enums.GTValues.W;

public enum NNItemList implements IItemContainer {

Expand All @@ -25,6 +26,8 @@ public enum NNItemList implements IItemContainer {
Machine_UEV_Disassembler,
Machine_UIV_Disassembler,
Machine_UMV_Disassembler,

Machine_LargeProcessingFactory,
;

private ItemStack mStack;
Expand All @@ -41,28 +44,28 @@ public IItemContainer set(Item aItem) {
mHasNotBeenSet = false;
if(aItem == null) return this;
ItemStack aStack = new ItemStack(aItem, 1, 0);
mStack = GT_Utility.copyAmount(1, aStack);
mStack = GTUtility.copyAmount(1, aStack);
return this;
}

@Override
public IItemContainer set(ItemStack aStack) {
mHasNotBeenSet = false;
mStack = GT_Utility.copyAmount(1, aStack);
mStack = GTUtility.copyAmount(1, aStack);
return this;
}

@Override
public Item getItem() {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return null;
if(GTUtility.isStackInvalid(mStack)) return null;
return mStack.getItem();
}

@Override
public Block getBlock() {
sanityCheck();
return GT_Utility.getBlockFromItem(getItem());
return GTUtility.getBlockFromItem(getItem());
}

@Override
Expand All @@ -78,48 +81,58 @@ public boolean isStackEqual(Object aStack) {
@Override
public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) {
if(mDeprecated && !mWarned) {
new Exception(this + " is now deprecated").printStackTrace(GT_Log.err);
new Exception(this + " is now deprecated").printStackTrace(GTLog.err);
// warn only once
mWarned = true;
}
if(!(aStack instanceof ItemStack stack) || GT_Utility.isStackInvalid(stack)) return false;
return GT_Utility.areUnificationsEqual((ItemStack) aStack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT);
if(!(aStack instanceof ItemStack stack) || GTUtility.isStackInvalid(stack)) return false;
return GTUtility.areUnificationsEqual(stack, aWildcard ? getWildcard(1) : get(1), aIgnoreNBT);
}

@Override
public ItemStack get(long aAmount, Object... aReplacements) {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount((int) aAmount, aReplacements);
return GT_Utility.copyAmount((int) aAmount, GT_OreDictUnificator.get(mStack));
if(GTUtility.isStackInvalid(mStack)) return GTUtility.copyAmount(aAmount, aReplacements);
return GTUtility.copyAmount((int) aAmount, GTOreDictUnificator.get(mStack));
}

@Override
public ItemStack getWildcard(long aAmount, Object... aReplacements) {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount((int) aAmount, aReplacements);
return GT_Utility.copyAmountAndMetaData((int) aAmount, W, GT_OreDictUnificator.get(mStack));
if(GTUtility.isStackInvalid(mStack)) return GTUtility.copyAmount(aAmount, aReplacements);
return GTUtility.copyAmountAndMetaData((int) aAmount, W, GTOreDictUnificator.get(mStack));
}

@Override
public ItemStack getUndamaged(long aAmount, Object... aReplacements) {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount((int) aAmount, aReplacements);
return GT_Utility.copyAmountAndMetaData((int) aAmount, 0, GT_OreDictUnificator.get(mStack));
if(GTUtility.isStackInvalid(mStack)) return GTUtility.copyAmount(aAmount, aReplacements);
return GTUtility.copyAmountAndMetaData((int) aAmount, 0, GTOreDictUnificator.get(mStack));
}

@Override
public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount((int) aAmount, aReplacements);
return GT_Utility.copyAmountAndMetaData((int) aAmount, mStack.getMaxDamage() - 1, GT_OreDictUnificator.get(mStack));
if(GTUtility.isStackInvalid(mStack)) return GTUtility.copyAmount(aAmount, aReplacements);
return GTUtility.copyAmountAndMetaData((int) aAmount, mStack.getMaxDamage() - 1, GTOreDictUnificator.get(mStack));
}

@Override
public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) {
ItemStack rStack = get(1, aReplacements);
if(GT_Utility.isStackInvalid(rStack)) return NI;
if(GTUtility.isStackInvalid(rStack)) return NI;

// CamelCase alphanumeric words from aDisplayName
String tCamelCasedDisplayNameBuilder = getCamelCaseDisplayName(aDisplayName);

// Construct a translation key from UnlocalizedName and CamelCased DisplayName
final String tKey = rStack.getUnlocalizedName() + ".with." + tCamelCasedDisplayNameBuilder + ".name";

rStack.setStackDisplayName(GTLanguageManager.addStringLocalization(tKey, aDisplayName));
return GTUtility.copyAmount((int) aAmount, rStack);
}

private static @NotNull String getCamelCaseDisplayName(String aDisplayName) {
StringBuilder tCamelCasedDisplayNameBuilder = new StringBuilder();
final String[] tDisplayNameWords = aDisplayName.split("\\W");
for(String tWord : tDisplayNameWords) {
Expand All @@ -130,40 +143,35 @@ public ItemStack getWithName(long aAmount, String aDisplayName, Object... aRepla
// CamelCased DisplayName is empty, so use hash of aDisplayName
tCamelCasedDisplayNameBuilder.append(((Long) (long) aDisplayName.hashCode()));
}

// Construct a translation key from UnlocalizedName and CamelCased DisplayName
final String tKey = rStack.getUnlocalizedName() + ".with." + tCamelCasedDisplayNameBuilder + ".name";

rStack.setStackDisplayName(GT_LanguageManager.addStringLocalization(tKey, aDisplayName));
return GT_Utility.copyAmount((int) aAmount, rStack);
return tCamelCasedDisplayNameBuilder.toString();
}

@Override
public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) {
ItemStack rStack = get(1, aReplacements);
if(GT_Utility.isStackInvalid(rStack)) return null;
GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false);
return GT_Utility.copyAmount((int) aAmount, rStack);
if(GTUtility.isStackInvalid(rStack)) return null;
GTModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false);
return GTUtility.copyAmount((int) aAmount, rStack);
}

@Override
public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) {
sanityCheck();
if(GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount((int) aAmount, aReplacements);
return GT_Utility.copyAmountAndMetaData((int) aAmount, aMetaValue, GT_OreDictUnificator.get(mStack));
if(GTUtility.isStackInvalid(mStack)) return GTUtility.copyAmount(aAmount, aReplacements);
return GTUtility.copyAmountAndMetaData(aAmount, aMetaValue, GTOreDictUnificator.get(mStack));
}

@Override
public IItemContainer registerOre(Object... aOreNames) {
sanityCheck();
for(Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1));
for(Object tOreName : aOreNames) GTOreDictUnificator.registerOre(tOreName, get(1));
return this;
}

@Override
public IItemContainer registerWildcardAsOre(Object... aOreNames) {
sanityCheck();
for(Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1));
for(Object tOreName : aOreNames) GTOreDictUnificator.registerOre(tOreName, getWildcard(1));
return this;
}

Expand All @@ -179,7 +187,7 @@ private void sanityCheck() {
if(mHasNotBeenSet)
throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
if(mDeprecated && !mWarned) {
new Exception(this + " is now deprecated").printStackTrace(GT_Log.err);
new Exception(this + " is now deprecated").printStackTrace(GTLog.err);
// warn only once
mWarned = true;
}
Expand Down
Loading

0 comments on commit 10ba3d0

Please sign in to comment.