diff options
author | miozune <miozune@gmail.com> | 2023-05-11 18:15:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 11:15:30 +0200 |
commit | bd28732e96aed7e2c82321179486e8c4f6446a1a (patch) | |
tree | aafffbbe20405cff24115b35588344219eb25109 /src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java | |
parent | cfce34129865348958fd9bedf0b23719f831676b (diff) | |
download | GT5-Unofficial-bd28732e96aed7e2c82321179486e8c4f6446a1a.tar.gz GT5-Unofficial-bd28732e96aed7e2c82321179486e8c4f6446a1a.tar.bz2 GT5-Unofficial-bd28732e96aed7e2c82321179486e8c4f6446a1a.zip |
Remove Computer Cube MKII (#622)
Diffstat (limited to 'src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java')
-rw-r--r-- | src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java b/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java deleted file mode 100644 index 9a168bfa06..0000000000 --- a/src/main/java/Ic2ExpReactorPlanner/components/Exchanger.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. To change this template file, choose - * Tools | Templates and open the template in the editor. - */ -package Ic2ExpReactorPlanner.components; - -import java.util.ArrayList; -import java.util.List; - -import gregtech.api.objects.GT_ItemStack; - -/** - * Represents a heat exchanger of some sort in a reactor. - * - * @author Brian McCloud - */ -public class Exchanger extends ReactorItem { - - private final int switchSide; - private final int switchReactor; - - public Exchanger(final int id, final String baseName, GT_ItemStack aItem, final double maxDamage, - final double maxHeat, final String sourceMod, final int switchSide, final int switchReactor) { - super(id, baseName, aItem, maxDamage, maxHeat, sourceMod); - this.switchSide = switchSide; - this.switchReactor = switchReactor; - } - - public Exchanger(final Exchanger other) { - super(other); - this.switchSide = other.switchSide; - this.switchReactor = other.switchReactor; - } - - @Override - public void transfer() { - List<ReactorItem> heatableNeighbors = new ArrayList<>(4); - ReactorItem component = parent.getComponentAt(row, col - 1); - if (component != null && component.isHeatAcceptor()) { - heatableNeighbors.add(component); - } - component = parent.getComponentAt(row, col + 1); - if (component != null && component.isHeatAcceptor()) { - heatableNeighbors.add(component); - } - component = parent.getComponentAt(row - 1, col); - if (component != null && component.isHeatAcceptor()) { - heatableNeighbors.add(component); - } - component = parent.getComponentAt(row + 1, col); - if (component != null && component.isHeatAcceptor()) { - heatableNeighbors.add(component); - } - // Code adapted from decompiled IC2 code, class ItemReactorHeatSwitch, with permission from Thunderdark. - double myHeat = 0; - if (switchSide > 0) { - for (ReactorItem heatableNeighbor : heatableNeighbors) { - double mymed = getCurrentHeat() * 100.0 / getMaxHeat(); - double heatablemed = heatableNeighbor.getCurrentHeat() * 100.0 / heatableNeighbor.getMaxHeat(); - - double add = (int) (heatableNeighbor.getMaxHeat() / 100.0 * (heatablemed + mymed / 2.0)); - if (add > switchSide) { - add = switchSide; - } - if (heatablemed + mymed / 2.0 < 1.0) { - add = switchSide / 2; - } - if (heatablemed + mymed / 2.0 < 0.75) { - add = switchSide / 4; - } - if (heatablemed + mymed / 2.0 < 0.5) { - add = switchSide / 8; - } - if (heatablemed + mymed / 2.0 < 0.25) { - add = 1; - } - if (Math.round(heatablemed * 10.0) / 10.0 > Math.round(mymed * 10.0) / 10.0) { - add -= 2 * add; - } else if (Math.round(heatablemed * 10.0) / 10.0 == Math.round(mymed * 10.0) / 10.0) { - add = 0; - } - myHeat -= add; - if (add > 0) { - currentComponentHeating += add; - } - add = heatableNeighbor.adjustCurrentHeat(add); - myHeat += add; - } - } - if (switchReactor > 0) { - double mymed = getCurrentHeat() * 100.0 / getMaxHeat(); - double Reactormed = parent.getCurrentHeat() * 100.0 / parent.getMaxHeat(); - - int add = (int) Math.round(parent.getMaxHeat() / 100.0 * (Reactormed + mymed / 2.0)); - if (add > switchReactor) { - add = switchReactor; - } - if (Reactormed + mymed / 2.0 < 1.0) { - add = switchSide / 2; - } - if (Reactormed + mymed / 2.0 < 0.75) { - add = switchSide / 4; - } - if (Reactormed + mymed / 2.0 < 0.5) { - add = switchSide / 8; - } - if (Reactormed + mymed / 2.0 < 0.25) { - add = 1; - } - if (Math.round(Reactormed * 10.0) / 10.0 > Math.round(mymed * 10.0) / 10.0) { - add -= 2 * add; - } else if (Math.round(Reactormed * 10.0) / 10.0 == Math.round(mymed * 10.0) / 10.0) { - add = 0; - } - myHeat -= add; - parent.adjustCurrentHeat(add); - if (add > 0) { - currentHullHeating = add; - } else { - currentHullCooling = -add; - } - } - adjustCurrentHeat(myHeat); - } - - @Override - public double getHullCoolingCapacity() { - return switchReactor; - } -} |