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

在Onetick模式中加入有关鸿蒙配方修改的新功能 #9

Closed
wants to merge 5 commits into from
Closed
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
20 changes: 9 additions & 11 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.27-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.19-GTNH:dev")

implementation("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.168:dev")
implementation("com.github.GTNewHorizons:GT5-Unofficial:5.09.48.128:dev")

implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
implementation("com.github.GTNewHorizons:Botania:1.10.12-GTNH:dev")
implementation("com.github.GTNewHorizons:GTNEIOrePlugin:1.3.0:dev")
compileOnly("com.github.GTNewHorizons:GTNH-Intergalactic:1.3.4:dev")
implementation("com.github.GTNewHorizons:Botania:1.11.3-GTNH:dev")
implementation("com.github.GTNewHorizons:GTNEIOrePlugin:1.3.2:dev")

compileOnly("com.github.GTNewHorizons:TecTech:5.3.45:dev")
implementation("com.github.GTNewHorizons:GTNH-Intergalactic:1.4.6:dev")
implementation("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.90-GTNH:dev")

// runtimeOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-352-GTNH:dev")
// runtimeOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.2.28-gtnh:dev")
// runtimeOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-423-GTNH:dev")
// runtimeOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.21-gtnh:dev")
runtimeOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev")
runtimeOnly("com.github.GTNewHorizons:waila:1.7.3:dev")


runtimeOnly("com.github.GTNewHorizons:waila:1.8.1:dev")
}
14 changes: 12 additions & 2 deletions 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 =

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

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 Expand Up @@ -180,4 +191,3 @@ customArchiveBaseName = GTNH-WanNing
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

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
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
}
84 changes: 72 additions & 12 deletions src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ public class OneTick extends Strategy {

@Override
public void handler_GT_Recipe(GT_Recipe gtRecipe) {
gtRecipe.mDuration = 1;
if (gtRecipe.getRecipeCategory().unlocalizedName.equals("gg.recipe.naquadah_reactor")) {
gtRecipe.mDuration *= 10;
} else gtRecipe.mDuration = 1;

}

@Override
Expand All @@ -28,22 +31,79 @@ public int handler_FurnaceProcessingTime(Object owner, int number) {
return 1;
}

private Field field;
private Field miningTimeSecondsField;
private Field hydrogenRequirementField;
private Field heliumRequirementField;
private Field baseSuccessChanceField;

public void handler_EyeOfHarmonyRecipe(EyeOfHarmonyRecipe eyeOfHarmonyRecipe) {
if (field == null) {
try {
Class<?> clazz = EyeOfHarmonyRecipe.class;
field = clazz.getDeclaredField("miningTimeSeconds");
field.setAccessible(true);
Class<?> clazz = EyeOfHarmonyRecipe.class;

// miningTimeSeconds
{
if (miningTimeSecondsField == null) {
try {
miningTimeSecondsField = clazz.getDeclaredField("miningTimeSeconds");
miningTimeSecondsField.setAccessible(true);
} catch (NoSuchFieldException ignored) {}
}
if (miningTimeSecondsField != null) {
try {
miningTimeSecondsField.setLong(eyeOfHarmonyRecipe, 1);
} catch (IllegalAccessException ignored) {}
}
}

// hydrogenRequirement
{
if (hydrogenRequirementField == null) {
try {
hydrogenRequirementField = clazz.getDeclaredField("hydrogenRequirement");
hydrogenRequirementField.setAccessible(true);

} catch (NoSuchFieldException ignored) {}
}
if (hydrogenRequirementField != null) {
try {
long hydrogenRequirement = hydrogenRequirementField.getLong(eyeOfHarmonyRecipe);
hydrogenRequirementField.setLong(eyeOfHarmonyRecipe, 0);
} catch (IllegalAccessException ignored) {}
}
}

// heliumRequirement
{
if (heliumRequirementField == null) {
try {
heliumRequirementField = clazz.getDeclaredField("heliumRequirement");
heliumRequirementField.setAccessible(true);

} catch (NoSuchFieldException ignored) {}
} catch (NoSuchFieldException ignored) {}
}
if (heliumRequirementField != null) {
try {
long heliumRequirement = heliumRequirementField.getLong(eyeOfHarmonyRecipe);
heliumRequirementField.setLong(eyeOfHarmonyRecipe, 0);
} catch (IllegalAccessException ignored) {}
}
}
try {
if (field != null) {
field.setLong(eyeOfHarmonyRecipe, 1);

// baseSuccessChance
{
if (baseSuccessChanceField == null) {
try {
baseSuccessChanceField = clazz.getDeclaredField("baseSuccessChance");
baseSuccessChanceField.setAccessible(true);

} catch (NoSuchFieldException ignored) {}
}
} catch (IllegalAccessException ignored) {}
if (baseSuccessChanceField != null) {
try {
double baseSuccessChance = baseSuccessChanceField.getDouble(eyeOfHarmonyRecipe);
baseSuccessChanceField.setDouble(eyeOfHarmonyRecipe, 5);
} catch (IllegalAccessException ignored) {}
}
}
}

}