From 960bdde963530ff4a400bb6aae7e61342b0d97da Mon Sep 17 00:00:00 2001 From: KujouShiori <651715794@qq.com> Date: Sat, 17 Oct 2026 18:37:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(pv/neuro-matrix):=20=E5=8A=A0=E4=B8=A4?= =?UTF-8?q?=E5=A4=84=E9=99=A4=E9=9B=B6=E5=AE=88=E5=8D=AB=E5=B9=B6=E5=BD=92?= =?UTF-8?q?=E6=AD=A3=E5=85=89=E4=BC=8F=20input=20=E5=9F=BA=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 基站的 PHOTOVOLTAIC_ASSEMBER 分支按 recipe.data 的 input 求并行比值,input 缺失时 getInt 返回 0,浮点除零得 +Infinity,(int) 收窄成 Integer.MAX_VALUE,并行基数取到上限且时长倍率压成约 4.6e-10;现在 input 不大于 0 时 parallel 固定 1.0,配方按原样跑一次 - 编译室 CalculateEquation 与 CalculateEquationNoise 直接除以 true_answer,range 缺失或过小时其为 0,比值成 NaN 或 Infinity,0.9 到 1.1 的成败判定恒假且非有限值经 putDouble("muti") 进 NBT;现在 true_answer 为 0 时返回 0.0 - 光伏装配三条配方的 input 取 131072 的 1、2、16 倍,与机器里 true_eut 的基准同一,1 : 2 : 16 的比率不变 - 现存 5 条 PHOTOVOLTAIC_ASSEMBER 配方 input 均大于 0,两条 COMPILER_RECIPE 的 range 均为 120,本提交只补守卫,不改既有配方行为 --- .../machine/multiblock/electric/NeuroMatrixCompiler.java | 3 +++ .../multiblock/electric/SpacePhotovoltaicBaseStation.java | 3 ++- .../io/github/cpearl0/ctnhcore/data/recipe/SunRecipes.java | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/NeuroMatrixCompiler.java b/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/NeuroMatrixCompiler.java index e5426aba..83d58616 100644 --- a/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/NeuroMatrixCompiler.java +++ b/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/NeuroMatrixCompiler.java @@ -155,6 +155,8 @@ public double CalculateEquationNoise(long Noise) { } answer += RawEquation.get(3); var fake_answer = (long) (answer + noise * Math.random()); + // true_answer 会因 range 缺失或过小而为 0,此处除法随之得 NaN 或 Infinity 并写进 NBT + if (true_answer == 0) return 0.0; return ((double) fake_answer / true_answer); } @@ -167,6 +169,7 @@ public double CalculateEquation(long Noise) { } answer += RawEquation.get(3); var fake_answer = (long) (answer + noise * Math.random()); + if (true_answer == 0) return 0.0; return ((double) answer / true_answer); } diff --git a/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/SpacePhotovoltaicBaseStation.java b/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/SpacePhotovoltaicBaseStation.java index 6b65fb0a..5446801b 100644 --- a/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/SpacePhotovoltaicBaseStation.java +++ b/src/main/java/io/github/cpearl0/ctnhcore/common/machine/multiblock/electric/SpacePhotovoltaicBaseStation.java @@ -162,7 +162,8 @@ public static Component recipeModifier(MetaMachine machine, RecipeHandlerGroup g var input = recipe.data.getInt("input"); var duration = 1.0; var true_eut = pmachine.muti * pmachine.heat * 131072 + EUt; - var parallel = Math.max((true_eut / input), 0.01); // 真实并行 + // 真实并行。配方漏写 input 时 getInt 返回 0,浮点除零得 Infinity,(int) 收窄成 Integer.MAX_VALUE,并行基数与时长倍率会一起失真 + var parallel = input > 0 ? Math.max(true_eut / input, 0.01) : 1.0; if (parallel < 1) { duration = 1 / (parallel * parallel); parallel = 1; diff --git a/src/main/java/io/github/cpearl0/ctnhcore/data/recipe/SunRecipes.java b/src/main/java/io/github/cpearl0/ctnhcore/data/recipe/SunRecipes.java index 407bacfc..9e5d00af 100644 --- a/src/main/java/io/github/cpearl0/ctnhcore/data/recipe/SunRecipes.java +++ b/src/main/java/io/github/cpearl0/ctnhcore/data/recipe/SunRecipes.java @@ -528,7 +528,7 @@ private static void photovoltaicAssemberRecipes(Consumer provide .inputItems(VOLTAGE_COIL_IV) .inputFluids(VanadiumGallium.getFluid(576)) .outputItems(CTNHBlocks.PV_COIL.asStack()) - .addData("input", 130712) + .addData("input", 131072) .duration(20) .save(provider); @@ -540,7 +540,7 @@ private static void photovoltaicAssemberRecipes(Consumer provide .inputItems(CRYSTAL_SYSTEM_ON_CHIP.asStack(8)) .inputFluids(Cryotheum.getFluid(8000)) .outputItems(CTNHItems.PV_DRONE_TIER1.asStack()) - .addData("input", 261424) + .addData("input", 262144) .duration(400) .save(provider); @@ -552,7 +552,7 @@ private static void photovoltaicAssemberRecipes(Consumer provide .inputItems(HIGHLY_ADVANCED_SOC_WAFER, 14) .inputFluids(Cryotheum.getFluid(28000)) .outputItems(CTNHItems.PV_DRONE_TIER2.asStack(), 7) - .addData("input", 2091392) + .addData("input", 2097152) .duration(400) .save(provider);