Fix invalid events

This commit is contained in:
shedaniel
2021-03-30 01:19:43 +08:00
parent 2846a9616a
commit 2af34feb2a
4 changed files with 5 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ public final class EventFactory {
@Override
protected Object handleInvocation(@NotNull Object proxy, @NotNull Method method, Object @NotNull [] args) throws Throwable {
for (T listener : listeners) {
InteractionResult result = (InteractionResult) method.invoke(listener, args);
InteractionResult result = (InteractionResult) Objects.requireNonNull(method.invoke(listener, args));
if (result != InteractionResult.PASS) {
return result;
}

View File

@@ -30,7 +30,7 @@ import java.util.List;
public interface ExplosionEvent {
Event<Pre> PRE = EventFactory.createInteractionResult();
Event<Detonate> DETONATE = EventFactory.createInteractionResult();
Event<Detonate> DETONATE = EventFactory.createLoop();
interface Pre {
InteractionResult explode(Level world, Explosion explosion);

View File

@@ -49,7 +49,7 @@ public interface GuiEvent {
*/
Event<ScreenInitPost> INIT_POST = EventFactory.createLoop();
Event<ScreenRenderPre> RENDER_PRE = EventFactory.createInteractionResult();
Event<ScreenRenderPost> RENDER_POST = EventFactory.createInteractionResult();
Event<ScreenRenderPost> RENDER_POST = EventFactory.createLoop();
/**
* Invoked during Minecraft#setScreen, equivalent to forge's {@code GuiOpenEvent}.

View File

@@ -44,8 +44,8 @@ public interface TooltipEvent {
* Render forge events are only invoked on the forge side.
*/
Event<RenderForge> RENDER_FORGE_PRE = EventFactory.createInteractionResult();
Event<RenderModifyPosition> RENDER_MODIFY_POSITION = EventFactory.createInteractionResult();
Event<RenderModifyColor> RENDER_MODIFY_COLOR = EventFactory.createInteractionResult();
Event<RenderModifyPosition> RENDER_MODIFY_POSITION = EventFactory.createLoop();
Event<RenderModifyColor> RENDER_MODIFY_COLOR = EventFactory.createLoop();
@Environment(EnvType.CLIENT)
interface Item {