mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Merge pull request #397 from Bloepiloepi/attribute-fix
Fix player stop sprinting when changing attributes
This commit is contained in:
commit
ccd8bea434
@ -507,10 +507,11 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
||||
// connection null during Player initialization (due to #super call)
|
||||
self = playerConnection != null && playerConnection.getConnectionState() == ConnectionState.PLAY;
|
||||
}
|
||||
EntityPropertiesPacket propertiesPacket = getPropertiesPacket(Collections.singleton(attributeInstance));
|
||||
if (self) {
|
||||
sendPacketToViewersAndSelf(getPropertiesPacket());
|
||||
sendPacketToViewersAndSelf(propertiesPacket);
|
||||
} else {
|
||||
sendPacketToViewers(getPropertiesPacket());
|
||||
sendPacketToViewers(propertiesPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -632,8 +633,19 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
||||
*/
|
||||
@NotNull
|
||||
protected EntityPropertiesPacket getPropertiesPacket() {
|
||||
return getPropertiesPacket(attributeModifiers.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link EntityPropertiesPacket} for this entity with the specified attribute values.
|
||||
*
|
||||
* @param attributes the attributes to include in the packet
|
||||
* @return an {@link EntityPropertiesPacket} linked to this entity
|
||||
*/
|
||||
@NotNull
|
||||
protected EntityPropertiesPacket getPropertiesPacket(@NotNull Collection<AttributeInstance> attributes) {
|
||||
// Get all the attributes which should be sent to the client
|
||||
final AttributeInstance[] instances = attributeModifiers.values().stream()
|
||||
final AttributeInstance[] instances = attributes.stream()
|
||||
.filter(i -> i.getAttribute().isShared())
|
||||
.toArray(AttributeInstance[]::new);
|
||||
|
||||
|
@ -81,7 +81,9 @@ public class CrossbowMeta extends ItemMeta implements ItemMetaBuilder.Provider<S
|
||||
public static class Builder extends ItemMetaBuilder {
|
||||
|
||||
private boolean triple;
|
||||
private ItemStack projectile1, projectile2, projectile3 = ItemStack.AIR;
|
||||
private ItemStack projectile1 = ItemStack.AIR;
|
||||
private ItemStack projectile2 = ItemStack.AIR;
|
||||
private ItemStack projectile3 = ItemStack.AIR;
|
||||
private boolean charged;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user