From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Wed, 30 Nov 2022 20:17:41 +0100 Subject: [PATCH] Check frozen ticks before landing block License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) Gale - https://galemc.org This patch is based on the following mixin: "net/caffeinemc/mods/lithium/mixin/entity/fast_powder_snow_check/LivingEntityMixin.java" By: 2No2Name <2No2Name@web.de> As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java index 85759f8fe3892e0af3cbbd836defc9ee4b2705f6..a542e1dfa41ec2ea1a979dc27d0155d5c08fd7cc 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -521,10 +521,9 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void tryAddFrost() { - if (!this.getBlockStateOnLegacy().isAir()) { int ticksFrozen = this.getTicksFrozen(); if (ticksFrozen > 0) { - AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED); + AttributeInstance attribute = this.getBlockStateOnLegacy().isAir() ? null : this.getAttribute(Attributes.MOVEMENT_SPEED); // Gale - Lithium - check frozen ticks before landing block if (attribute == null) { return; } @@ -532,7 +531,6 @@ public abstract class LivingEntity extends Entity implements Attackable { float f = -0.05F * this.getPercentFrozen(); attribute.addTransientModifier(new AttributeModifier(SPEED_MODIFIER_POWDER_SNOW_ID, f, AttributeModifier.Operation.ADD_VALUE)); } - } } protected void onChangedBlock(ServerLevel level, BlockPos pos) {