13
0

Add TeamParticle

Dieser Commit ist enthalten in:
yoyosource 2022-03-24 15:40:56 +01:00
Ursprung baf31eb3f2
Commit 38cb38a1a1
3 geänderte Dateien mit 73 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -37,3 +37,12 @@ PARTICLE_MAGIC = §5Magie
PARTICLE_ANGRY = §4Wut
PARTICLE_SLIME = §aSchleim
PARTICLE_MOB = §7Mob
PARTICLE_SQUID = §8Squid
PARTICLE_BUBBLE = §aBubble
PARTICLE_HONEY = §6Honey
PARTICLE_NECTAR = §6Nectar
PARTICLE_FIREWORK = §7Firework
PARTICLE_DRAGON_BREATH = §5Dragon Breath
PARTICLE_DAMAGE = §5Damage
PARTICLE_DOLPHIN = §dDolphin

Datei anzeigen

@ -31,6 +31,7 @@ public class SimpleParticle implements BaseParticle {
private float vy;
private float vz;
private double time = 1;
private int count = 5;
public SimpleParticle(ParticleItem particleItem, Particle particle) {
this.particleItem = particleItem;
@ -47,6 +48,17 @@ public class SimpleParticle implements BaseParticle {
this.time = time;
}
public SimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time, int count) {
this.particleItem = particleItem;
this.particle = particle;
this.customVelocity = true;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
this.count = count;
}
@Override
public ParticleItem getItem() {
return particleItem;
@ -56,9 +68,9 @@ public class SimpleParticle implements BaseParticle {
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
if (customVelocity) {
particleData.getWorld().spawnParticle(particle, location, 5, vx, vy, vz, time);
particleData.getWorld().spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
particleData.getWorld().spawnParticle(particle, location, 5);
particleData.getWorld().spawnParticle(particle, location, count);
}
}
}

Datei anzeigen

@ -0,0 +1,49 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import de.steamwar.lobby.particle.decorator.CircleParticle;
import de.steamwar.lobby.particle.decorator.NonFloorParticle;
import de.steamwar.lobby.particle.mutator.LocationParticleMutator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.Particle;
import static org.bukkit.Material.*;
@AllArgsConstructor
public enum TeamParticle implements ParticleEnum {
SQUID(new SimpleParticle(new ParticleItem(INK_SAC, "PARTICLE_SQUID"), Particle.SQUID_INK, 0.2F, 0.2F, 0.2F, 0.01)),
BUBBLE(new SimpleParticle(new ParticleItem(TUBE_CORAL, "PARTICLE_BUBBLE"), Particle.BUBBLE_POP, 0.2F, 0.2F, 0.2F, 0.01)),
HONEY(new SimpleParticle(new ParticleItem(HONEY_BOTTLE, "PARTICLE_HONEY"), Particle.DRIPPING_HONEY, 0.2F, 0.2F, 0.2F, 1)),
NECTAR(new SimpleParticle(new ParticleItem(HONEYCOMB, "PARTICLE_NECTAR"), Particle.FALLING_NECTAR, 0.2F, 0.2F, 0.2F, 1)),
FIREWORK(new LocationParticleMutator(new NonFloorParticle(new SimpleParticle(new ParticleItem(FIRE_CHARGE, "PARTICLE_FIREWORK"), Particle.FIREWORKS_SPARK, 0.1F, 0.1F, 0.1F, 0.2, 2)), location -> location.subtract(0, -0.2, 0))),
DRAGON_BREATH(new SimpleParticle(new ParticleItem(Material.DRAGON_BREATH, "PARTICLE_DRAGON_BREATH"), Particle.DRAGON_BREATH, 1F, 0.2F, 1F, 0.01)),
DAMAGE(new SimpleParticle(new ParticleItem(SPIDER_EYE, "PARTICLE_DAMAGE"), Particle.DAMAGE_INDICATOR, 0.2F, 0F, 0.2F, 0.01)),
DOLPHIN(new SimpleParticle(new ParticleItem(BLUE_DYE, "PARTICLE_DOLPHIN"), Particle.DOLPHIN, 0.2F, 0F, 0.2F, 0.01)),
HEART(new CircleParticle(new LocationParticleMutator(new SimpleParticle(new ParticleItem(RED_CONCRETE, "PARTICLE_HEART"), Particle.HEART), location -> location.add(0, 2.2, 0))))
;
public static ParticleEnum[] particles = values();
@Getter
private BaseParticle particle;
}