From a22840c67691d17234eb4643e3759cd03d812c05 Mon Sep 17 00:00:00 2001 From: kuba6000 Date: Mon, 13 Sep 2021 16:38:43 +0200 Subject: Change mass calculation to match gregtech way Former-commit-id: 3eda8c976662f213eeb4bee572c21a0eee09de0e --- .../github/bartimaeusnek/bartworks/system/material/Werkstoff.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java index 107dec62c6..f66b598788 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java @@ -211,14 +211,18 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer { } if (this.stats.mass == 0) { long tmpmass = 0; + int count = 0; for (Pair p : contents) { if (p.getKey() instanceof Materials) { tmpmass += ((Materials) p.getKey()).getMass() * p.getValue(); + count += p.getValue(); } else if (p.getKey() instanceof Werkstoff) { tmpmass += ((Werkstoff) p.getKey()).getStats().mass * p.getValue(); + count += p.getValue(); } } - this.stats = stats.setMass(tmpmass); + if(count > 0) + this.stats = stats.setMass(tmpmass/count); } if (this.stats.meltingPoint == 0) -- cgit