mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
Remove getCubes patch as under some circumstances it can loop around itself forever. For anyone wishing to reimplement this patch, the rationale behind it is quite simple, get all cubes within each chunk at the same time.
By: md_5 <git@md-5.net>
This commit is contained in:
121
CraftBukkit-Patches/0079-Particle-API.patch
Normal file
121
CraftBukkit-Patches/0079-Particle-API.patch
Normal file
@@ -0,0 +1,121 @@
|
||||
From 695b58dfaee4bba87a6189894d367f87f534aa2d 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
index 7de0de5..7eca388 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
@@ -55,6 +55,8 @@ public class CraftEffect {
|
||||
Validate.isTrue(((Material) data).isBlock(), "Material is not a block!");
|
||||
datavalue = ((Material) data).getId();
|
||||
break;
|
||||
+ case ITEM_BREAK:
|
||||
+ datavalue = ((Material) data).getId();
|
||||
default:
|
||||
datavalue = 0;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 468a4e1..c90dd54 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -779,28 +779,18 @@ public class CraftWorld implements World {
|
||||
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||
}
|
||||
|
||||
- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||
- playEffect(loc, effect, datavalue, radius);
|
||||
+ if (data != null && data.getClass().equals( org.bukkit.material.MaterialData.class )) {
|
||||
+ org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data;
|
||||
+ Validate.isTrue( materialData.getItemType().isBlock(), "Material must be block" );
|
||||
+ spigot().playEffect( loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius );
|
||||
+ } else {
|
||||
+ int dataValue = data == null ? 0 : CraftEffect.getDataValue( effect, data );
|
||||
+ playEffect( loc, effect, dataValue, radius );
|
||||
+ }
|
||||
}
|
||||
|
||||
public void playEffect(Location location, Effect effect, int data, int radius) {
|
||||
- Validate.notNull(location, "Location cannot be null");
|
||||
- Validate.notNull(effect, "Effect cannot be null");
|
||||
- Validate.notNull(location.getWorld(), "World cannot be null");
|
||||
- int packetData = effect.getId();
|
||||
- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false);
|
||||
- int distance;
|
||||
- radius *= radius;
|
||||
-
|
||||
- for (Player player : getPlayers()) {
|
||||
- if (((CraftPlayer) player).getHandle().playerConnection == null) continue;
|
||||
- if (!location.getWorld().equals(player.getWorld())) continue;
|
||||
-
|
||||
- distance = (int) player.getLocation().distanceSquared(location);
|
||||
- if (distance <= radius) {
|
||||
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
- }
|
||||
- }
|
||||
+ spigot().playEffect( location, effect, data, 0, 0, 0, 0, 1, 1, radius );
|
||||
}
|
||||
|
||||
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException {
|
||||
@@ -1286,6 +1276,56 @@ public class CraftWorld implements World {
|
||||
// Spigot start
|
||||
private final Spigot spigot = new Spigot()
|
||||
{
|
||||
+ @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;
|
||||
+ for ( Player player : getPlayers() )
|
||||
+ {
|
||||
+ if ( ( (CraftPlayer) player ).getHandle().playerConnection == null )
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if ( !location.getWorld().equals( player.getWorld() ) )
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ distance = (int) player.getLocation().distanceSquared( location );
|
||||
+ if ( distance <= radius )
|
||||
+ {
|
||||
+ ( (CraftPlayer) player ).getHandle().playerConnection.sendPacket( packet );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void playEffect( Location location, Effect effect )
|
||||
+ {
|
||||
+ CraftWorld.this.playEffect( location, effect, 0 );
|
||||
+ }
|
||||
};
|
||||
|
||||
public Spigot spigot()
|
||||
--
|
||||
1.8.3.2
|
||||
|
Reference in New Issue
Block a user