mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 02:35:49 +01:00
Use generics in health scaling methods
This commit is contained in:
parent
b4c298d644
commit
c15d869440
1 changed files with 4 additions and 5 deletions
|
@ -1332,7 +1332,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
public void updateScaledHealth() {
|
public void updateScaledHealth() {
|
||||||
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
|
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
|
||||||
Collection set = attributemapserver.c(); // PAIL: Rename
|
Collection<AttributeInstance> set = attributemapserver.c(); // PAIL: Rename
|
||||||
|
|
||||||
injectScaledMaxHealth(set, true);
|
injectScaledMaxHealth(set, true);
|
||||||
|
|
||||||
|
@ -1347,13 +1347,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
|
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectScaledMaxHealth(Collection collection, boolean force) {
|
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
|
||||||
if (!scaledHealth && !force) {
|
if (!scaledHealth && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Object genericInstance : collection) {
|
for (AttributeInstance genericInstance : collection) {
|
||||||
IAttribute attribute = ((AttributeInstance) genericInstance).getAttribute();
|
if (genericInstance.getAttribute().getName().equals("generic.maxHealth")) {
|
||||||
if (attribute.getName().equals("generic.maxHealth")) {
|
|
||||||
collection.remove(genericInstance);
|
collection.remove(genericInstance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue