Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
1.15 Update
Browse files Browse the repository at this point in the history
Added documentation and functionality for 1.15
  • Loading branch information
ByteZ1337 committed Jan 18, 2020
1 parent b89d20f commit b462e27
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/main/java/xyz/xenondevs/particle/ParticleConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public class ParticleConstants {
//Constructors
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = version < 13 ?
getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_ENUM, boolean.class, float.class, float.class, float.class, float.class, float.class, float.class, float.class, int.class, int[].class) :
getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_PARAM_CLASS, boolean.class, float.class, float.class, float.class, float.class, float.class, float.class, float.class, int.class);
version < 15 ?
getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_PARAM_CLASS, boolean.class, float.class, float.class, float.class, float.class, float.class, float.class, float.class, int.class)
: getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_PARAM_CLASS, boolean.class, double.class, double.class, double.class, float.class, float.class, float.class, float.class, int.class);
MINECRAFT_KEY_CONSTRUCTOR = getConstructorOrNull(MINECRAFT_KEY_CLASS, String.class);
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull(PARTICLE_PARAM_REDSTONE_CLASS, float.class, float.class, float.class, float.class);
PARTICLE_PARAM_BLOCK_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull(PARTICLE_PARAM_BLOCK_CLASS, PARTICLE_CLASS, BLOCK_DATA_INTERFACE);
Expand Down
70 changes: 58 additions & 12 deletions src/main/java/xyz/xenondevs/particle/ParticleEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@
* <li>{@link #DRAGON_BREATH}</li>
* <li>{@link #DRIP_LAVA}</li>
* <li>{@link #DRIP_WATER}</li>
* <li>{@link #DRIPPING_HONEY}</li>
* <li>{@link #ENCHANTMENT_TABLE}</li>
* <li>{@link #END_ROD}</li>
* <li>{@link #EXPLOSION_HUGE}</li>
* <li>{@link #EXPLOSION_LARGE}</li>
* <li>{@link #EXPLOSION_NORMAL}</li>
* <li>{@link #FALLING_DUST}</li>
* <li>{@link #FALLING_HONEY}</li>
* <li>{@link #FALLING_NECTAR}</li>
* <li>{@link #FIREWORKS_SPARK}</li>
* <li>{@link #FLAME}</li>
* <li>{@link #FOOTSTEP}</li>
* <li>{@link #HEART}</li>
* <li>{@link #ITEM_CRACK}</li>
* <li>{@link #LANDING_HONEY}</li>
* <li>{@link #LAVA}</li>
* <li>{@link #MOB_APPEARANCE}</li>
* <li>{@link #NAUTILUS}</li>
Expand Down Expand Up @@ -400,9 +404,21 @@ public enum ParticleEffect {
*/
DRIP_WATER(version -> version < 8 ? "NONE" : (version < 13 ? "DRIP_WATER" : "dripping_water")),
/**
* Since a 1.15 spigot hasn't been
* released yet there is no
* documentation for this particle.
* In the base game this particle
* is displayed by beehives filled
* with honey. As opposed to the
* {@link #FALLING_HONEY} particles,
* this particle floats in the air
* before falling to the ground.
* <p>
* The particle is displayed clientside
* so it's not used in any nms classes.
* <p>
* <b>Information</b>:
* <li>Appearance: A rectangular honey drop.</li>
* <li>Speed value: Doesn't influence the particle.</li>
* <li>Extra: Spawns a {@link #LANDING_HONEY} particle after landing on a block.</li>
* </ul>
*/
DRIPPING_HONEY(version -> version < 15 ? "NONE" : "dripping_honey"),
/**
Expand Down Expand Up @@ -506,15 +522,35 @@ public enum ParticleEffect {
*/
FALLING_DUST(version -> version < 10 ? "NONE" : (version < 13 ? "FALLING_DUST" : "falling_dust"), REQUIRES_BLOCK),
/**
* Since a 1.15 spigot hasn't been
* released yet there is no
* documentation for this particle.
* In the base game this particle is
* displayed below beehives filled
* with honey. As opposed to the
* {@link #DRIPPING_HONEY} particles,
* this particle falls instantly.
* <p>
* The particle is displayed clientside
* so it's not used in any nms classes.
* <p>
* <b>Information</b>:
* <li>Appearance: A rectangular honey drop.</li>
* <li>Speed value: Doesn't influence the particle.</li>
* <li>Extra: Spawns a {@link #LANDING_HONEY} after landing on a block.</li>
* </ul>
*/
FALLING_HONEY(version -> version < 15 ? "NONE" : "falling_honey"),
/**
* Since a 1.15 spigot hasn't been
* released yet there is no
* documentation for this particle.
* In the base game this particle is
* displayed by bees that have pollen
* and are on their way to the beehive.
* <p>
* The particle originates from the
* nms EntityBee class.
* <p>
* <b>Information</b>:
* <ul>
* <li>Appearance: White square.</li>
* <li>Speed value: Doesn't influence the particle.</li>
* </ul>
*/
FALLING_NECTAR(version -> version < 15 ? "NONE" : "falling_nectar"),
/**
Expand Down Expand Up @@ -603,9 +639,19 @@ public enum ParticleEffect {
*/
ITEM_CRACK(version -> version < 8 ? "NONE" : (version < 13 ? "ITEM_CRACK" : "item"), DIRECTIONAL, REQUIRES_ITEM),
/**
* Since a 1.15 spigot hasn't been
* released yet there is no
* documentation for this particle.
* In the base game this particle
* is displayed after a Falling or
* Dripping Honey particle reaches
* a block.
* <p>
* The particle is displayed clientside
* so it's not used in any nms classes.
* <p>
* <b>Information</b>:
* <ul>
* <li>Appearance: Honey colored lines.</li>
* <li>Speed value: Doesn't influence the particle.</li>
* </ul>
*/
LANDING_HONEY(version -> version < 15 ? "NONE" : "landing_honey"),
/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/xyz/xenondevs/particle/ParticlePacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ private Object createPacket(Object param, float locationX, float locationY, floa
try {
return ReflectionUtils.MINECRAFT_VERSION < 13
? packetConstructor.newInstance(param, true, locationX, locationY, locationZ, offsetX, offsetY, offsetZ, speed, amount, data)
: packetConstructor.newInstance(param, true, locationX, locationY, locationZ, offsetX, offsetY, offsetZ, speed, amount);
: (ReflectionUtils.MINECRAFT_VERSION < 15
? packetConstructor.newInstance(param, true, locationX, locationY, locationZ, offsetX, offsetY, offsetZ, speed, amount)
: packetConstructor.newInstance(param, true, (double) locationX, (double) locationY, (double) locationZ, offsetX, offsetY, offsetZ, speed, amount));
} catch (Exception ex) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ReflectionUtils {
NET_MINECRAFT_SERVER_PACKAGE_PATH = "net.minecraft.server." + version;
CRAFT_BUKKIT_PACKAGE_PATH = "org.bukkit.craftbukkit." + version;
String packageVersion = serverPath.substring(serverPath.lastIndexOf(".") + 2);
MINECRAFT_VERSION = Integer.valueOf(packageVersion.substring(0, packageVersion.lastIndexOf("_")).replace("_", ".").substring(2));
MINECRAFT_VERSION = Integer.parseInt(packageVersion.substring(0, packageVersion.lastIndexOf("_")).replace("_", ".").substring(2));
}

/**
Expand Down

0 comments on commit b462e27

Please sign in to comment.