Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
Bug Fix:
NullPointerException during ClientAnimator sync.
  • Loading branch information
LouisQuepierts committed Aug 20, 2024
1 parent 9c2367b commit 7e30286
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@
import net.minecraft.world.entity.player.Player;
import net.quepierts.simpleanimator.api.event.SAEvent;

import java.util.UUID;

@SuppressWarnings("unused")
public class CancelInteractEvent extends SAEvent {
private final Player player;
private final UUID target;
private final ResourceLocation interactionID;

public CancelInteractEvent(Player player, ResourceLocation interactionID) {
public CancelInteractEvent(Player player, UUID other, ResourceLocation interactionID) {
this.player = player;
this.target = other;
this.interactionID = interactionID;
}

public Player getPlayer() {
return player;
}

public UUID getTarget() {
return target;
}

public ResourceLocation getInteractionID() {
return interactionID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void update(AnimatorDataPacket packet) {
public void sync(AnimatorDataPacket packet) {
ResourceLocation location = this.animationLocation;
super.sync(packet);
if (!location.equals(this.animationLocation)) {
if (!location.equals(this.animationLocation) || this.animation != null) {
Set<String> animationVariables = this.animation.getVariables();
for (String variable : animationVariables) {
this.variables.computeIfAbsent(variable, VariableHolder::get);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void createAnimator(Level level, BlockPos blockPos, float f, GameProfile
if (!this.simpleanimator$request.hasRequest())
return;

SimpleAnimator.EVENT_BUS.post(new CancelInteractEvent((Player) (Object) this, this.simpleanimator$request.getInteraction()));
SimpleAnimator.EVENT_BUS.post(new CancelInteractEvent((Player) (Object) this, this.simpleanimator$request.getTarget(), this.simpleanimator$request.getInteraction()));
this.simpleanimator$animator.stop();
this.simpleanimator$request.reset();

Expand Down

0 comments on commit 7e30286

Please sign in to comment.