Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ protected PlayerDanceTickMixin(EntityType<? extends LivingEntity> entityType, Le
String pose = data.getPose();
boolean valid = GroovingTrinket.Companion.hasSpecificAnimation(pose, inventory, getMainHandItem());

boolean changed = false;

if (!pose.isEmpty()) {
if (!valid) {
data.reset();
return;
}

if (data.getDanceDuration() < 0)
if (data.getDanceDuration() < 0) {
data.setDanceStartTimestamp(level().getGameTime());
changed = true;
}
}

LivingEntity entity = this;
Expand All @@ -67,7 +71,9 @@ protected PlayerDanceTickMixin(EntityType<? extends LivingEntity> entityType, Le
);
data.setPose("");
}

data.setTaunting(taunt);
changed = true;
}

int duration = data.getDanceDuration();
Expand All @@ -76,6 +82,8 @@ protected PlayerDanceTickMixin(EntityType<? extends LivingEntity> entityType, Le

duration--;
data.setDanceDuration(duration);
changed = true;

if (duration == 0) {
PlayerAnimationCallback.EVENT.invoker().interact(
player,
Expand All @@ -87,10 +95,12 @@ protected PlayerDanceTickMixin(EntityType<? extends LivingEntity> entityType, Le
)
);
data.setPose("");
changed = true;
}
}

//noinspection UnstableApiUsage
setAttached(PlayerExtendedData.Companion.getDATA_TYPE(), data);
if (changed)
//noinspection UnstableApiUsage
setAttached(PlayerExtendedData.Companion.getDATA_TYPE(), data);
}
}