Hexeption / AEInfinityBooster

https://www.curseforge.com/minecraft/mc-mods/aeinfinitybooster
GNU Lesser General Public License v3.0
4 stars 14 forks source link

Mod causing crash upon launch #12

Closed sicklyFoxJay closed 1 year ago

sicklyFoxJay commented 1 year ago

latest.log AE Infinity Booster crashes on start up with ae2 installed. It seems to be running into an error due to the injection method of MixinWirelessTerminalHost.java . This is on forge v47.1.0. Not sure if the issue has to do with ae2 itself and the mixin file error is a byproduct, or if the mixin file error is the only issue, but ae2, with it's dependencies, seems to work fine. I've included my log file for the crash.

ErythroCraft commented 1 year ago

Same

ErythroCraft commented 1 year ago

What does "testmap" mean. Why searching for testmap?

sicklyFoxJay commented 1 year ago

Sorry it was supposed to say "testwap". The log repeated issues with that several times after multiple attempts to launch with ae2.

On Sat, Aug 5, 2023, 11:58 AM Markus Günzler @.***> wrote:

What does "testmap" mean. Why searching for testmap?

— Reply to this email directly, view it on GitHub https://github.com/Hexeption/AEInfinityBooster/issues/12#issuecomment-1666554097, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBXTEBIRIGTZDP7HF7TNVWLXTZ3T3ANCNFSM6AAAAAA3FIKDXA . You are receiving this because you authored the thread.Message ID: @.***>

ErythroCraft commented 1 year ago

Yes. Sorry testWap

sicklyFoxJay commented 1 year ago

Yes. Sorry testWap

testWap i presume would mean test wireless access point, as that is what some of the items of the mod interact with. but from what i can tell, ae2 may have changed the way wireless access points work coding wise, as i couldn't find testwap within their code on github. i could only find mywap as an identifier.

ErythroCraft commented 1 year ago

The files aeifinitybooster.mixins.MixinWirelessTerminalMenuHost.java and appeng.helpers.WirelessTerminalMenuHost.java cannot communicate with each other because it is not testWap but bestWap. It's just a typo.

ErythroCraft commented 1 year ago

appeng.helpers.WirelessTerminalMenuHost.java [Applied-Energistics-2]

public boolean rangeCheck() {
        this.currentDistanceFromGrid = Double.MAX_VALUE;

        if (this.targetGrid != null) {
            @Nullable
            IWirelessAccessPoint bestWap = null;
            double bestSqDistance = Double.MAX_VALUE;

            // Find closest WAP
            for (var wap : this.targetGrid.getMachines(WirelessAccessPointBlockEntity.class)) {
                double sqDistance = getWapSqDistance(wap);

                // If the WAP is not suitable then MAX_VALUE will be returned and the check will fail
                if (sqDistance < bestSqDistance) {
                    bestSqDistance = sqDistance;
                    bestWap = wap;
                }
            }

            // If no WAP is found this will work too
            this.myWap = bestWap;
            this.currentDistanceFromGrid = Math.sqrt(bestSqDistance);
            return this.myWap != null;
        }

        return false;

instead of

aeifinitybooster.mixins.MixinWirelessTerminalMenuHost.java AEInfinityBooster

@Mixin(value = WirelessTerminalMenuHost.class, remap = false)
public class MixinWirelessTerminalMenuHost extends ItemMenuHost {

    @Shadow
    private double currentDistanceFromGrid;

    public MixinWirelessTerminalMenuHost(Player player, int slot, ItemStack itemStack) {
        super(player, slot, itemStack);
    }

    @Inject(method = "testWap", at = @At("HEAD"), cancellable = true)
    private void testWap(IWirelessAccessPoint wirelessAccessPoint, CallbackInfoReturnable<Boolean> cir) {

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

            if (wirelessBlockEntity.getInternalInventory().getStackInSlot(0).is(ModItems.DIMENSION_CARD.get())) {
                currentDistanceFromGrid = 32;
                cir.setReturnValue(true);
            }

   if (!this.getPlayer().level().dimension().location().toString().equals(wirelessAccessPoint.getLocation().getLevel().dimension().location().toString())) {
                return;
            }

            if (wirelessBlockEntity.getInternalInventory().getStackInSlot(0).is(ModItems.INFINITY_CARD.get())) {
                currentDistanceFromGrid = 16;
                cir.setReturnValue(true);
            }
        });
    }

}
ErythroCraft commented 1 year ago

https://github.com/Hexeption/AEInfinityBooster/compare/1.20.1...ErythroCraft:AEInfinityBooster:1.20.1-1

sicklyFoxJay commented 1 year ago

1.20.1...ErythroCraft:AEInfinityBooster:1.20.1-1

thank you very much ErythroCraft. this was alot of help