Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop in till event handler with manasteel and elementium hoes #78

Closed
jeremiahwinsley opened this issue Feb 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jeremiahwinsley
Copy link

Minecraft version

None

AIOT Botania version

1.20.1-4.0.2

Botania version

1.20.1-443-FORGE

Forge version

47.2.19

The latest.log file

https://mclo.gs/ca9TZ1E

Issue description

On receiving a BlockToolModificationEvent, the onTilt event handler calls ToolUtil.hoeUse for Botania hoes: https://github.com/MelanX/aiotbotania/blob/602dfc17878d97af9f082fb475215eaac52c5f45/src/main/java/de/melanx/aiotbotania/core/proxy/CommonProxy.java#L111

This method calls BlockState#getToolModifiedState which fires another BlockToolModificationEvent, leading to an infinite loop: https://github.com/MelanX/aiotbotania/blob/602dfc17878d97af9f082fb475215eaac52c5f45/src/main/java/de/melanx/aiotbotania/util/ToolUtil.java#L103

Steps to reproduce

  1. Fresh Forge install with AIOT Botania
  2. Attempt to till dirt with a manasteel or elementium hoe.
  3. Crashes immediately with unclear error message

Requires a mixin to EventBus#handleException to get the actual exception:

@Mixin(EventBus.class)
public class MixinEventBus {
    @Inject(
            at = @At("HEAD"),
            require = 1,
            remap = false,
            method = "handleException(Lnet/minecraftforge/eventbus/api/IEventBus;Lnet/minecraftforge/eventbus/api/Event;[Lnet/minecraftforge/eventbus/api/IEventListener;ILjava/lang/Throwable;)V"
    )
    public void handleException(IEventBus bus, Event event, IEventListener[] listeners, int index, Throwable throwable, CallbackInfo ci) {
        PacketDebug.LOGGER.error("Logging exception from EventBus", throwable);
    }
}

Other information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant