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

Commit

Permalink
在Onetick模式中对鸿蒙之眼配方进行了修改 包括: 运行时间 1tick; 0L氢&氦需求; 基础成功概率为500%
Browse files Browse the repository at this point in the history
  • Loading branch information
Ol925 committed Aug 16, 2024
1 parent e7ad691 commit 08ad509
Showing 1 changed file with 68 additions and 11 deletions.
79 changes: 68 additions & 11 deletions src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,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;

} catch (NoSuchFieldException ignored) {}
// 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) {}
}
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) {}
}
}
}

}

0 comments on commit 08ad509

Please sign in to comment.