Fixed shimmering rings

This commit is contained in:
LCastr0 2017-04-28 21:23:19 -03:00
parent df563793c5
commit f8566437d5
1 changed files with 29 additions and 6 deletions

View File

@ -5,7 +5,6 @@ import java.util.Map;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -70,9 +69,15 @@ public class ShimmeringRingKitSelector extends KitSelectorGadget
// Updates height and direction of particles // Updates height and direction of particles
double height = _circleHeight.get(entity); double height = _circleHeight.get(entity);
boolean up = (height == 0) || ((height == getEntityHeight(entity)) ? false : _direction.get(entity)); if (height <= 0)
_direction.put(entity, up); {
if (up) _direction.put(entity, true);
}
else if (height >= getEntityHeight(entity))
{
_direction.put(entity, false);
}
if (_direction.get(entity))
height += 0.1; height += 0.1;
else else
height -= 0.1; height -= 0.1;
@ -90,8 +95,26 @@ public class ShimmeringRingKitSelector extends KitSelectorGadget
private double getEntityHeight(Entity entity) private double getEntityHeight(Entity entity)
{ {
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); switch (entity.getType())
return nmsEntity.getBoundingBox().e - nmsEntity.getBoundingBox().b; {
case SHEEP:
case PIG:
case BAT:
case MAGMA_CUBE:
case GUARDIAN:
case CHICKEN:
case SLIME:
case SQUID:
case WOLF:
case OCELOT:
return 0.75;
case SPIDER:
case CAVE_SPIDER:
return 0.5;
case ENDERMAN:
return 3;
}
return 2;
} }
} }