3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

Don't nest if we don't need to when cerealising text components

Dieser Commit ist enthalten in:
kashike 2016-03-08 18:29:39 -08:00
Ursprung 2ec0b0dd30
Commit dcb7708f0c
3 geänderte Dateien mit 43 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 30ba4b11e81ab0057e2762deabc9f74957c60159 Mon Sep 17 00:00:00 2001 From 20711d38315229d4506eb215fb101d4d413a20ca Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com> From: Sudzzy <originmc@outlook.com>
Date: Wed, 2 Mar 2016 14:48:03 -0600 Date: Wed, 2 Mar 2016 14:48:03 -0600
Subject: [PATCH] Disable explosion knockback 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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); 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 {
} }
} }

Datei anzeigen

@ -1,4 +1,4 @@
From ec613026d5eee3c631569a806a4342cca6153443 Mon Sep 17 00:00:00 2001 From c6260f9606fba3d561cb6d4662e211cd6d9c95c6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600 Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2 Subject: [PATCH] Timings v2
@ -290,7 +290,7 @@ index dd3abb8..a0186ef 100644
import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent; 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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; @@ -24,7 +24,8 @@ import org.bukkit.block.BlockFace;
@ -329,7 +329,7 @@ index 768b6e7..2406968 100644
public void recalcPosition() { public void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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; @@ -23,7 +23,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
@ -341,7 +341,7 @@ index aef9cb7..847dafd 100644
public abstract class EntityLiving extends Entity { 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() { public void m() {
@ -349,7 +349,7 @@ index aef9cb7..847dafd 100644
super.m(); super.m();
this.cu(); this.cu();
if (!this.world.isClientSide) { 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 d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1); 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 { } else {
this.bo = 0; this.bo = 0;
} }
@ -368,7 +368,7 @@ index aef9cb7..847dafd 100644
} }
protected float h(float f, float f1) { 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"); this.world.methodProfiler.a("ai");
@ -376,7 +376,7 @@ index aef9cb7..847dafd 100644
if (this.cf()) { if (this.cf()) {
this.bc = false; this.bc = false;
this.bd = 0.0F; 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.doTick();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
@ -384,7 +384,7 @@ index aef9cb7..847dafd 100644
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("jump"); 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.be *= 0.98F;
this.bf *= 0.9F; this.bf *= 0.9F;
this.r(); this.r();

Datei anzeigen

@ -0,0 +1,30 @@
From 1c64bf34796c41e6d950ae814340c172f1f5f6da Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
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<PacketListenerPlayOut> {
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