Stability adjustments <3

This commit is contained in:
Brianna 2019-06-29 20:16:01 -04:00
parent 31e6bdb8b5
commit ed0b7035f7
2 changed files with 9 additions and 14 deletions

View File

@ -186,15 +186,7 @@ public class EntityStack {
}
public void mergeHealth(EntityStack stack) {
this.health.addAll(stack.getHealthDeque());
}
public Deque<Double> getHealthDeque() {
return new ArrayDeque<>(health);
}
public void setHealthDeque(Deque<Double> health) {
this.health = health;
this.health.addAll(stack.health);
}
@Override

View File

@ -117,14 +117,15 @@ public class StackingTask extends BukkitRunnable {
stack.updateStack();
if (initialStack == null)
stack.addHealth(initialEntity.getHealth());
stack.addHealth(entity.getHealth());
else
stack.mergeHealth(initialStack);
removed.add(initialEntity.getUniqueId());
fixHealth(entity, initialEntity);
updateHealth(stack);
if (Setting.STACK_ENTITY_HEALTH.getBoolean())
entity.setHealth(initialEntity.getHealth());
initialEntity.remove();
@ -137,12 +138,14 @@ public class StackingTask extends BukkitRunnable {
&& initialEntity.getLocation().getY() > entity.getLocation().getY()) {
EntityStack newStack = stackManager.addStack(entity, initialStack.getAmount() + 1);
newStack.setHealthDeque(initialStack.getHealthDeque());
newStack.addHealth(entity.getHealth());
newStack.mergeHealth(initialStack);
newStack.addHealth(initialEntity.getHealth());
removed.add(initialEntity.getUniqueId());
fixHealth(initialEntity, entity);
updateHealth(newStack);
if (Setting.STACK_ENTITY_HEALTH.getBoolean())
entity.setHealth(entity.getHealth());
stackManager.removeStack(initialEntity);
initialEntity.remove();