From dcb7708f0cb920750882c7b4d27c7438fdceabfb Mon Sep 17 00:00:00 2001 From: kashike Date: Tue, 8 Mar 2016 18:29:39 -0800 Subject: [PATCH] Don't nest if we don't need to when cerealising text components --- .../0040-Disable-explosion-knockback.patch | 8 ++--- Spigot-Server-Patches/0057-Timings-v2.patch | 18 +++++------ ...-don-t-need-to-when-cerealising-text.patch | 30 +++++++++++++++++++ 3 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 Spigot-Server-Patches/0079-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch diff --git a/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch b/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch index 9c58c01d74..7eade4d1aa 100644 --- a/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch +++ b/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch @@ -1,4 +1,4 @@ -From 30ba4b11e81ab0057e2762deabc9f74957c60159 Mon Sep 17 00:00:00 2001 +From 20711d38315229d4506eb215fb101d4d413a20ca Mon Sep 17 00:00:00 2001 From: Sudzzy Date: Wed, 2 Mar 2016 14:48:03 -0600 Subject: [PATCH] Disable explosion knockback @@ -19,10 +19,10 @@ index 1c8e310..694b448 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0a75123..aef9cb7 100644 +index 0248a9e..2e671fd 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -851,12 +851,14 @@ public abstract class EntityLiving extends Entity { +@@ -852,12 +852,14 @@ public abstract class EntityLiving extends Entity { } } @@ -37,7 +37,7 @@ index 0a75123..aef9cb7 100644 this.world.broadcastEntityEffect(this, (byte) 2); } -@@ -880,6 +882,8 @@ public abstract class EntityLiving extends Entity { +@@ -881,6 +883,8 @@ public abstract class EntityLiving extends Entity { } } diff --git a/Spigot-Server-Patches/0057-Timings-v2.patch b/Spigot-Server-Patches/0057-Timings-v2.patch index 1bfa1a91e9..836680d8e4 100644 --- a/Spigot-Server-Patches/0057-Timings-v2.patch +++ b/Spigot-Server-Patches/0057-Timings-v2.patch @@ -1,4 +1,4 @@ -From ec613026d5eee3c631569a806a4342cca6153443 Mon Sep 17 00:00:00 2001 +From c6260f9606fba3d561cb6d4662e211cd6d9c95c6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -290,7 +290,7 @@ index dd3abb8..a0186ef 100644 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 768b6e7..2406968 100644 +index a6c1136..c2771e7 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -24,7 +24,8 @@ import org.bukkit.block.BlockFace; @@ -329,7 +329,7 @@ index 768b6e7..2406968 100644 public void recalcPosition() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index aef9cb7..847dafd 100644 +index 2e671fd..b10475f 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -23,7 +23,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; @@ -341,7 +341,7 @@ index aef9cb7..847dafd 100644 public abstract class EntityLiving extends Entity { -@@ -1685,7 +1685,6 @@ public abstract class EntityLiving extends Entity { +@@ -1686,7 +1686,6 @@ public abstract class EntityLiving extends Entity { } public void m() { @@ -349,7 +349,7 @@ index aef9cb7..847dafd 100644 super.m(); this.cu(); if (!this.world.isClientSide) { -@@ -1758,9 +1757,7 @@ public abstract class EntityLiving extends Entity { +@@ -1759,9 +1758,7 @@ public abstract class EntityLiving extends Entity { } } @@ -359,7 +359,7 @@ index aef9cb7..847dafd 100644 double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); -@@ -1829,8 +1826,6 @@ public abstract class EntityLiving extends Entity { +@@ -1830,8 +1827,6 @@ public abstract class EntityLiving extends Entity { } else { this.bo = 0; } @@ -368,7 +368,7 @@ index aef9cb7..847dafd 100644 } protected float h(float f, float f1) { -@@ -1895,7 +1890,6 @@ public abstract class EntityLiving extends Entity { +@@ -1896,7 +1891,6 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); @@ -376,7 +376,7 @@ index aef9cb7..847dafd 100644 if (this.cf()) { this.bc = false; this.bd = 0.0F; -@@ -1906,7 +1900,6 @@ public abstract class EntityLiving extends Entity { +@@ -1907,7 +1901,6 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.methodProfiler.b(); } @@ -384,7 +384,7 @@ index aef9cb7..847dafd 100644 this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); -@@ -1929,14 +1922,10 @@ public abstract class EntityLiving extends Entity { +@@ -1930,14 +1923,10 @@ public abstract class EntityLiving extends Entity { this.be *= 0.98F; this.bf *= 0.9F; this.r(); diff --git a/Spigot-Server-Patches/0079-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/Spigot-Server-Patches/0079-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch new file mode 100644 index 0000000000..313bb7dae8 --- /dev/null +++ b/Spigot-Server-Patches/0079-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -0,0 +1,30 @@ +From 1c64bf34796c41e6d950ae814340c172f1f5f6da Mon Sep 17 00:00:00 2001 +From: kashike +Date: Tue, 8 Mar 2016 18:28:43 -0800 +Subject: [PATCH] Don't nest if we don't need to when cerealising text + components + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +index c0e1199..bc6c054 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -27,7 +27,14 @@ public class PacketPlayOutChat implements Packet { + public void b(PacketDataSerializer packetdataserializer) throws IOException { + // Spigot start + if (components != null) { +- packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); ++ //packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below ++ // Paper start - don't nest if we don't need to so that we can preserve formatting ++ if (this.components.length == 1) { ++ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0])); ++ } else { ++ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components)); ++ } ++ // Paper end + } else { + packetdataserializer.a(this.a); + } +-- +2.7.2 +