From 556695e50185ff595d5b0391a18cf29641c938a5 Mon Sep 17 00:00:00 2001 From: Greg Carlin Date: Sat, 3 Mar 2012 14:40:50 -0500 Subject: [PATCH] Plugin devs can add sound or particle effects to the world (http://wiki.vg/Protocol#Sound.2Fparticle_effect_.280x3D.29 for more information). --- src/World.java | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/World.java b/src/World.java index 744311a7..f894b331 100644 --- a/src/World.java +++ b/src/World.java @@ -1,4 +1,3 @@ - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -12,6 +11,35 @@ */ public class World { private final OWorldServer world; + + public enum Effect { + CLICK_ONE(1001), + CLICK_TWO(1000), + BOW_FIRE(1002), + DOOR_TOGGLE(1003), + EXTINGUISH(1004), + RECORD_PLAY(1005), + GHAST_FIRE(1007), + BLAZE_FIRE_ONE(1008), + BLAZE_FIRE_TWO(1009), + SMOKE(2000), + BLOCK_BREAK(2001), + SPLASH_POTION(2002), + PORTAL(2003), + FLAMES(2004); + } + + public enum Direction { + SOUTH_EAST(0), + SOUTH(1), + SOUTH_WEST(2), + EAST(3), + UP(4), + WEST(5), + NORTH_EAST(6), + NORTH(7), + NORTH_WEST(8); + } public enum Type { NETHER(-1), @@ -823,5 +851,15 @@ public void explode(BaseEntity exploder, double x, double y, double z, float pow public long getRandomSeed() { return world.l(); } + + /** + * Adds a sound/particle effect to the world. + */ + public void addEffectAt(int effect, int data, int x, int y, int z) { + OPacket61DoorChange pkt = new OPacket61DoorChange(effect, x, y, z, data); + for(Player p : etc.getServer().getPlayerList()) { + p.getUser().a.b(pkt); + } + } }