Skip to content

Commit

Permalink
- Fixed Particles renderer not being registered on Forge
Browse files Browse the repository at this point in the history
- Fixes Controls event acting weirdly
  • Loading branch information
Jeryn99 committed Dec 19, 2023
1 parent ff3c16d commit ed3e809
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ public class TardisEvents {
/**
* Represents an event that allows checking whether player control can be used.
*/
public static final Event<CanControlBeUsed> 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<CanControlBeUsed> 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.
Expand All @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down

0 comments on commit ed3e809

Please sign in to comment.