Skip to content

Commit 5a32933

Browse files
committed
Updated to Latest AE
1 parent 83cdc79 commit 5a32933

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ repositories {
106106
}
107107

108108
dependencies {
109-
minecraft 'net.minecraftforge:forge:1.20.1-47.0.3'
109+
minecraft 'net.minecraftforge:forge:1.20.1-47.1.43'
110110
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
111111
runtimeOnly fg.deobf("mezz.jei:jei-1.20.1-forge:15.0.0.12")
112-
compileOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.2-alpha")
113-
runtimeOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.2-alpha")
112+
compileOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.9-beta")
113+
runtimeOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.9-beta")
114114
}
115115

116116
jar {
@@ -208,7 +208,7 @@ modrinth {
208208
gameVersions = ["1.20.1"]
209209
loaders = ["forge"]
210210
dependencies {
211-
required.version "ae2", "forge-15.0.2-alpha"
211+
required.version "ae2", "forge-15.0.9-beta"
212212
}
213213
}
214214

src/main/java/uk/co/hexeption/aeinfinitybooster/mixins/MixinWirelessTerminalMenuHost.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
import appeng.api.implementations.blockentities.IWirelessAccessPoint;
44
import appeng.api.implementations.menuobjects.ItemMenuHost;
5+
import appeng.api.networking.IGrid;
56
import appeng.blockentity.networking.WirelessAccessPointBlockEntity;
67
import appeng.helpers.WirelessTerminalMenuHost;
78
import net.minecraft.world.entity.player.Player;
89
import net.minecraft.world.item.ItemStack;
10+
import org.spongepowered.asm.mixin.Final;
911
import org.spongepowered.asm.mixin.Mixin;
1012
import org.spongepowered.asm.mixin.Shadow;
1113
import org.spongepowered.asm.mixin.injection.At;
1214
import org.spongepowered.asm.mixin.injection.Inject;
15+
import org.spongepowered.asm.mixin.injection.Redirect;
1316
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1417
import uk.co.hexeption.aeinfinitybooster.setup.ModItems;
1518

@@ -25,18 +28,20 @@ public class MixinWirelessTerminalMenuHost extends ItemMenuHost {
2528
@Shadow
2629
private double currentDistanceFromGrid;
2730

31+
@Shadow @Final private IGrid targetGrid;
32+
2833
public MixinWirelessTerminalMenuHost(Player player, int slot, ItemStack itemStack) {
2934
super(player, slot, itemStack);
3035
}
3136

32-
@Inject(method = "testWap", at = @At("HEAD"), cancellable = true)
33-
private void testWap(IWirelessAccessPoint wirelessAccessPoint, CallbackInfoReturnable<Boolean> cir) {
37+
@Inject(method = "getWapSqDistance", at = @At("HEAD"), cancellable = true)
38+
private void testWap(IWirelessAccessPoint wirelessAccessPoint, CallbackInfoReturnable<Double> cir) {
3439

3540
wirelessAccessPoint.getGrid().getMachines(WirelessAccessPointBlockEntity.class).forEach(wirelessBlockEntity -> {
3641

3742
if (wirelessBlockEntity.getInternalInventory().getStackInSlot(0).is(ModItems.DIMENSION_CARD.get())) {
3843
currentDistanceFromGrid = 32;
39-
cir.setReturnValue(true);
44+
cir.setReturnValue(Double.MAX_VALUE / 2);
4045
}
4146

4247
if (!this.getPlayer().level().dimension().location().toString().equals(wirelessAccessPoint.getLocation().getLevel().dimension().location().toString())) {
@@ -45,9 +50,23 @@ private void testWap(IWirelessAccessPoint wirelessAccessPoint, CallbackInfoRetur
4550

4651
if (wirelessBlockEntity.getInternalInventory().getStackInSlot(0).is(ModItems.INFINITY_CARD.get())) {
4752
currentDistanceFromGrid = 16;
48-
cir.setReturnValue(true);
53+
cir.setReturnValue(Double.MAX_VALUE / 2);
4954
}
5055
});
5156
}
5257

58+
// Make sure we don't use more power than we should
59+
@Redirect(method = "extractAEPower", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(DD)D"))
60+
private double testPowerMultiplier(double a, double b) {
61+
for (var wap : this.targetGrid.getMachines(WirelessAccessPointBlockEntity.class)) {
62+
if (wap.getInternalInventory().getStackInSlot(0).is(ModItems.INFINITY_CARD.get())) {
63+
return 16;
64+
}
65+
if (wap.getInternalInventory().getStackInSlot(0).is(ModItems.DIMENSION_CARD.get())) {
66+
return 32;
67+
}
68+
}
69+
return Math.min(a, b);
70+
}
71+
5372
}

src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ordering = "NONE"
2222
side = "BOTH"
2323
[[dependencies.aeinfinitybooster]]
2424
modId = "ae2"
25-
versionRange = "[15.0.2-alpha,)"
25+
versionRange = "[15.0.9-beta,)"
2626
mandatory = true
2727
ordering = "AFTER"
2828
side = "BOTH"

0 commit comments

Comments
 (0)