diff --git a/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java b/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java index 15f925281..46046c3ad 100644 --- a/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java +++ b/common/src/main/java/whocraft/tardis_refined/api/event/TardisEvents.java @@ -66,12 +66,8 @@ public class TardisEvents { /** * Represents an event that allows checking whether player control can be used. */ - public static final Event PLAYER_CONTROL_INTERACT = new Event<>(CanControlBeUsed.class, listeners -> ((tardisLevelOperator, control, controlEntity) -> { - for (CanControlBeUsed listener : listeners) { - return listener.canControlBeUsed(tardisLevelOperator, control, controlEntity); - } - return true; - })); + public static final Event PLAYER_CONTROL_INTERACT = new Event<>(CanControlBeUsed.class, listeners -> (tardisLevelOperator, control, controlEntity) -> Event.result(listeners, takeOff -> takeOff.canControlBeUsed(tardisLevelOperator, control, controlEntity))); + /** * Functional interface to define the conditions for using player control. @@ -87,7 +83,7 @@ public interface CanControlBeUsed { * @param controlEntity The entity associated with the control. * @return True if control can be used, false otherwise. */ - boolean canControlBeUsed(TardisLevelOperator tardisLevelOperator, Control control, ControlEntity controlEntity); + EventResult canControlBeUsed(TardisLevelOperator tardisLevelOperator, Control control, ControlEntity controlEntity); } diff --git a/common/src/main/java/whocraft/tardis_refined/common/entity/ControlEntity.java b/common/src/main/java/whocraft/tardis_refined/common/entity/ControlEntity.java index b95a14063..bb82b777d 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/entity/ControlEntity.java +++ b/common/src/main/java/whocraft/tardis_refined/common/entity/ControlEntity.java @@ -278,7 +278,7 @@ public boolean isDesktopWaitingToGenerate(TardisLevelOperator operator){ private void handleLeftClick(Player player, ServerLevel serverLevel){ TardisLevelOperator.get(serverLevel).ifPresent(cap -> { - if (controlSpecification.control().getControl().canUseControl(cap, controlSpecification.control().getControl(), this)) + if (!controlSpecification.control().getControl().canUseControl(cap, controlSpecification.control().getControl(), this)) return; if (!interactWaitingControl(cap)) { @@ -310,7 +310,7 @@ private void handleRightClick(Player player, ServerLevel serverLevel, Interactio return; } - if (controlSpecification.control().getControl().canUseControl(cap, controlSpecification.control().getControl(), this)) + if (!controlSpecification.control().getControl().canUseControl(cap, controlSpecification.control().getControl(), this)) return; if (!interactWaitingControl(cap)) { diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/control/Control.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/control/Control.java index 630056da0..125f8a597 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/control/Control.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/control/Control.java @@ -3,6 +3,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; +import whocraft.tardis_refined.api.event.EventResult; import whocraft.tardis_refined.api.event.TardisEvents; import whocraft.tardis_refined.common.capability.TardisLevelOperator; import whocraft.tardis_refined.common.entity.ControlEntity; @@ -61,7 +62,7 @@ public void playControlPitchedSound(TardisLevelOperator operator, ControlEntity public boolean canUseControl(TardisLevelOperator tardisLevelOperator, Control control, ControlEntity controlEntity){ boolean isDeskopWaiting = controlEntity.isDesktopWaitingToGenerate(tardisLevelOperator); - return !isDeskopWaiting && TardisEvents.PLAYER_CONTROL_INTERACT.invoker().canControlBeUsed(tardisLevelOperator, control, controlEntity); + return !isDeskopWaiting && TardisEvents.PLAYER_CONTROL_INTERACT.invoker().canControlBeUsed(tardisLevelOperator, control, controlEntity) == EventResult.pass(); } } diff --git a/forge/src/main/java/whocraft/tardis_refined/neoforge/ClientModBus.java b/forge/src/main/java/whocraft/tardis_refined/neoforge/ClientModBus.java index 2dab5847d..51ffcae38 100644 --- a/forge/src/main/java/whocraft/tardis_refined/neoforge/ClientModBus.java +++ b/forge/src/main/java/whocraft/tardis_refined/neoforge/ClientModBus.java @@ -53,6 +53,7 @@ public static void onRegisterLayerDefinitions(EntityRenderersEvent.RegisterLayer @SubscribeEvent public static void onRegisterParticles(RegisterParticleProvidersEvent event) { Minecraft.getInstance().particleEngine.register(TRParticles.GALLIFREY.get(), (ParticleEngine.SpriteParticleRegistration) (ParticleGallifrey.Provider::new)); + Minecraft.getInstance().particleEngine.register(TRParticles.ARS_LEAVES.get(), (ParticleEngine.SpriteParticleRegistration) (ParticleGallifrey.ARSVinesParticle::new)); }