Adding firework animations for spinner.
This commit is contained in:
parent
7492ed310e
commit
c6beb122e3
|
@ -1,12 +1,23 @@
|
|||
package mineplex.core.bonuses.animations;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
|
@ -23,6 +34,7 @@ public class AnimationCarl extends Animation
|
|||
private long _startTime;
|
||||
private Object _type;
|
||||
private Player _player;
|
||||
private Random _random = new Random();
|
||||
|
||||
public AnimationCarl(Entity creeper)
|
||||
{
|
||||
|
@ -74,25 +86,35 @@ public class AnimationCarl extends Animation
|
|||
}
|
||||
if(_type instanceof Reward)
|
||||
{
|
||||
RewardData rewardData = ((Reward)_type).getFakeRewardData(null);
|
||||
ItemStack itemStack = rewardData.getDisplayItem();
|
||||
if(itemStack.getType() == Material.PAPER)
|
||||
if(getTicks() == 0)
|
||||
{
|
||||
itemStack = new ItemStack(Material.NETHER_STAR);
|
||||
RewardData rewardData = ((Reward)_type).getFakeRewardData(_player);
|
||||
ItemStack itemStack = rewardData.getDisplayItem();
|
||||
Item item = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.7, 0.5), itemStack);
|
||||
|
||||
Vector vel = new Vector(_player.getLocation().getX() - _creeper.getLocation().getX(), 0, _player.getLocation().getZ() - _creeper.getLocation().getZ());
|
||||
|
||||
UtilAction.velocity(item, vel, 0.1, false, 0, 0.2 + 1*0.4, 1, false);
|
||||
|
||||
item.setTicksLived(1160);
|
||||
}
|
||||
Item item = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.7, 0.5), itemStack);
|
||||
|
||||
Vector vel = new Vector(_player.getLocation().getX() - _creeper.getLocation().getX(), 0, _player.getLocation().getZ() - _creeper.getLocation().getZ());
|
||||
|
||||
UtilAction.velocity(item, vel, 0.1, false, 0, 0.2 + 1*0.4, 1, false);
|
||||
|
||||
item.setTicksLived(1160);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
finish();
|
||||
if(((Reward)_type).getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
RareAnimation();
|
||||
}
|
||||
else if(((Reward)_type).getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
LegendAnimation();
|
||||
}
|
||||
else if(((Reward)_type).getRarity() == RewardRarity.MYTHICAL)
|
||||
{
|
||||
MythicalAnimation();
|
||||
}
|
||||
else
|
||||
{
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,4 +148,122 @@ public class AnimationCarl extends Animation
|
|||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public void LegendAnimation()
|
||||
{
|
||||
if (getTicks() < 1)
|
||||
{
|
||||
UtilFirework.playFirework(_creeper.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.LIME, true, true);
|
||||
}
|
||||
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
_creeper.getLocation().getWorld().playSound(_creeper.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
|
||||
}
|
||||
else if (getTicks() < 35)
|
||||
{
|
||||
double radius = 2 - (getTicks() / 10D * 2);
|
||||
int particleAmount = 20 - (getTicks() * 2);
|
||||
Location _centerLocation = _creeper.getLocation().add(0.5, 0.1, 0.5);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
for(double e = 0.1 ; e < 3 ; e += 0.6)
|
||||
{
|
||||
Location location = _centerLocation.clone().add(xDiff, e, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void MythicalAnimation()
|
||||
{
|
||||
if (getTicks() < 30 && getTicks() % 3 == 0)
|
||||
{
|
||||
UtilFirework.playFirework(_creeper.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true);
|
||||
}
|
||||
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
_creeper.getLocation().getWorld().playSound(_creeper.getLocation().add(0.5, 0.5, 0.5), Sound.PORTAL_TRAVEL, 10F, 2.0F);
|
||||
_creeper.getLocation().getWorld().playSound(_creeper.getLocation().add(0.5, 0.5, 0.5), Sound.ZOMBIE_UNFECT, 10F, 0.1F);
|
||||
}
|
||||
else if (getTicks() < 60)
|
||||
{
|
||||
UtilFirework.launchFirework(_creeper.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true,
|
||||
new Vector((Math.random()-0.5)*0.05, 0.1, (Math.random()-0.5)*0.05), 1);
|
||||
|
||||
//Particle Spiral Up
|
||||
double radius = getTicks() / 20D;
|
||||
int particleAmount = getTicks() / 2;
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _creeper.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, -1.3, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
else if (getTicks() < 60)
|
||||
{
|
||||
double radius = 2 - (getTicks() / 10D * 2);
|
||||
int particleAmount = 20 - (getTicks() * 2);
|
||||
Location _centerLocation = _creeper.getLocation().add(0.5, 0.1, 0.5);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
for(double e = 0.1 ; e < 3 ; e += 0.5)
|
||||
{
|
||||
Location location = _centerLocation.clone().add(xDiff, e, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void RareAnimation()
|
||||
{
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
UtilFirework.playFirework(_creeper.getLocation().add(0.5, i, 0.5), Type.BALL, Color.FUCHSIA, false, false);
|
||||
}
|
||||
_creeper.getWorld().playSound(_creeper.getLocation(), Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
}
|
||||
else if (getTicks() >= 60)
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
else if (getTicks() < 35)
|
||||
{
|
||||
double radius = 2 - (getTicks() / 10D * 2);
|
||||
int particleAmount = 20 - (getTicks() * 2);
|
||||
Location _centerLocation = _creeper.getLocation().add(0.5, 0.1, 0.5);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
for(double e = 0.1 ; e < 3 ; e += 0.6)
|
||||
{
|
||||
Location location = _centerLocation.clone().add(xDiff, e, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public class AnimationCommand extends CommandBase<BonusManager>{
|
|||
|
||||
_plugin.addPendingExplosion(caller, "RANK");
|
||||
_plugin.addPendingExplosion(caller, "DAILY");
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue