Skip to content

Commit 49f66c2

Browse files
Correctly cap scale attribute (#4856)
* Fix scale attribute cap * Update LivingEntity.java
1 parent 6ab0186 commit 49f66c2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public enum GeyserAttributeType {
4949
ATTACK_KNOCKBACK("minecraft:generic.attack_knockback", null, 1.5f, Float.MAX_VALUE, 0f),
5050
ATTACK_SPEED("minecraft:generic.attack_speed", null, 0f, 1024f, 4f),
5151
MAX_HEALTH("minecraft:generic.max_health", null, 0f, 1024f, 20f),
52-
SCALE("minecraft:generic.scale", null, 0.0625f, 16f, 1f), // Unused. Do we need this?
52+
SCALE("minecraft:generic.scale", null, 0.0625f, 16f, 1f),
5353

5454
// Bedrock Attributes
5555
ABSORPTION(null, "minecraft:absorption", 0f, 1024f, 0f),

core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.geysermc.geyser.translator.item.ItemTranslator;
4949
import org.geysermc.geyser.util.AttributeUtils;
5050
import org.geysermc.geyser.util.InteractionResult;
51+
import org.geysermc.geyser.util.MathUtils;
5152
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute;
5253
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.AttributeType;
5354
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata;
@@ -252,7 +253,7 @@ protected void setScale(float scale) {
252253
}
253254

254255
private void setAttributeScale(float scale) {
255-
this.attributeScale = scale;
256+
this.attributeScale = MathUtils.clamp(scale, GeyserAttributeType.SCALE.getMinimum(), GeyserAttributeType.SCALE.getMaximum());
256257
applyScale();
257258
}
258259

0 commit comments

Comments
 (0)