Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-24 23:30:22 +01:00
Update for MCProtocolLib changes
Dieser Commit ist enthalten in:
Ursprung
41ecb885bd
Commit
daea2618c5
@ -26,6 +26,7 @@
|
||||
package org.geysermc.geyser.entity.type;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeType;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
@ -251,7 +252,8 @@ public class LivingEntity extends Entity {
|
||||
* Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute
|
||||
*/
|
||||
protected void updateAttribute(Attribute javaAttribute, List<AttributeData> newAttributes) {
|
||||
switch (javaAttribute.getType()) {
|
||||
if (javaAttribute.getType() instanceof AttributeType.Builtin type) {
|
||||
switch (type) {
|
||||
case GENERIC_MAX_HEALTH -> {
|
||||
this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute);
|
||||
newAttributes.add(createHealthAttribute());
|
||||
@ -264,6 +266,7 @@ public class LivingEntity extends Entity {
|
||||
case HORSE_JUMP_STRENGTH -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.HORSE_JUMP_STRENGTH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the complete attribute value to send to Bedrock. Will be overriden if attributes need to be cached.
|
||||
|
@ -177,7 +177,7 @@ public class SessionPlayerEntity extends PlayerEntity {
|
||||
|
||||
@Override
|
||||
protected void updateAttribute(Attribute javaAttribute, List<AttributeData> newAttributes) {
|
||||
if (javaAttribute.getType() == AttributeType.GENERIC_ATTACK_SPEED) {
|
||||
if (javaAttribute.getType() == AttributeType.Builtin.GENERIC_ATTACK_SPEED) {
|
||||
session.setAttackSpeed(AttributeUtils.calculateValue(javaAttribute));
|
||||
} else {
|
||||
super.updateAttribute(javaAttribute, newAttributes);
|
||||
@ -188,7 +188,7 @@ public class SessionPlayerEntity extends PlayerEntity {
|
||||
protected AttributeData calculateAttribute(Attribute javaAttribute, GeyserAttributeType type) {
|
||||
AttributeData attributeData = super.calculateAttribute(javaAttribute, type);
|
||||
|
||||
if (javaAttribute.getType() == AttributeType.GENERIC_MOVEMENT_SPEED) {
|
||||
if (javaAttribute.getType() == AttributeType.Builtin.GENERIC_MOVEMENT_SPEED) {
|
||||
session.setOriginalSpeedAttribute(attributeData.getValue());
|
||||
AttributeData speedAttribute = session.adjustSpeed();
|
||||
if (speedAttribute != null) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren