Reduce amount of particles spawned with the water wings
This commit is contained in:
parent
cf56dfb9cf
commit
229c888498
@ -5,6 +5,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.shape.ShapeWings;
|
import mineplex.core.common.shape.ShapeWings;
|
||||||
@ -14,6 +15,8 @@ import mineplex.core.common.util.UtilParticle;
|
|||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.KitSelectorGadget;
|
import mineplex.core.gadget.types.KitSelectorGadget;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class WaterWingsKitSelector extends KitSelectorGadget
|
public class WaterWingsKitSelector extends KitSelectorGadget
|
||||||
{
|
{
|
||||||
@ -21,6 +24,9 @@ public class WaterWingsKitSelector extends KitSelectorGadget
|
|||||||
private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
||||||
private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
|
||||||
|
|
||||||
|
private int _tick = 0;
|
||||||
|
private int _lastTick = 0;
|
||||||
|
|
||||||
public WaterWingsKitSelector(GadgetManager manager)
|
public WaterWingsKitSelector(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Water Wings", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
|
super(manager, "Water Wings", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
|
||||||
@ -30,10 +36,21 @@ public class WaterWingsKitSelector extends KitSelectorGadget
|
|||||||
@Override
|
@Override
|
||||||
public void playParticle(Entity entity, Player playTo)
|
public void playParticle(Entity entity, Player playTo)
|
||||||
{
|
{
|
||||||
double offsetY = getEntityYOffset(entity);
|
if (_tick != _lastTick)
|
||||||
Location loc = entity.getLocation().add(0, offsetY, 0).add(entity.getLocation().getDirection().multiply(-0.2));
|
{
|
||||||
_wings.display(loc, playTo);
|
double offsetY = getEntityYOffset(entity);
|
||||||
_wingsEdge.display(loc, playTo);
|
Location loc = entity.getLocation().add(0, offsetY, 0).add(entity.getLocation().getDirection().multiply(-0.2));
|
||||||
|
_wings.display(loc, playTo);
|
||||||
|
_wingsEdge.display(loc, playTo);
|
||||||
|
_lastTick = _tick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.FASTEST)
|
||||||
|
_tick++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,8 @@ public abstract class KitSelectorGadget extends Gadget
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the next particle for the selected entity
|
* Plays the next particle for the selected entity
|
||||||
* @param entity
|
* @param entity The entity of the selected kit
|
||||||
|
* @param playTo The player that will receive the particles
|
||||||
*/
|
*/
|
||||||
public abstract void playParticle(Entity entity, Player playTo);
|
public abstract void playParticle(Entity entity, Player playTo);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user