Improve effects
This commit is contained in:
parent
e9a4fedc21
commit
17af56f8c2
@ -5,6 +5,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
@ -20,7 +21,7 @@ public class ParticleBlizzard extends ParticleGadget
|
||||
{
|
||||
|
||||
private static final double DELTA_THETA = Math.PI / 12;
|
||||
private static final double RADIUS = 0.6;
|
||||
private static final double RADIUS = 0.7;
|
||||
private static final double HEIGHT = 1.9;
|
||||
|
||||
private double _theta;
|
||||
@ -28,7 +29,7 @@ public class ParticleBlizzard extends ParticleGadget
|
||||
public ParticleBlizzard(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Blizzard Aura",
|
||||
UtilText.splitLineToArray("TODO", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "TODO", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_GINGERBREAD_CHESTS, Material.ICE, (byte) 0);
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ public class ParticleBlizzard extends ParticleGadget
|
||||
|
||||
if (Manager.isMoving(player))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, Math.sin(_theta) * 2, 0), null, 0, 1, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, 1 + Math.sin(_theta), 0), null, 0, 1, ViewDist.NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,7 +56,7 @@ public class ParticleBlizzard extends ParticleGadget
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0, 1, ViewDist.NORMAL);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, location.subtract(0, HEIGHT - 0.6, 0), 0.7F, 0.4F, 0.7F, 0, 2, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, location.subtract(0, HEIGHT - 0.8, 0), 0.7F, 0.4F, 0.7F, 0, 3, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
public class ParticleFidgetSpinner extends ParticleGadget
|
||||
{
|
||||
|
||||
private static final int MAX_ROTATION = 20;
|
||||
private static final int MAX_ROTATION = 6;
|
||||
private static final int PETAL_COUNT = 3;
|
||||
private static final double HEIGHT = 0.9;
|
||||
|
||||
@ -36,10 +36,10 @@ public class ParticleFidgetSpinner extends ParticleGadget
|
||||
public ParticleFidgetSpinner(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Fidget Spinner Aura",
|
||||
UtilText.splitLineToArray(C.cGray + "The best gift this Christmas!", LineFormat.LORE),
|
||||
UtilText.splitLineToArray(C.cGray + "Fidget the spinner like a winner!", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_GINGERBREAD_CHESTS, Material.RECORD_3, (byte) 0);
|
||||
|
||||
for (int rotation = 0; rotation < MAX_ROTATION; rotation += 8)
|
||||
for (int rotation = 0; rotation < MAX_ROTATION; rotation++)
|
||||
{
|
||||
_shapes.add(new ShapeFidgetSpinner(PETAL_COUNT, rotation));
|
||||
}
|
||||
@ -48,18 +48,17 @@ public class ParticleFidgetSpinner extends ParticleGadget
|
||||
@Override
|
||||
public void playParticle(Player player, UpdateEvent event)
|
||||
{
|
||||
Location location = player.getLocation();
|
||||
Location location = player.getLocation().add(0, HEIGHT, 0);
|
||||
|
||||
if (Manager.isMoving(player))
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, UtilAlg.getRandomLocation(location, 1.5, 1.5, 1.5), null, 0, 1, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, UtilAlg.getRandomLocation(location, 0.5, 0.5, 0.5), null, 0, 1, ViewDist.NORMAL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
location.add(0, HEIGHT, 0);
|
||||
ShapeFidgetSpinner shape = _shapes.get(_shapeIndex);
|
||||
shape.display(location);
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.core.treasure.animation.animations;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
@ -7,6 +10,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
@ -27,6 +31,7 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
|
||||
private static final int RADIUS = 3;
|
||||
private static final double DELTA_THETA = Math.PI / 40;
|
||||
private static final double TOTAL_THETA = 2 * Math.PI;
|
||||
private static final double DELTA_Y = -1;
|
||||
private static final FireworkEffect FIREWORK_EFFECT = FireworkEffect.builder()
|
||||
.with(Type.STAR)
|
||||
.withColor(Color.YELLOW)
|
||||
@ -34,17 +39,20 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
|
||||
.withFlicker()
|
||||
.build();
|
||||
|
||||
private final Set<Location> _chests;
|
||||
private double _totalTheta;
|
||||
|
||||
public GingerbreadChestAnimation(Treasure treasure, TreasureLocation treasureLocation)
|
||||
{
|
||||
super(treasure, treasureLocation);
|
||||
|
||||
_chests = new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
changeFloor(Material.WOOL, 5, Material.WOOL, 14);
|
||||
changeFloor(Material.STAINED_CLAY, 5, Material.STAINED_CLAY, 14);
|
||||
|
||||
Location spawn = getTreasureLocation().getChestLocations().get(0);
|
||||
|
||||
@ -63,28 +71,33 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
|
||||
double x = RADIUS * Math.cos(_totalTheta);
|
||||
double z = RADIUS * Math.sin(_totalTheta);
|
||||
|
||||
location.add(x, 0, z);
|
||||
location.add(x, DELTA_Y, z);
|
||||
|
||||
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, getTreasureLocation().getChest())));
|
||||
|
||||
stand.teleport(location);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0.01F, 1, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, 1.5, 0), 0.25F, 0.25F, 0.25F, 0.01F, 1, ViewDist.NORMAL);
|
||||
|
||||
for (Location chest : getTreasureLocation().getChestLocations())
|
||||
{
|
||||
if (UtilMath.offsetSquared(chest, location) < 1)
|
||||
chest = chest.clone();
|
||||
|
||||
if (UtilMath.offsetSquared(chest, location) < 1 && _chests.add(chest))
|
||||
{
|
||||
UtilFirework.playFirework(chest, FIREWORK_EFFECT);
|
||||
createChestAt(location, Material.ENDER_CHEST);
|
||||
chest.setYaw(location.getYaw());
|
||||
UtilFirework.playFirework(chest.add(0, 1, 0), FIREWORK_EFFECT);
|
||||
createChestAt(chest, Material.ENDER_CHEST);
|
||||
}
|
||||
}
|
||||
|
||||
if (getTicks() % 4 == 0)
|
||||
if (getTicks() % 5 == 0)
|
||||
{
|
||||
stand.getWorld().playSound(location, Sound.ORB_PICKUP, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, getTreasureLocation().getChest().clone().add(0, 4, 0), 3, 0.3F, 3, 0, 3, ViewDist.NORMAL);
|
||||
|
||||
if (_totalTheta >= TOTAL_THETA)
|
||||
{
|
||||
setRunning(false);
|
||||
@ -94,6 +107,6 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
||||
_stands.forEach(Entity::remove);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user