mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 11:45:52 -07:00
Re-add missing Player part of the particle API
By: Thinkofdeath <thethinkofdeath@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 7ea952d1568dfa1019fce2c49e5621fd672971c6 Mon Sep 17 00:00:00 2001
|
||||
From 5d9420f4c83ca2ce32ec429a54e3f37c3bdcc0e6 Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
Date: Fri, 20 Dec 2013 21:36:06 +0000
|
||||
Subject: [PATCH] Particle API
|
||||
@@ -116,6 +116,60 @@ index 57dd4e7..948e81d 100644
|
||||
};
|
||||
|
||||
public Spigot spigot()
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 5fe8276..e6fce34 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1292,6 +1292,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false );
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public void playEffect( Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius )
|
||||
+ {
|
||||
+ Validate.notNull( location, "Location cannot be null" );
|
||||
+ Validate.notNull( effect, "Effect cannot be null" );
|
||||
+ Validate.notNull( location.getWorld(), "World cannot be null" );
|
||||
+ Packet packet;
|
||||
+ if ( effect.getType() != Effect.Type.PARTICLE )
|
||||
+ {
|
||||
+ int packetData = effect.getId();
|
||||
+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false );
|
||||
+ } else
|
||||
+ {
|
||||
+ StringBuilder particleFullName = new StringBuilder();
|
||||
+ particleFullName.append( effect.getName() );
|
||||
+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) )
|
||||
+ {
|
||||
+ particleFullName.append( '_' ).append( id );
|
||||
+ }
|
||||
+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) )
|
||||
+ {
|
||||
+ particleFullName.append( '_' ).append( data );
|
||||
+ }
|
||||
+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount );
|
||||
+ }
|
||||
+ int distance;
|
||||
+ radius *= radius;
|
||||
+ if ( getHandle().playerConnection == null )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ if ( !location.getWorld().equals( getWorld() ) )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ distance = (int) getLocation().distanceSquared( location );
|
||||
+ if ( distance <= radius )
|
||||
+ {
|
||||
+ getHandle().playerConnection.sendPacket( packet );
|
||||
+ }
|
||||
+ }
|
||||
};
|
||||
|
||||
public Player.Spigot spigot()
|
||||
--
|
||||
1.8.3.2
|
||||
1.8.5.2.msysgit.0
|
||||
|
||||
|
Reference in New Issue
Block a user