From aa008dff0f9bedbe88e1fe79831776b0a52eb90a Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 08:32:46 +1100 Subject: Update to Minecraft 1.9 --- nms-patches/EntityTrackerEntry.patch | 96 ++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 54 deletions(-) (limited to 'nms-patches/EntityTrackerEntry.patch') diff --git a/nms-patches/EntityTrackerEntry.patch b/nms-patches/EntityTrackerEntry.patch index 0a6cc779..295003e6 100644 --- a/nms-patches/EntityTrackerEntry.patch +++ b/nms-patches/EntityTrackerEntry.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityTrackerEntry.java +++ b/net/minecraft/server/EntityTrackerEntry.java -@@ -8,6 +8,11 @@ +@@ -9,6 +9,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -11,45 +11,46 @@ + public class EntityTrackerEntry { - private static final Logger p = LogManager.getLogger(); -@@ -74,13 +79,13 @@ - this.broadcast(new PacketPlayOutAttachEntity(0, this.tracker, this.tracker.vehicle)); + private static final Logger c = LogManager.getLogger(); +@@ -79,13 +84,14 @@ + this.broadcast(new PacketPlayOutMount(this.tracker)); } -- if (this.tracker instanceof EntityItemFrame && this.m % 10 == 0) { -+ if (this.tracker instanceof EntityItemFrame /*&& this.m % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block +- if (this.tracker instanceof EntityItemFrame && this.a % 10 == 0) { ++ // PAIL : rename ++ if (this.tracker instanceof EntityItemFrame /*&& this.a % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker; ItemStack itemstack = entityitemframe.getItem(); - if (itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { -+ if (this.m % 10 == 0 && itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks ++ if (this.a % 10 == 0 && itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, this.tracker.world); - Iterator iterator = list.iterator(); + Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); -@@ -116,6 +121,19 @@ - boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0; - boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4; +@@ -120,6 +126,19 @@ + boolean flag = k1 * k1 + l1 * l1 + i2 * i2 >= 128L || this.a % 60 == 0; + boolean flag1 = Math.abs(i1 - this.yRot) >= 1 || Math.abs(j1 - this.xRot) >= 1; + // CraftBukkit start - Code moved from below + if (flag) { -+ this.xLoc = i; -+ this.yLoc = j; -+ this.zLoc = k; ++ this.xLoc = j; ++ this.yLoc = k; ++ this.zLoc = l; + } + + if (flag1) { -+ this.yRot = l; -+ this.xRot = i1; ++ this.yRot = i1; ++ this.xRot = j1; + } + // CraftBukkit end + - if (this.m > 0 || this.tracker instanceof EntityArrow) { - if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x && this.y == this.tracker.onGround) { + if (this.a > 0 || this.tracker instanceof EntityArrow) { + if (k1 >= -32768L && k1 < 32768L && l1 >= -32768L && l1 < 32768L && i2 >= -32768L && i2 < 32768L && this.v <= 400 && !this.x && this.y == this.tracker.onGround) { if ((!flag || !flag1) && !(this.tracker instanceof EntityArrow)) { -@@ -130,6 +148,11 @@ +@@ -134,6 +153,11 @@ } else { this.y = this.tracker.onGround; this.v = 0; @@ -58,28 +59,28 @@ + this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); + } + // CraftBukkit end - object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, this.tracker.onGround); + this.c(); + object = new PacketPlayOutEntityTeleport(this.tracker); } - } -@@ -154,6 +177,7 @@ +@@ -165,6 +189,7 @@ } - this.b(); + this.d(); + /* CraftBukkit start - Code moved up if (flag) { - this.xLoc = i; - this.yLoc = j; -@@ -164,6 +188,7 @@ - this.yRot = l; - this.xRot = i1; + this.xLoc = j; + this.yLoc = k; +@@ -175,6 +200,7 @@ + this.yRot = i1; + this.xRot = j1; } + // CraftBukkit end */ this.x = false; } else { -@@ -195,7 +220,27 @@ +@@ -206,7 +232,27 @@ - ++this.m; + ++this.a; if (this.tracker.velocityChanged) { - this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker)); + // CraftBukkit start - Create PlayerVelocity event @@ -106,7 +107,7 @@ this.tracker.velocityChanged = false; } -@@ -213,6 +258,11 @@ +@@ -224,6 +270,11 @@ Set set = attributemapserver.getAttributes(); if (!set.isEmpty()) { @@ -118,7 +119,7 @@ this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set)); } -@@ -263,6 +313,16 @@ +@@ -276,6 +327,16 @@ if (entityplayer != this.tracker) { if (this.c(entityplayer)) { if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { @@ -133,9 +134,9 @@ + entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId())); + // CraftBukkit end this.trackedPlayers.add(entityplayer); - Packet packet = this.c(); + Packet packet = this.e(); -@@ -281,6 +341,12 @@ +@@ -290,6 +351,12 @@ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).getAttributeMap(); Collection collection = attributemapserver.c(); @@ -148,38 +149,25 @@ if (!collection.isEmpty()) { entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection)); } -@@ -319,6 +385,11 @@ +@@ -328,6 +395,11 @@ } } + // CraftBukkit start - Fix for nonsensical head yaw -+ this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); -+ this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i)); ++ this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); ++ this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) headYaw)); + // CraftBukkit end + if (this.tracker instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) this.tracker; Iterator iterator = entityliving.getEffects().iterator(); -@@ -339,8 +410,10 @@ - } - - public boolean c(EntityPlayer entityplayer) { -- double d0 = entityplayer.locX - (double) (this.xLoc / 32); -- double d1 = entityplayer.locZ - (double) (this.zLoc / 32); -+ // CraftBukkit start - this.*Loc / 30 -> this.tracker.loc* -+ double d0 = entityplayer.locX - this.tracker.locX; -+ double d1 = entityplayer.locZ - this.tracker.locZ; -+ // CraftBukkit end - - return d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b && this.tracker.a(entityplayer); - } -@@ -358,7 +431,10 @@ - - private Packet c() { +@@ -372,7 +444,10 @@ + + private Packet e() { if (this.tracker.dead) { -- EntityTrackerEntry.p.warn("Fetching addPacket for removed entity"); +- EntityTrackerEntry.c.warn("Fetching addPacket for removed entity"); + // CraftBukkit start - Remove useless error spam, just return -+ // EntityTrackerEntry.p.warn("Fetching addPacket for removed entity"); ++ // EntityTrackerEntry.d.warn("Fetching addPacket for removed entity"); + return null; + // CraftBukkit end } -- cgit v1.2.3