Skip to content

Commit e920407

Browse files
committed
Minor refactor, add AE2 to dev environment
1 parent c6674d3 commit e920407

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ repositories {
6969
maven {
7070
url = "https://thedarkcolour.github.io/KotlinForForge/"
7171
}
72+
maven {
73+
name "Modmaven"
74+
url "https://modmaven.dev/"
75+
// For Gradle 5.1 and above, limit it to just AE2
76+
content {
77+
includeGroup 'appeng'
78+
}
79+
}
7280
}
7381

7482
version = mod_version
@@ -123,6 +131,7 @@ dependencies {
123131
implementation fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
124132
implementation fg.deobf("dev.toma.configuration:configuration-forge-${minecraft_version}:${configuration_version}")
125133
runtimeOnly fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
134+
implementation fg.deobf("appeng:appliedenergistics2-forge:${appeng_version}")
126135

127136

128137
// lombok

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ org.gradle.jvmargs=-Xmx1G
2121
mod_license=LGPLv3.0
2222

2323
# Dependencies
24+
appeng_version=15.0.18
2425
architectury_version=9.2.14
2526
gtceu_version=1.6.4
2627
ldlib_version=1.0.34

src/main/java/net/neganote/gtutilities/common/machine/multiblock/PTERBMachine.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.gregtechceu.gtceu.api.capability.IControllable;
44
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
55
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
6+
import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability;
67
import com.gregtechceu.gtceu.api.capability.recipe.IO;
78
import com.gregtechceu.gtceu.api.gui.GuiTextures;
89
import com.gregtechceu.gtceu.api.gui.fancy.ConfiguratorPanel;
@@ -23,8 +24,6 @@
2324
import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate;
2425
import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient;
2526
import com.gregtechceu.gtceu.common.data.GTItems;
26-
import com.gregtechceu.gtceu.common.machine.multiblock.part.DualHatchPartMachine;
27-
import com.gregtechceu.gtceu.common.machine.multiblock.part.FluidHatchPartMachine;
2827
import com.gregtechceu.gtceu.config.ConfigHolder;
2928
import com.gregtechceu.gtceu.utils.FormattingUtil;
3029
import com.gregtechceu.gtceu.utils.GTUtil;
@@ -130,19 +129,19 @@ public void convertEnergyTick() {
130129
if (isWorkingEnabled() && getRecipeLogic().getStatus() == RecipeLogic.Status.WORKING &&
131130
UtilConfig.coolantEnabled() && coolantTimer == 0 && frequency != 0) {
132131

133-
MetaMachine coolantHatch = Objects
134-
.requireNonNull(getMachine(Objects.requireNonNull(getLevel()), coolantHatchPos));
132+
IMultiPart coolantHatch = Objects
133+
.requireNonNull((IMultiPart) getMachine(Objects.requireNonNull(getLevel()), coolantHatchPos));
135134

136-
NotifiableFluidTank tank;
135+
NotifiableFluidTank tank = null;
137136

138-
if (coolantHatch instanceof FluidHatchPartMachine fluidHatch) {
139-
tank = fluidHatch.tank;
140-
} else if (coolantHatch instanceof DualHatchPartMachine dualHatch) {
141-
tank = dualHatch.tank;
142-
} else {
143-
throw new IllegalStateException("Tank must be a valid fluid or dual input hatch");
137+
for (var handler : coolantHatch.getRecipeHandlers()) {
138+
if (handler instanceof NotifiableFluidTank notifiableFluidTank) {
139+
tank = notifiableFluidTank;
140+
}
144141
}
145142

143+
assert tank != null;
144+
146145
var ingredient = FluidIngredient.of(coolantDrain, UtilMaterials.QuantumCoolant.getFluid());
147146
List<FluidIngredient> left = tank.handleRecipe(IO.IN, null, List.of(ingredient), null, false);
148147
if (left != null && !left.isEmpty()) {
@@ -230,13 +229,6 @@ public void onStructureFormed() {
230229
Map<Long, IO> ioMap = getMultiblockState().getMatchContext().getOrCreate("ioMap", Long2ObjectMaps::emptyMap);
231230

232231
for (IMultiPart part : getPrioritySortedParts()) {
233-
if (part instanceof FluidHatchPartMachine machine) {
234-
this.coolantHatchPos = machine.getPos();
235-
continue;
236-
} else if (part instanceof DualHatchPartMachine machine) {
237-
this.coolantHatchPos = machine.getPos();
238-
continue;
239-
}
240232
IO io = ioMap.getOrDefault(part.self().getPos().asLong(), IO.BOTH);
241233
if (io == IO.NONE) continue;
242234
for (var handler : part.getRecipeHandlers()) {
@@ -252,6 +244,9 @@ public void onStructureFormed() {
252244
}
253245
traitSubscriptions.add(handler.addChangedListener(converterSubscription::updateSubscription));
254246
}
247+
if (handler.getCapability() == FluidRecipeCapability.CAP && handler instanceof NotifiableFluidTank) {
248+
this.coolantHatchPos = part.self().getPos();
249+
}
255250
}
256251
}
257252

@@ -436,6 +431,9 @@ public void setWorkingEnabled(boolean isWorkingAllowed) {
436431
removeWirelessEnergy();
437432
}
438433
}
434+
if (!isWorkingAllowed) {
435+
coolantTimer = 0;
436+
}
439437
}
440438

441439
@Override

0 commit comments

Comments
 (0)