From 08ad5094dcc34bd44831ef39f595cb03baf0a7bd Mon Sep 17 00:00:00 2001 From: OL925 Date: Sat, 17 Aug 2024 00:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8Onetick=E6=A8=A1=E5=BC=8F=E4=B8=AD?= =?UTF-8?q?=E5=AF=B9=E9=B8=BF=E8=92=99=E4=B9=8B=E7=9C=BC=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BA=86=E4=BF=AE=E6=94=B9=20=E5=8C=85?= =?UTF-8?q?=E6=8B=AC=EF=BC=9A=20=E8=BF=90=E8=A1=8C=E6=97=B6=E9=97=B4=201ti?= =?UTF-8?q?ck;=200L=E6=B0=A2&=E6=B0=A6=E9=9C=80=E6=B1=82;=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=88=90=E5=8A=9F=E6=A6=82=E7=8E=87=E4=B8=BA500%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GTNHModify/strategies/OneTick.java | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java b/src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java index b7b728d..6eddff1 100644 --- a/src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java +++ b/src/main/java/com/github/wohaopa/GTNHModify/strategies/OneTick.java @@ -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) {} + } + } } }