Add style 'batman', this might be a bad idea

This commit is contained in:
Esophose 2018-10-15 22:08:56 -06:00
parent 200103a5c9
commit b4455e6686
6 changed files with 145 additions and 12 deletions

View file

@ -46,9 +46,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent e) { public void onPlayerJoin(PlayerJoinEvent e) {
DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> { DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> { }); // Loads the PPlayer from the database
System.out.println("Loaded");
}); // Loads the PPlayer from the database
} }
/** /**

View file

@ -15,6 +15,7 @@ public class DefaultStyles {
* All the styles that are available by default from this plugin * All the styles that are available by default from this plugin
*/ */
public static final ParticleStyle ARROWS = new ParticleStyleArrows(); 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 BEAM = new ParticleStyleBeam();
public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak(); public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak();
public static final ParticleStyle BLOCKEDIT = new ParticleStyleBlockEdit(); public static final ParticleStyle BLOCKEDIT = new ParticleStyleBlockEdit();
@ -41,8 +42,8 @@ public class DefaultStyles {
* Registered in alphabetical order * Registered in alphabetical order
*/ */
public static void registerStyles() { public static void registerStyles() {
ParticleStyleManager.registerStyle(NORMAL); // Always display none first
ParticleStyleManager.registerStyle(ARROWS); ParticleStyleManager.registerStyle(ARROWS);
ParticleStyleManager.registerStyle(BATMAN);
ParticleStyleManager.registerStyle(BEAM); ParticleStyleManager.registerStyle(BEAM);
ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK); ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK);
ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT); ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT);
@ -52,6 +53,7 @@ public class DefaultStyles {
ParticleStyleManager.registerStyle(HALO); ParticleStyleManager.registerStyle(HALO);
ParticleStyleManager.registerCustomHandledStyle(HURT); ParticleStyleManager.registerCustomHandledStyle(HURT);
ParticleStyleManager.registerCustomHandledStyle(MOVE); ParticleStyleManager.registerCustomHandledStyle(MOVE);
ParticleStyleManager.registerStyle(NORMAL);
ParticleStyleManager.registerStyle(ORBIT); ParticleStyleManager.registerStyle(ORBIT);
ParticleStyleManager.registerStyle(POINT); ParticleStyleManager.registerStyle(POINT);
ParticleStyleManager.registerStyle(QUADHELIX); ParticleStyleManager.registerStyle(QUADHELIX);

View 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;
}
}

View file

@ -51,7 +51,7 @@ public class ParticleStyleNormal implements ParticleStyle {
case DUST: case DUST:
return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0)); return Collections.singletonList(new PParticle(location, 0.5, 0.5, 0.5, 0.0));
case ENCHANT: 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: case ENCHANTED_HIT:
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0)); return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
case END_ROD: case END_ROD:
@ -93,13 +93,13 @@ public class ParticleStyleNormal implements ParticleStyle {
case MYCELIUM: case MYCELIUM:
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0)); return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
case NAUTILUS: 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: case NOTE:
return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0)); return Collections.singletonList(new PParticle(location, 0.6, 0.6, 0.6, 0.0));
case POOF: case POOF:
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0)); return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
case PORTAL: 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: case RAIN:
return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0)); return Collections.singletonList(new PParticle(location, 0.4, 0.4, 0.4, 0.0));
case SMOKE: case SMOKE:
@ -132,7 +132,7 @@ public class ParticleStyleNormal implements ParticleStyle {
} }
public String getName() { public String getName() {
return "none"; return "normal";
} }
public boolean canBeFixed() { public boolean canBeFixed() {

View file

@ -37,6 +37,12 @@ public class ParticleStyleRings implements ParticleStyle {
return particles; 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) { private int wrap(int index) {
return index % cos.length; return index % cos.length;
} }

View file

@ -159,7 +159,6 @@ gui-icon:
LAVA: MAGMA_CREAM LAVA: MAGMA_CREAM
MYCELIUM: MYCELIUM MYCELIUM: MYCELIUM
NAUTILUS: HEART_OF_THE_SEA NAUTILUS: HEART_OF_THE_SEA
NONE: GLASS_PANE
NOTE: NOTE_BLOCK NOTE: NOTE_BLOCK
POOF: FIREWORK_STAR POOF: FIREWORK_STAR
PORTAL: OBSIDIAN PORTAL: OBSIDIAN
@ -206,7 +205,6 @@ gui-icon:
LARGE_SMOKE: WEB LARGE_SMOKE: WEB
LAVA: MAGMA_CREAM LAVA: MAGMA_CREAM
MYCELIUM: MYCEL MYCELIUM: MYCEL
NONE: THIN_GLASS
NOTE: NOTE_BLOCK NOTE: NOTE_BLOCK
POOF: FIREWORK_CHARGE POOF: FIREWORK_CHARGE
PORTAL: OBSIDIAN PORTAL: OBSIDIAN
@ -221,19 +219,22 @@ gui-icon:
WITCH: CAULDRON WITCH: CAULDRON
style: # 1.13 and up style: # 1.13 and up
ARROWS: BOW ARROWS: BOW
BATMAN: COAL
BEAM: POWERED_RAIL BEAM: POWERED_RAIL
BLOCKBREAK: IRON_PICKAXE BLOCKBREAK: IRON_PICKAXE
BLOCKEDIT: DISPENSER BLOCKEDIT: DISPENSER
BLOCKPLACE: OAK_PLANKS BLOCKPLACE: OAK_PLANKS
CUBE: STONE CUBE: STONE
FEET: GRASS FEET: GRASS
HALO: ENDER_PORTAL_FRAME HALO: END_PORTAL_FRAME
HURT: CACTUS HURT: CACTUS
MOVE: PISTON MOVE: PISTON
NONE: GLASS_PANE NONE: GLASS_PANE
ORBIT: ENCHANTING_TABLE ORBIT: ENCHANTING_TABLE
POINT: STONE_BUTTON POINT: STONE_BUTTON
QUADHELIX: NAUTILUS_SHELL QUADHELIX: NAUTILUS_SHELL
NORMAL: DIRT
RINGS: STRING
SPHERE: HEART_OF_THE_SEA SPHERE: HEART_OF_THE_SEA
SPIN: BEACON SPIN: BEACON
SPIRAL: HOPPER SPIRAL: HOPPER
@ -242,6 +243,7 @@ gui-icon:
WINGS: ELYTRA WINGS: ELYTRA
style-legacy: # 1.9 to 1.12 style-legacy: # 1.9 to 1.12
ARROWS: BOW ARROWS: BOW
BATMAN: COAL
BEAM: POWERED_RAIL BEAM: POWERED_RAIL
BLOCKBREAK: IRON_PICKAXE BLOCKBREAK: IRON_PICKAXE
BLOCKEDIT: DISPENSER BLOCKEDIT: DISPENSER
@ -251,10 +253,11 @@ gui-icon:
HALO: ENDER_PORTAL_FRAME HALO: ENDER_PORTAL_FRAME
HURT: CACTUS HURT: CACTUS
MOVE: PISTON_BASE MOVE: PISTON_BASE
NONE: THIN_GLASS NORMAL: DIRT
ORBIT: ENCHANTMENT_TABLE ORBIT: ENCHANTMENT_TABLE
POINT: STONE_BUTTON POINT: STONE_BUTTON
QUADHELIX: ACTIVATOR_RAIL QUADHELIX: ACTIVATOR_RAIL
RINGS: STRING
SPHERE: SNOW_BALL SPHERE: SNOW_BALL
SPIN: BEACON SPIN: BEACON
SPIRAL: HOPPER SPIRAL: HOPPER