mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-23 00:21:26 +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)
|
// connection null during Player initialization (due to #super call)
|
||||||
self = playerConnection != null && playerConnection.getConnectionState() == ConnectionState.PLAY;
|
self = playerConnection != null && playerConnection.getConnectionState() == ConnectionState.PLAY;
|
||||||
}
|
}
|
||||||
|
EntityPropertiesPacket propertiesPacket = getPropertiesPacket(Collections.singleton(attributeInstance));
|
||||||
if (self) {
|
if (self) {
|
||||||
sendPacketToViewersAndSelf(getPropertiesPacket());
|
sendPacketToViewersAndSelf(propertiesPacket);
|
||||||
} else {
|
} else {
|
||||||
sendPacketToViewers(getPropertiesPacket());
|
sendPacketToViewers(propertiesPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,8 +633,19 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
protected EntityPropertiesPacket getPropertiesPacket() {
|
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
|
// 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())
|
.filter(i -> i.getAttribute().isShared())
|
||||||
.toArray(AttributeInstance[]::new);
|
.toArray(AttributeInstance[]::new);
|
||||||
|
|
||||||
|
@ -81,7 +81,9 @@ public class CrossbowMeta extends ItemMeta implements ItemMetaBuilder.Provider<S
|
|||||||
public static class Builder extends ItemMetaBuilder {
|
public static class Builder extends ItemMetaBuilder {
|
||||||
|
|
||||||
private boolean triple;
|
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;
|
private boolean charged;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user