Skip to content

Commit

Permalink
fix: fix Insomnia Cure "not sleepy" check not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Aug 2, 2023
1 parent 124a948 commit 594fb69
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

public class InsomniaCureSerum extends BasicSerum {

protected static final int PHANTOM_SPAWN_THRESHOLD = 72_000;

public InsomniaCureSerum(int color) {
super(color);
}
Expand All @@ -33,7 +35,8 @@ public void affectEntity(ServerLevel level, CompoundTag tag, @Nullable LivingEnt
public boolean canAffectPlayerSelf(CompoundTag tag, Player targetSelf) {
// if (!targetSelf.level.isClientSide && !targetSelf.level.getGameRules().getBoolean(GameRules.RULE_DOINSOMNIA)) return false;

if (getTimeSinceRest(targetSelf) > 20 * 60) {
int ticksSinceRest = getTimeSinceRest(targetSelf);
if (ticksSinceRest <= PHANTOM_SPAWN_THRESHOLD * 0.833f) {
if (!targetSelf.level.isClientSide) {
targetSelf.displayClientMessage(TextComponentUtil.getFailureMsgText("not_sleepy"), true);
}
Expand Down

0 comments on commit 594fb69

Please sign in to comment.