Allow sendData of multiple data
This commit is contained in:
parent
9e4ad0ba8e
commit
bff21ab039
@ -229,14 +229,17 @@ public class FlagWatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendData(int data) {
|
protected void sendData(int... dataValues) {
|
||||||
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
|
if (!DisguiseAPI.isDisguiseInUse(getDisguise()))
|
||||||
return;
|
return;
|
||||||
if (!entityValues.containsKey(data) || entityValues.get(data) == null)
|
|
||||||
return;
|
|
||||||
Object value = entityValues.get(data);
|
|
||||||
List<WrappedWatchableObject> list = new ArrayList<WrappedWatchableObject>();
|
List<WrappedWatchableObject> list = new ArrayList<WrappedWatchableObject>();
|
||||||
|
for (int data : dataValues) {
|
||||||
|
if (!entityValues.containsKey(data) || entityValues.get(data) == null)
|
||||||
|
continue;
|
||||||
|
Object value = entityValues.get(data);
|
||||||
list.add(new WrappedWatchableObject(data, value));
|
list.add(new WrappedWatchableObject(data, value));
|
||||||
|
}
|
||||||
|
if (!list.isEmpty()) {
|
||||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
||||||
StructureModifier<Object> mods = packet.getModifier();
|
StructureModifier<Object> mods = packet.getModifier();
|
||||||
mods.write(0, getDisguise().getEntity().getEntityId());
|
mods.write(0, getDisguise().getEntity().getEntityId());
|
||||||
@ -249,6 +252,7 @@ public class FlagWatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
|
public void setAddEntityAnimations(boolean isEntityAnimationsAdded) {
|
||||||
this.addEntityAnimations = isEntityAnimationsAdded;
|
this.addEntityAnimations = isEntityAnimationsAdded;
|
||||||
|
@ -42,8 +42,8 @@ public class TameableWatcher extends AgeableWatcher {
|
|||||||
@Override
|
@Override
|
||||||
public void setHealth(float newHealth) {
|
public void setHealth(float newHealth) {
|
||||||
setValue(18, newHealth);
|
setValue(18, newHealth);
|
||||||
sendData(18);
|
setValue(6, newHealth);
|
||||||
super.setHealth(newHealth);
|
sendData(6, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwner(String owner) {
|
public void setOwner(String owner) {
|
||||||
|
Loading…
Reference in New Issue
Block a user