mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-20 15:04:31 +00:00
Add style 'batman', this might be a bad idea
This commit is contained in:
parent
200103a5c9
commit
b4455e6686
6 changed files with 145 additions and 12 deletions
|
@ -46,9 +46,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
|||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||
DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> {
|
||||
System.out.println("Loaded");
|
||||
}); // Loads the PPlayer from the database
|
||||
DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> { }); // Loads the PPlayer from the database
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ public class DefaultStyles {
|
|||
* All the styles that are available by default from this plugin
|
||||
*/
|
||||
public static final ParticleStyle ARROWS = new ParticleStyleArrows();
|
||||
public static final ParticleStyle BATMAN = new ParticleStyleBatman();
|
||||
public static final ParticleStyle BEAM = new ParticleStyleBeam();
|
||||
public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak();
|
||||
public static final ParticleStyle BLOCKEDIT = new ParticleStyleBlockEdit();
|
||||
|
@ -41,8 +42,8 @@ public class DefaultStyles {
|
|||
* Registered in alphabetical order
|
||||
*/
|
||||
public static void registerStyles() {
|
||||
ParticleStyleManager.registerStyle(NORMAL); // Always display none first
|
||||
ParticleStyleManager.registerStyle(ARROWS);
|
||||
ParticleStyleManager.registerStyle(BATMAN);
|
||||
ParticleStyleManager.registerStyle(BEAM);
|
||||
ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK);
|
||||
ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT);
|
||||
|
@ -52,6 +53,7 @@ public class DefaultStyles {
|
|||
ParticleStyleManager.registerStyle(HALO);
|
||||
ParticleStyleManager.registerCustomHandledStyle(HURT);
|
||||
ParticleStyleManager.registerCustomHandledStyle(MOVE);
|
||||
ParticleStyleManager.registerStyle(NORMAL);
|
||||
ParticleStyleManager.registerStyle(ORBIT);
|
||||
ParticleStyleManager.registerStyle(POINT);
|
||||
ParticleStyleManager.registerStyle(QUADHELIX);
|
||||
|
|
124
src/com/esophose/playerparticles/styles/ParticleStyleBatman.java
Normal file
124
src/com/esophose/playerparticles/styles/ParticleStyleBatman.java
Normal file
|
@ -0,0 +1,124 @@
|
|||
package com.esophose.playerparticles.styles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.esophose.playerparticles.particles.ParticlePair;
|
||||
import com.esophose.playerparticles.styles.api.PParticle;
|
||||
import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||
import com.esophose.playerparticles.util.VectorUtils;
|
||||
|
||||
public class ParticleStyleBatman implements ParticleStyle {
|
||||
|
||||
private int step = 0;
|
||||
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<PParticle>();
|
||||
|
||||
if (step != 0) return particles;
|
||||
|
||||
// Segment 1
|
||||
for (double x = -7; x <= -3; x += 0.05) {
|
||||
double y = 3 * Math.sqrt(-Math.pow(x / 7, 2) + 1);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
for (double x = 3; x <= 7; x += 0.05) {
|
||||
double y = 3 * Math.sqrt(-Math.pow(x / 7, 2) + 1);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 2
|
||||
for (double x = -7; x <= -4; x += 0.05) {
|
||||
double y = -3 * Math.sqrt(-Math.pow(x / 7, 2) + 1);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
for (double x = 4; x <= 7; x += 0.05) {
|
||||
double y = -3 * Math.sqrt(-Math.pow(x / 7, 2) + 1);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 3
|
||||
for (double x = -4; x <= 4; x += 0.125) {
|
||||
double y = Math.abs(x / 2) - ((3 * Math.sqrt(33) - 7) / 112) * Math.pow(x, 2) + Math.sqrt(1 - Math.pow(Math.abs(Math.abs(x) - 2) - 1, 2)) - 3;
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 4
|
||||
for (double x = -1; x <= -0.75; x += 0.025) {
|
||||
double y = 9 - 8 * Math.abs(x);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
for (double x = 0.75; x <= 1; x += 0.025) {
|
||||
double y = 9 - 8 * Math.abs(x);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 5
|
||||
for (double x = -0.75; x <= -0.5; x += 0.05) {
|
||||
double y = 3 * Math.abs(x) + 0.75;
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
for (double x = 0.5; x <= 0.75; x += 0.05) {
|
||||
double y = 3 * Math.abs(x) + 0.75;
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 6
|
||||
for (double x = -0.5; x <= 0.5; x += 0.2) {
|
||||
double y = 2.25;
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
// Segment 7
|
||||
for (double x = -3; x <= -1; x += 0.02) {
|
||||
double y = 1.5 - 0.5 * Math.abs(x) - ((6 * Math.sqrt(10)) / 14) * (Math.sqrt(3 - Math.pow(x, 2) + 2 * Math.abs(x)) - 2);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
for (double x = 1; x <= 3; x += 0.02) {
|
||||
double y = 1.5 - 0.5 * Math.abs(x) - ((6 * Math.sqrt(10)) / 14) * (Math.sqrt(3 - Math.pow(x, 2) + 2 * Math.abs(x)) - 2);
|
||||
Vector segment = new Vector(x, y, 0).multiply(0.3);
|
||||
VectorUtils.rotateAroundAxisY(segment, -Math.toRadians(location.getYaw()));
|
||||
particles.add(new PParticle(location.clone().add(segment).add(0, 3, 0)));
|
||||
}
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
||||
public void updateTimers() {
|
||||
step = (step + 1) % 20; // Only spawn once per second
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "batman";
|
||||
}
|
||||
|
||||
public boolean canBeFixed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -51,7 +51,7 @@ public class ParticleStyleNormal implements ParticleStyle {
|
|||
case DUST:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
|
||||
case ENCHANT:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.05));
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 1.0));
|
||||
case ENCHANTED_HIT:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case END_ROD:
|
||||
|
@ -93,13 +93,13 @@ public class ParticleStyleNormal implements ParticleStyle {
|
|||
case MYCELIUM:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case NAUTILUS:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.05));
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case NOTE:
|
||||
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
|
||||
case POOF:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case PORTAL:
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.05));
|
||||
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 1.0));
|
||||
case RAIN:
|
||||
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
|
||||
case SMOKE:
|
||||
|
@ -132,7 +132,7 @@ public class ParticleStyleNormal implements ParticleStyle {
|
|||
}
|
||||
|
||||
public String getName() {
|
||||
return "none";
|
||||
return "normal";
|
||||
}
|
||||
|
||||
public boolean canBeFixed() {
|
||||
|
|
|
@ -37,6 +37,12 @@ public class ParticleStyleRings implements ParticleStyle {
|
|||
return particles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an index around the cos/sin array length
|
||||
*
|
||||
* @param index The index to wrap
|
||||
* @return The wrapped index
|
||||
*/
|
||||
private int wrap(int index) {
|
||||
return index % cos.length;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,6 @@ gui-icon:
|
|||
LAVA: MAGMA_CREAM
|
||||
MYCELIUM: MYCELIUM
|
||||
NAUTILUS: HEART_OF_THE_SEA
|
||||
NONE: GLASS_PANE
|
||||
NOTE: NOTE_BLOCK
|
||||
POOF: FIREWORK_STAR
|
||||
PORTAL: OBSIDIAN
|
||||
|
@ -206,7 +205,6 @@ gui-icon:
|
|||
LARGE_SMOKE: WEB
|
||||
LAVA: MAGMA_CREAM
|
||||
MYCELIUM: MYCEL
|
||||
NONE: THIN_GLASS
|
||||
NOTE: NOTE_BLOCK
|
||||
POOF: FIREWORK_CHARGE
|
||||
PORTAL: OBSIDIAN
|
||||
|
@ -221,19 +219,22 @@ gui-icon:
|
|||
WITCH: CAULDRON
|
||||
style: # 1.13 and up
|
||||
ARROWS: BOW
|
||||
BATMAN: COAL
|
||||
BEAM: POWERED_RAIL
|
||||
BLOCKBREAK: IRON_PICKAXE
|
||||
BLOCKEDIT: DISPENSER
|
||||
BLOCKPLACE: OAK_PLANKS
|
||||
CUBE: STONE
|
||||
FEET: GRASS
|
||||
HALO: ENDER_PORTAL_FRAME
|
||||
HALO: END_PORTAL_FRAME
|
||||
HURT: CACTUS
|
||||
MOVE: PISTON
|
||||
NONE: GLASS_PANE
|
||||
ORBIT: ENCHANTING_TABLE
|
||||
POINT: STONE_BUTTON
|
||||
QUADHELIX: NAUTILUS_SHELL
|
||||
NORMAL: DIRT
|
||||
RINGS: STRING
|
||||
SPHERE: HEART_OF_THE_SEA
|
||||
SPIN: BEACON
|
||||
SPIRAL: HOPPER
|
||||
|
@ -242,6 +243,7 @@ gui-icon:
|
|||
WINGS: ELYTRA
|
||||
style-legacy: # 1.9 to 1.12
|
||||
ARROWS: BOW
|
||||
BATMAN: COAL
|
||||
BEAM: POWERED_RAIL
|
||||
BLOCKBREAK: IRON_PICKAXE
|
||||
BLOCKEDIT: DISPENSER
|
||||
|
@ -251,10 +253,11 @@ gui-icon:
|
|||
HALO: ENDER_PORTAL_FRAME
|
||||
HURT: CACTUS
|
||||
MOVE: PISTON_BASE
|
||||
NONE: THIN_GLASS
|
||||
NORMAL: DIRT
|
||||
ORBIT: ENCHANTMENT_TABLE
|
||||
POINT: STONE_BUTTON
|
||||
QUADHELIX: ACTIVATOR_RAIL
|
||||
RINGS: STRING
|
||||
SPHERE: SNOW_BALL
|
||||
SPIN: BEACON
|
||||
SPIRAL: HOPPER
|
||||
|
|
Loading…
Reference in a new issue