mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 06:58:11 +02:00
Default to integer instead of hearts to match 1.7 behavior SpigotMC/Spigot@dd5ae56242 Add a tab header / footer packet for use by plugins SpigotMC/Spigot@16a1f257e8 Fix an error with particle handling and add the new 'mobappearance' p... SpigotMC/Spigot@39fdf43ae7 Use correct length when converting maps to 1.8 wire format SpigotMC/Spigot@416bbd0a32 Add title packet for use by plugins SpigotMC/Spigot@a1570f68e5
4469 lines
191 KiB
Diff
4469 lines
191 KiB
Diff
From 9c66dfb14a3824b06707afff337f81484ca53ecf Mon Sep 17 00:00:00 2001
|
|
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
|
Date: Mon, 1 Sep 2014 16:47:48 +1000
|
|
Subject: [PATCH] Snapshot protocol
|
|
|
|
|
|
diff --git a/pom.xml b/pom.xml
|
|
index 6aeffa8..0d00e79 100644
|
|
--- a/pom.xml
|
|
+++ b/pom.xml
|
|
@@ -146,6 +146,7 @@
|
|
<Specification-Version>${api.version}</Specification-Version>
|
|
<Specification-Vendor>Bukkit Team</Specification-Vendor>
|
|
<Sealed>true</Sealed>
|
|
+ <Timestamp>${maven.build.timestamp}</Timestamp>
|
|
</manifestEntries>
|
|
<manifestSections>
|
|
<manifestSection>
|
|
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
|
|
index 395d054..96e40ec 100644
|
|
--- a/src/main/java/net/minecraft/server/DataWatcher.java
|
|
+++ b/src/main/java/net/minecraft/server/DataWatcher.java
|
|
@@ -9,6 +9,7 @@ import java.util.concurrent.locks.ReadWriteLock;
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
|
|
import net.minecraft.util.org.apache.commons.lang3.ObjectUtils;
|
|
+import org.spigotmc.ProtocolData; // Spigot - protocol patch
|
|
|
|
public class DataWatcher {
|
|
|
|
@@ -31,6 +32,19 @@ public class DataWatcher {
|
|
public void a(int i, Object object) {
|
|
int integer = classToId.get(object.getClass()); // Spigot
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ if ( object instanceof ProtocolData.ByteShort
|
|
+ || object instanceof ProtocolData.DualByte
|
|
+ || object instanceof ProtocolData.HiddenByte )
|
|
+ {
|
|
+ integer = classToId.get( Byte.class );
|
|
+ }
|
|
+ if ( object instanceof ProtocolData.IntByte
|
|
+ || object instanceof ProtocolData.DualInt ) {
|
|
+ integer = classToId.get( Integer.class );
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
if (integer == -1) { // Spigot
|
|
throw new IllegalArgumentException("Unknown data type: " + object.getClass());
|
|
} else if (i > 31) {
|
|
@@ -57,19 +71,19 @@ public class DataWatcher {
|
|
}
|
|
|
|
public byte getByte(int i) {
|
|
- return ((Byte) this.i(i).b()).byteValue();
|
|
+ return ((Number) this.i(i).b()).byteValue(); // Spigot - protocol patch
|
|
}
|
|
|
|
public short getShort(int i) {
|
|
- return ((Short) this.i(i).b()).shortValue();
|
|
+ return ((Number) this.i(i).b()).shortValue(); // Spigot - protocol patch
|
|
}
|
|
|
|
public int getInt(int i) {
|
|
- return ((Integer) this.i(i).b()).intValue();
|
|
+ return ((Number) this.i(i).b()).intValue(); // Spigot - protocol patch
|
|
}
|
|
|
|
public float getFloat(int i) {
|
|
- return ((Float) this.i(i).b()).floatValue();
|
|
+ return ((Number) this.i(i).b()).floatValue(); // Spigot - protocol patch
|
|
}
|
|
|
|
public String getString(int i) {
|
|
@@ -80,6 +94,18 @@ public class DataWatcher {
|
|
return (ItemStack) this.i(i).b();
|
|
}
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ public ProtocolData.DualByte getDualByte(int i) {
|
|
+ return (ProtocolData.DualByte) this.i(i).b();
|
|
+ }
|
|
+ public ProtocolData.IntByte getIntByte(int i) {
|
|
+ return (ProtocolData.IntByte) this.i(i).b();
|
|
+ }
|
|
+ public ProtocolData.DualInt getDualInt(int i) {
|
|
+ return (ProtocolData.DualInt) this.i(i).b();
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
private WatchableObject i(int i) {
|
|
this.f.readLock().lock();
|
|
|
|
@@ -119,14 +145,20 @@ public class DataWatcher {
|
|
return this.e;
|
|
}
|
|
|
|
+ // Spigot start - protocol patch
|
|
public static void a(List list, PacketDataSerializer packetdataserializer) {
|
|
+ a(list, packetdataserializer, 5);
|
|
+ }
|
|
+
|
|
+ public static void a(List list, PacketDataSerializer packetdataserializer, int version) {
|
|
+ // Spigot end - protocol patch
|
|
if (list != null) {
|
|
Iterator iterator = list.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
WatchableObject watchableobject = (WatchableObject) iterator.next();
|
|
|
|
- a(packetdataserializer, watchableobject);
|
|
+ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch
|
|
}
|
|
}
|
|
|
|
@@ -171,14 +203,20 @@ public class DataWatcher {
|
|
return arraylist;
|
|
}
|
|
|
|
+ // Spigot start - protocol patch
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
+ a(packetdataserializer, 5);
|
|
+ }
|
|
+
|
|
+ public void a(PacketDataSerializer packetdataserializer, int version) {
|
|
+ // Spigot end
|
|
this.f.readLock().lock();
|
|
Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot
|
|
|
|
while (iterator.hasNext()) {
|
|
WatchableObject watchableobject = (WatchableObject) iterator.next();
|
|
|
|
- a(packetdataserializer, watchableobject);
|
|
+ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch
|
|
}
|
|
|
|
this.f.readLock().unlock();
|
|
@@ -211,25 +249,46 @@ public class DataWatcher {
|
|
return arraylist;
|
|
}
|
|
|
|
- private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject) {
|
|
- int i = (watchableobject.c() << 5 | watchableobject.a() & 31) & 255;
|
|
+ // Spigot start - protocol patch
|
|
+ private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject, int version) {
|
|
+ int type = watchableobject.c();
|
|
+ if (watchableobject.b() instanceof ProtocolData.ByteShort && version >= 16) {
|
|
+ type = 1;
|
|
+ }
|
|
+ if (watchableobject.b() instanceof ProtocolData.IntByte && version >= 28) {
|
|
+ type = 0;
|
|
+ }
|
|
+ if ( version < 16 && watchableobject.b() instanceof ProtocolData.HiddenByte ) return;
|
|
+
|
|
+ int i = (type << 5 | watchableobject.a() & 31) & 255;
|
|
|
|
packetdataserializer.writeByte(i);
|
|
- switch (watchableobject.c()) {
|
|
+ switch (type) {
|
|
case 0:
|
|
- packetdataserializer.writeByte(((Byte) watchableobject.b()).byteValue());
|
|
+ if ( watchableobject.b() instanceof ProtocolData.DualByte )
|
|
+ {
|
|
+ ProtocolData.DualByte dualByte = (ProtocolData.DualByte) watchableobject.b();
|
|
+ packetdataserializer.writeByte( version >= 16 ? dualByte.value2 : dualByte.value );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeByte( ( (Number) watchableobject.b() ).byteValue() );
|
|
+ }
|
|
break;
|
|
|
|
case 1:
|
|
- packetdataserializer.writeShort(((Short) watchableobject.b()).shortValue());
|
|
+ packetdataserializer.writeShort(((Number) watchableobject.b()).shortValue());
|
|
break;
|
|
|
|
case 2:
|
|
- packetdataserializer.writeInt(((Integer) watchableobject.b()).intValue());
|
|
+ int val = ((Number) watchableobject.b()).intValue();
|
|
+ if ( watchableobject.b() instanceof ProtocolData.DualInt && version >= 46 ) {
|
|
+ val = ((ProtocolData.DualInt) watchableobject.b()).value2;
|
|
+ }
|
|
+ packetdataserializer.writeInt(val);
|
|
break;
|
|
|
|
case 3:
|
|
- packetdataserializer.writeFloat(((Float) watchableobject.b()).floatValue());
|
|
+ packetdataserializer.writeFloat(((Number) watchableobject.b()).floatValue());
|
|
break;
|
|
|
|
case 4:
|
|
@@ -254,6 +313,7 @@ public class DataWatcher {
|
|
packetdataserializer.writeInt(chunkcoordinates.z);
|
|
}
|
|
}
|
|
+ // Spigot end
|
|
|
|
public static List b(PacketDataSerializer packetdataserializer) {
|
|
ArrayList arraylist = null;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
index 7ddca48..af73b81 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
@@ -73,11 +73,11 @@ public abstract class EntityAgeable extends EntityCreature {
|
|
|
|
protected void c() {
|
|
super.c();
|
|
- this.datawatcher.a(12, new Integer(0));
|
|
+ this.datawatcher.a(12, new org.spigotmc.ProtocolData.IntByte(0, (byte) 0)); // Spigot - protocol patch
|
|
}
|
|
|
|
public int getAge() {
|
|
- return this.datawatcher.getInt(12);
|
|
+ return this.datawatcher.getIntByte(12).value; // Spigot - protocol patch
|
|
}
|
|
|
|
public void a(int i) {
|
|
@@ -92,7 +92,7 @@ public abstract class EntityAgeable extends EntityCreature {
|
|
}
|
|
|
|
public void setAge(int i) {
|
|
- this.datawatcher.watch(12, Integer.valueOf(i));
|
|
+ this.datawatcher.watch(12, new org.spigotmc.ProtocolData.IntByte(i, (byte) ( i < 0 ? -1 : (i >= 6000 ? 1 : 0)))); // Spigot - protocol patch
|
|
this.a(this.isBaby());
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
index fa6670b..87afc9c 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
@@ -7,6 +7,7 @@ import org.bukkit.Location;
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
|
// CraftBukkit end
|
|
+import org.spigotmc.ProtocolData; // Spigot - protocol patch
|
|
|
|
public class EntityEnderman extends EntityMonster {
|
|
|
|
@@ -33,7 +34,7 @@ public class EntityEnderman extends EntityMonster {
|
|
|
|
protected void c() {
|
|
super.c();
|
|
- this.datawatcher.a(16, new Byte((byte) 0));
|
|
+ this.datawatcher.a( 16, new ProtocolData.ByteShort( (short) 0 ) ); // Spigot - protocol patch, handle metadata change
|
|
this.datawatcher.a(17, new Byte((byte) 0));
|
|
this.datawatcher.a(18, new Byte((byte) 0));
|
|
}
|
|
@@ -315,11 +316,11 @@ public class EntityEnderman extends EntityMonster {
|
|
}
|
|
|
|
public void setCarried(Block block) {
|
|
- this.datawatcher.watch(16, Byte.valueOf((byte) (Block.getId(block) & 255)));
|
|
+ this.datawatcher.watch( 16, new ProtocolData.ByteShort( (short) Block.getId( block ) ) ); // Spigot - protocol patch, handle metadata change
|
|
}
|
|
|
|
public Block getCarried() {
|
|
- return Block.getById(this.datawatcher.getByte(16));
|
|
+ return Block.getById(this.datawatcher.getShort( 16 )); // Spigot - protocol patch, handle metadata change
|
|
}
|
|
|
|
public void setCarriedData(int i) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index 219eb5f..5bb7295 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerBedLeaveEvent;
|
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
// CraftBukkit end
|
|
+import org.spigotmc.ProtocolData; // Spigot - protocol patch
|
|
|
|
public abstract class EntityHuman extends EntityLiving implements ICommandListener {
|
|
|
|
@@ -89,9 +90,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
|
|
|
protected void c() {
|
|
super.c();
|
|
- this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
|
+ this.datawatcher.a( 16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) ); // Spigot - protocol patch, handle metadata usage change (show cape -> collisions)
|
|
this.datawatcher.a(17, Float.valueOf(0.0F));
|
|
this.datawatcher.a(18, Integer.valueOf(0));
|
|
+ this.datawatcher.a( 10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value
|
|
}
|
|
|
|
public boolean by() {
|
|
@@ -1224,15 +1226,23 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
|
return this.sleeping && this.sleepTicks >= 100;
|
|
}
|
|
|
|
- protected void b(int i, boolean flag) {
|
|
- byte b0 = this.datawatcher.getByte(16);
|
|
-
|
|
+ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions)
|
|
+ protected void b(int i, boolean flag, int version) {
|
|
+ ProtocolData.DualByte db = this.datawatcher.getDualByte( 16 );
|
|
+ byte b0 = version >= 16 ? db.value2 : db.value;
|
|
if (flag) {
|
|
- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1 << i)));
|
|
+ b0 = (byte) ( b0 | 1 << i );
|
|
+ } else {
|
|
+ b0 = (byte) (b0 & ~(1 << i));
|
|
+ }
|
|
+ if (version >= 16) {
|
|
+ db.value2 = b0;
|
|
} else {
|
|
- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & ~(1 << i))));
|
|
+ db.value = b0;
|
|
}
|
|
+ this.datawatcher.watch(16, db);
|
|
}
|
|
+ // Spigot end
|
|
|
|
public void b(IChatBaseComponent ichatbasecomponent) {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
index f6c4788..617f7d4 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -93,6 +93,10 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
super.c();
|
|
this.datawatcher.a(11, Byte.valueOf((byte) 0));
|
|
this.datawatcher.a(10, "");
|
|
+ // Spigot start - protocol patch
|
|
+ this.datawatcher.a(3, Byte.valueOf((byte) 0));
|
|
+ this.datawatcher.a(2, "");
|
|
+ // Spigot end
|
|
}
|
|
|
|
public int q() {
|
|
@@ -733,6 +737,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
|
|
public void setCustomName(String s) {
|
|
this.datawatcher.watch(10, s);
|
|
+ this.datawatcher.watch(2, s); // Spigot - protocol patch
|
|
}
|
|
|
|
public String getCustomName() {
|
|
@@ -745,6 +750,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
|
|
public void setCustomNameVisible(boolean flag) {
|
|
this.datawatcher.watch(11, Byte.valueOf((byte) (flag ? 1 : 0)));
|
|
+ this.datawatcher.watch(3, Byte.valueOf((byte) (flag ? 1 : 0))); // Spigot - protocol patch
|
|
}
|
|
|
|
public boolean getCustomNameVisible() {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java
|
|
index d1d73f9..5109b5d 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityItemFrame.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java
|
|
@@ -16,6 +16,10 @@ public class EntityItemFrame extends EntityHanging {
|
|
protected void c() {
|
|
this.getDataWatcher().add(2, 5);
|
|
this.getDataWatcher().a(3, Byte.valueOf((byte) 0));
|
|
+ // Spigot start - protocol patch
|
|
+ this.getDataWatcher().add(8, 5);
|
|
+ this.getDataWatcher().a(9, Byte.valueOf((byte) 0));
|
|
+ // Spigot end
|
|
}
|
|
|
|
public boolean damageEntity(DamageSource damagesource, float f) {
|
|
@@ -99,6 +103,10 @@ public class EntityItemFrame extends EntityHanging {
|
|
|
|
this.getDataWatcher().watch(2, itemstack);
|
|
this.getDataWatcher().update(2);
|
|
+ // Spigot start - protocol patch
|
|
+ this.getDataWatcher().watch(8, itemstack);
|
|
+ this.getDataWatcher().update(8);
|
|
+ // Spigot end
|
|
}
|
|
|
|
public int getRotation() {
|
|
@@ -107,6 +115,7 @@ public class EntityItemFrame extends EntityHanging {
|
|
|
|
public void setRotation(int i) {
|
|
this.getDataWatcher().watch(3, Byte.valueOf((byte) (i % 4)));
|
|
+ this.getDataWatcher().watch(9, Byte.valueOf((byte) ((i % 4) * 2))); // Spigot - protocol patch
|
|
}
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
index 2a1e69d..0710fcc 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
@@ -74,7 +74,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
|
this.datawatcher.a(17, new Integer(0));
|
|
this.datawatcher.a(18, new Integer(1));
|
|
this.datawatcher.a(19, new Float(0.0F));
|
|
- this.datawatcher.a(20, new Integer(0));
|
|
+ this.datawatcher.a(20, new org.spigotmc.ProtocolData.DualInt(0, 0)); // Spigot - protocol patch
|
|
this.datawatcher.a(21, new Integer(6));
|
|
this.datawatcher.a(22, Byte.valueOf((byte) 0));
|
|
}
|
|
@@ -841,12 +841,22 @@ public abstract class EntityMinecartAbstract extends Entity {
|
|
}
|
|
|
|
public void k(int i) {
|
|
- this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.p() << 16));
|
|
+ // Spigot start - protocol patch
|
|
+ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20);
|
|
+ val.value = Integer.valueOf(i & '\uffff' | this.p() << 16);
|
|
+ val.value2 = Integer.valueOf(i & '\uffff' | this.p() << 12);
|
|
+ this.getDataWatcher().watch(20, val);
|
|
+ // Spigot end
|
|
this.a(true);
|
|
}
|
|
|
|
public void l(int i) {
|
|
- this.getDataWatcher().watch(20, Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16));
|
|
+ // Spigot start - protocol patch
|
|
+ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20);
|
|
+ val.value = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16);
|
|
+ val.value2 = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 12);
|
|
+ this.getDataWatcher().watch(20, val);
|
|
+ // Spigot end
|
|
this.a(true);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 413af68..6e80242 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -26,6 +26,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
import org.bukkit.event.inventory.InventoryType;
|
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
// CraftBukkit end
|
|
+import org.spigotmc.ProtocolData; // Spigot - protocol patch
|
|
|
|
public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
|
|
@@ -233,7 +234,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
}
|
|
|
|
if (!arraylist.isEmpty()) {
|
|
- this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist));
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist, this.playerConnection.networkManager.getVersion())); // Spigot - protocol patch
|
|
Iterator iterator2 = arraylist1.iterator();
|
|
|
|
while (iterator2.hasNext()) {
|
|
@@ -594,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
// CraftBukkit end
|
|
|
|
this.nextContainerCounter();
|
|
- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true));
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 0, true)); // Spigot - protocol patch
|
|
this.activeContainer = container; // CraftBukkit - Use container we passed to event
|
|
this.activeContainer.windowId = this.containerCounter;
|
|
this.activeContainer.addSlotListener(this);
|
|
@@ -609,7 +610,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
// CraftBukkit end
|
|
|
|
this.nextContainerCounter();
|
|
- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null));
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 0, s != null)); // Spigot - protocol patch
|
|
this.activeContainer = container; // CraftBukkit - Use container we passed to event
|
|
this.activeContainer.windowId = this.containerCounter;
|
|
this.activeContainer.addSlotListener(this);
|
|
@@ -624,7 +625,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
// CraftBukkit end
|
|
|
|
this.nextContainerCounter();
|
|
- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true));
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 0, true)); // Spigot - protocol patch
|
|
this.activeContainer = container; // CraftBukkit - Use container we passed to event
|
|
this.activeContainer.windowId = this.containerCounter;
|
|
this.activeContainer.addSlotListener(this);
|
|
@@ -764,7 +765,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
|
|
|
|
if (merchantrecipelist != null) {
|
|
- PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer());
|
|
+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer(), playerConnection.networkManager.getVersion()); // Spigot
|
|
|
|
try {
|
|
packetdataserializer.writeInt(this.containerCounter);
|
|
@@ -821,6 +822,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
}
|
|
|
|
public void setContainerData(Container container, int i, int j) {
|
|
+ // Spigot start - protocol patch
|
|
+ if ( container instanceof ContainerFurnace && playerConnection.networkManager.getVersion() >= 47 )
|
|
+ {
|
|
+ switch ( i ) {
|
|
+ case 0:
|
|
+ i = 2;
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, 3, 200));
|
|
+ break;
|
|
+ case 1:
|
|
+ i = 0;
|
|
+ break;
|
|
+ case 2:
|
|
+ i = 1;
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, j));
|
|
}
|
|
|
|
@@ -1004,7 +1021,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
this.server.a(packetplayinsettings.g());
|
|
}
|
|
|
|
- this.b(1, !packetplayinsettings.h());
|
|
+ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions)
|
|
+ if (packetplayinsettings.version < 16)
|
|
+ {
|
|
+ this.b( 1, !packetplayinsettings.h(), packetplayinsettings.version );
|
|
+ } else
|
|
+ {
|
|
+ this.b( 1, false, packetplayinsettings.version );
|
|
+ datawatcher.watch( 10, new ProtocolData.HiddenByte( (byte) packetplayinsettings.flags ) );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public EnumChatVisibility getChatFlags() {
|
|
@@ -1013,6 +1039,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
|
|
public void setResourcePack(String s) {
|
|
this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", s.getBytes(Charsets.UTF_8)));
|
|
+ // Spigot start - protocol patch
|
|
+ if ( playerConnection.networkManager.getVersion() >= 36 )
|
|
+ {
|
|
+ playerConnection.sendPacket( new org.spigotmc.ProtocolInjector.PacketPlayResourcePackSend( s, "thinkislazy" ) );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public ChunkCoordinates getChunkCoordinates() {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index f654d58..46c4fb8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -134,11 +134,11 @@ public class EntityTrackerEntry {
|
|
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) {
|
|
if (flag && flag1) {
|
|
- object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
|
|
+ object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch
|
|
} else if (flag) {
|
|
- object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1);
|
|
+ object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, tracker.onGround); // Spigot - protocol patch
|
|
} else if (flag1) {
|
|
- object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1);
|
|
+ object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch
|
|
}
|
|
} else {
|
|
this.v = 0;
|
|
@@ -147,7 +147,7 @@ public class EntityTrackerEntry {
|
|
this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
|
|
}
|
|
// CraftBukkit end
|
|
- object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1);
|
|
+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch
|
|
}
|
|
}
|
|
|
|
@@ -191,7 +191,7 @@ public class EntityTrackerEntry {
|
|
boolean flag2 = Math.abs(i - this.yRot) >= 4 || Math.abs(j - this.xRot) >= 4;
|
|
|
|
if (flag2) {
|
|
- this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte) i, (byte) j));
|
|
+ this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte) i, (byte) j, tracker.onGround)); // Spigot - protocol patch
|
|
this.yRot = i;
|
|
this.xRot = j;
|
|
}
|
|
@@ -320,6 +320,13 @@ public class EntityTrackerEntry {
|
|
this.trackedPlayers.add(entityplayer);
|
|
Packet packet = this.c();
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ if ( tracker instanceof EntityPlayer )
|
|
+ {
|
|
+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) );
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
entityplayer.playerConnection.sendPacket(packet);
|
|
if (!this.tracker.getDataWatcher().d()) {
|
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(this.tracker.getId(), this.tracker.getDataWatcher(), true));
|
|
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
index 09fdb88..e0a1708 100644
|
|
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
|
@@ -72,7 +72,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- if (packethandshakinginsetprotocol.d() > 5) {
|
|
+ if (packethandshakinginsetprotocol.d() > 5 && packethandshakinginsetprotocol.d() != 47) { // Spigot
|
|
chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot
|
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
|
this.b.close(chatcomponenttext);
|
|
diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java
|
|
index c08ccca..881fd4b 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemWorldMap.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java
|
|
@@ -199,7 +199,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|
public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
|
byte[] abyte = this.getSavedMap(itemstack, world).getUpdatePacket(itemstack, world, entityhuman);
|
|
|
|
- return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte);
|
|
+ return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte, this.getSavedMap(itemstack, world).scale); // Spigot - protocol patch
|
|
}
|
|
|
|
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
|
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
|
index e380a70..bd254de 100644
|
|
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
|
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
|
@@ -10,6 +10,7 @@ import javax.crypto.SecretKey;
|
|
import net.minecraft.util.com.google.common.base.Charsets;
|
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
|
+import net.minecraft.util.io.netty.util.concurrent.Future;
|
|
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
|
import net.minecraft.util.org.apache.commons.lang3.Validate;
|
|
import org.apache.logging.log4j.LogManager;
|
|
@@ -101,6 +102,19 @@ public class LoginListener implements PacketLoginInListener {
|
|
// CraftBukkit end
|
|
} else {
|
|
this.g = EnumProtocolState.e;
|
|
+ // Spigot start
|
|
+ if ( networkManager.getVersion() >= 27 )
|
|
+ {
|
|
+ this.networkManager.handle( new org.spigotmc.ProtocolInjector.PacketLoginCompression( 256 ), new GenericFutureListener()
|
|
+ {
|
|
+ @Override
|
|
+ public void operationComplete(Future future) throws Exception
|
|
+ {
|
|
+ networkManager.enableCompression();
|
|
+ }
|
|
+ } );
|
|
+ }
|
|
+ // Spigot end
|
|
this.networkManager.handle(new PacketLoginOutSuccess(this.i), new GenericFutureListener[0]);
|
|
this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java
|
|
index 770da8f..aa6bbf6 100644
|
|
--- a/src/main/java/net/minecraft/server/MerchantRecipe.java
|
|
+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java
|
|
@@ -5,8 +5,8 @@ public class MerchantRecipe {
|
|
private ItemStack buyingItem1;
|
|
private ItemStack buyingItem2;
|
|
private ItemStack sellingItem;
|
|
- private int uses;
|
|
- private int maxUses;
|
|
+ public int uses; // Spigot - protocol patch
|
|
+ public int maxUses; // Spigot - protocol patch
|
|
|
|
public MerchantRecipe(NBTTagCompound nbttagcompound) {
|
|
this.a(nbttagcompound);
|
|
diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java
|
|
index be6ab25..6ddbf7a 100644
|
|
--- a/src/main/java/net/minecraft/server/MerchantRecipeList.java
|
|
+++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java
|
|
@@ -60,6 +60,13 @@ public class MerchantRecipeList extends ArrayList {
|
|
}
|
|
|
|
packetdataserializer.writeBoolean(merchantrecipe.g());
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 28 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( merchantrecipe.uses );
|
|
+ packetdataserializer.writeInt( merchantrecipe.maxUses );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index b905c6e..8c3950a 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -758,6 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
|
|
|
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring)
|
|
DispenserRegistry.b();
|
|
+ org.spigotmc.ProtocolInjector.inject();
|
|
|
|
try {
|
|
/* CraftBukkit start - Replace everything
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index ae3de2f..0cae021 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -24,6 +24,8 @@ import org.apache.logging.log4j.Marker;
|
|
import org.apache.logging.log4j.MarkerManager;
|
|
// Spigot start
|
|
import com.google.common.collect.ImmutableSet;
|
|
+import org.spigotmc.SpigotCompressor;
|
|
+import org.spigotmc.SpigotDecompressor;
|
|
// Spigot end
|
|
|
|
public class NetworkManager extends SimpleChannelInboundHandler {
|
|
@@ -53,7 +55,7 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
private boolean r;
|
|
// Spigot Start
|
|
public static final AttributeKey<Integer> protocolVersion = new AttributeKey<Integer>("protocol_version");
|
|
- public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5);
|
|
+ public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 47);
|
|
public static final int CURRENT_VERSION = 5;
|
|
public static int getVersion(Channel attr)
|
|
{
|
|
@@ -244,4 +246,18 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
return this.m.remoteAddress();
|
|
}
|
|
// Spigot End
|
|
+
|
|
+
|
|
+ // Spigot start - protocol patch
|
|
+ public void enableCompression() {
|
|
+ // Fix ProtocolLib compatibility
|
|
+ if ( m.pipeline().get("protocol_lib_decoder") != null ) {
|
|
+ m.pipeline().addBefore( "protocol_lib_decoder", "decompress", new SpigotDecompressor() );
|
|
+ } else {
|
|
+ m.pipeline().addBefore( "decoder", "decompress", new SpigotDecompressor() );
|
|
+ }
|
|
+
|
|
+ m.pipeline().addBefore( "encoder", "compress", new SpigotCompressor() );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
|
|
index 592ffc5..7a1e8f0 100644
|
|
--- a/src/main/java/net/minecraft/server/Packet.java
|
|
+++ b/src/main/java/net/minecraft/server/Packet.java
|
|
@@ -26,12 +26,39 @@ public abstract class Packet {
|
|
}
|
|
|
|
public static void a(ByteBuf bytebuf, byte[] abyte) {
|
|
- bytebuf.writeShort(abyte.length);
|
|
+ // Spigot start - protocol patch
|
|
+ if (bytebuf instanceof PacketDataSerializer)
|
|
+ {
|
|
+ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf;
|
|
+ if (packetDataSerializer.version >= 20) {
|
|
+ packetDataSerializer.b( abyte.length );
|
|
+ } else {
|
|
+ bytebuf.writeShort( abyte.length );
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ bytebuf.writeShort( abyte.length );
|
|
+ }
|
|
+ // Spigot end
|
|
bytebuf.writeBytes(abyte);
|
|
}
|
|
|
|
public static byte[] a(ByteBuf bytebuf) throws IOException { // CraftBukkit - added throws
|
|
- short short1 = bytebuf.readShort();
|
|
+ // Spigot start - protocol patch
|
|
+ short short1 = 0;
|
|
+ if (bytebuf instanceof PacketDataSerializer)
|
|
+ {
|
|
+ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf;
|
|
+ if (packetDataSerializer.version >= 20) {
|
|
+ short1 = (short) packetDataSerializer.a();
|
|
+ } else {
|
|
+ short1 = bytebuf.readShort();
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ short1 = bytebuf.readShort();
|
|
+ }
|
|
+ // Spigot end
|
|
|
|
if (short1 < 0) {
|
|
throw new IOException("Key was smaller than nothing! Weird key!");
|
|
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
|
index e4df5b3..451f5fd 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
|
|
@@ -8,6 +8,7 @@ import java.nio.ByteOrder;
|
|
import java.nio.channels.GatheringByteChannel;
|
|
import java.nio.channels.ScatteringByteChannel;
|
|
import java.nio.charset.Charset;
|
|
+import java.util.UUID;
|
|
|
|
import net.minecraft.util.com.google.common.base.Charsets;
|
|
import net.minecraft.util.io.netty.buffer.ByteBuf;
|
|
@@ -16,6 +17,15 @@ import net.minecraft.util.io.netty.buffer.ByteBufProcessor;
|
|
|
|
import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
|
|
|
+// Spigot start - protocol patch
|
|
+import java.io.DataInputStream;
|
|
+import java.io.DataOutputStream;
|
|
+import net.minecraft.util.io.netty.buffer.Unpooled;
|
|
+import net.minecraft.util.io.netty.buffer.ByteBufInputStream;
|
|
+import net.minecraft.util.io.netty.buffer.ByteBufOutputStream;
|
|
+import org.spigotmc.SpigotComponentReverter;
|
|
+// Spigot end
|
|
+
|
|
public class PacketDataSerializer extends ByteBuf {
|
|
|
|
private final ByteBuf a;
|
|
@@ -31,6 +41,32 @@ public class PacketDataSerializer extends ByteBuf {
|
|
this.a = bytebuf;
|
|
this.version = version;
|
|
}
|
|
+
|
|
+ public void writePosition(int x, int y, int z) {
|
|
+ writeLong( ( ( (long) x & 0x3FFFFFFL ) << 38 )
|
|
+ | ( ( (long) y & 0xFFFL ) << 26 )
|
|
+ | ( (long) z & 0x3FFFFFFL ) );
|
|
+ }
|
|
+
|
|
+ public int readPositionX(long val)
|
|
+ {
|
|
+ return (int) ( val >> 38 );
|
|
+ }
|
|
+
|
|
+ public int readPositionY(long val)
|
|
+ {
|
|
+ return (int) (val << 26 >> 52);
|
|
+ }
|
|
+
|
|
+ public int readPositionZ(long val)
|
|
+ {
|
|
+ return (int) (val << 38 >> 38);
|
|
+ }
|
|
+
|
|
+ public void writeUUID(UUID uuid) {
|
|
+ writeLong( uuid.getMostSignificantBits() );
|
|
+ writeLong( uuid.getLeastSignificantBits() );
|
|
+ }
|
|
// Spigot End
|
|
|
|
public static int a(int i) {
|
|
@@ -63,35 +99,75 @@ public class PacketDataSerializer extends ByteBuf {
|
|
this.writeByte(i);
|
|
}
|
|
|
|
- public void a(NBTTagCompound nbttagcompound) {
|
|
- if (nbttagcompound == null) {
|
|
- this.writeShort(-1);
|
|
- } else {
|
|
- byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
|
|
-
|
|
- this.writeShort((short) abyte.length);
|
|
- this.writeBytes(abyte);
|
|
+ // Spigot start - protocol patch
|
|
+ public void a(NBTTagCompound nbttagcompound)
|
|
+ {
|
|
+ if ( version < 28 )
|
|
+ {
|
|
+ if ( nbttagcompound == null )
|
|
+ {
|
|
+ this.writeShort( -1 );
|
|
+ } else
|
|
+ {
|
|
+ byte[] abyte = NBTCompressedStreamTools.a( nbttagcompound );
|
|
+
|
|
+ this.writeShort( (short) abyte.length );
|
|
+ this.writeBytes( abyte );
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ if ( nbttagcompound == null )
|
|
+ {
|
|
+ this.writeByte( 0 );
|
|
+ } else
|
|
+ {
|
|
+ ByteBufOutputStream out = new ByteBufOutputStream( Unpooled.buffer() );
|
|
+ NBTCompressedStreamTools.a( nbttagcompound, (java.io.DataOutput) new DataOutputStream( out ) );
|
|
+ writeBytes( out.buffer() );
|
|
+ out.buffer().release();
|
|
+ }
|
|
}
|
|
}
|
|
|
|
public NBTTagCompound b() {
|
|
- short short1 = this.readShort();
|
|
-
|
|
- if (short1 < 0) {
|
|
- return null;
|
|
+ if ( version < 28 )
|
|
+ {
|
|
+ short short1 = this.readShort();
|
|
+
|
|
+ if ( short1 < 0 )
|
|
+ {
|
|
+ return null;
|
|
+ } else
|
|
+ {
|
|
+ byte[] abyte = new byte[ short1 ];
|
|
+
|
|
+ this.readBytes( abyte );
|
|
+ return NBTCompressedStreamTools.a( abyte, new NBTReadLimiter( 2097152L ) );
|
|
+ }
|
|
} else {
|
|
- byte[] abyte = new byte[short1];
|
|
-
|
|
- this.readBytes(abyte);
|
|
- return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L));
|
|
+ int index = readerIndex();
|
|
+ if (readByte() == 0) {
|
|
+ return null;
|
|
+ }
|
|
+ readerIndex(index);
|
|
+ return NBTCompressedStreamTools.a( new DataInputStream( new ByteBufInputStream( a ) ) );
|
|
}
|
|
}
|
|
+ // Spigot end
|
|
|
|
public void a(ItemStack itemstack) {
|
|
if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
|
this.writeShort(-1);
|
|
} else {
|
|
- this.writeShort(Item.getId(itemstack.getItem()));
|
|
+ // Spigot start - protocol patch
|
|
+ if ( version >= 47 )
|
|
+ {
|
|
+ this.writeShort( org.spigotmc.SpigotDebreakifier.getItemId( Item.getId( itemstack.getItem() ) ) );
|
|
+ } else
|
|
+ {
|
|
+ this.writeShort( Item.getId( itemstack.getItem() ) );
|
|
+ }
|
|
+ // Spigot end
|
|
this.writeByte(itemstack.count);
|
|
this.writeShort(itemstack.getData());
|
|
NBTTagCompound nbttagcompound = null;
|
|
@@ -104,6 +180,31 @@ public class PacketDataSerializer extends ByteBuf {
|
|
nbttagcompound = itemstack.tag;
|
|
}
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ if (nbttagcompound != null && version >= 29 )
|
|
+ {
|
|
+ if ( itemstack.getItem() == Items.WRITTEN_BOOK && nbttagcompound.hasKeyOfType("pages", 9) )
|
|
+ {
|
|
+ nbttagcompound = (NBTTagCompound) nbttagcompound.clone();
|
|
+ NBTTagList nbttaglist = nbttagcompound.getList( "pages", 8 );
|
|
+ NBTTagList newList = new NBTTagList();
|
|
+ for (int i = 0; i < nbttaglist.size(); ++i)
|
|
+ {
|
|
+ IChatBaseComponent[] parts = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( nbttaglist.getString( i ) );
|
|
+ IChatBaseComponent root = parts[0];
|
|
+ for ( int i1 = 1; i1 < parts.length; i1++ )
|
|
+ {
|
|
+ IChatBaseComponent c = parts[ i1 ];
|
|
+ root.a( "\n" );
|
|
+ root.addSibling( c );
|
|
+ }
|
|
+ newList.add( new NBTTagString( ChatSerializer.a( root ) ) );
|
|
+ }
|
|
+ nbttagcompound.set( "pages", newList );
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
this.a(nbttagcompound);
|
|
}
|
|
}
|
|
@@ -120,6 +221,24 @@ public class PacketDataSerializer extends ByteBuf {
|
|
itemstack.tag = this.b();
|
|
// CraftBukkit start
|
|
if (itemstack.tag != null) {
|
|
+
|
|
+ // Spigot start - protocol patch
|
|
+ if ( version >= 29
|
|
+ && itemstack.getItem() == Items.WRITTEN_BOOK
|
|
+ && itemstack.tag.hasKeyOfType("pages", 9) )
|
|
+ {
|
|
+ NBTTagList nbttaglist = itemstack.tag.getList( "pages", 8 );
|
|
+ NBTTagList newList = new NBTTagList();
|
|
+ for (int i = 0; i < nbttaglist.size(); ++i)
|
|
+ {
|
|
+ IChatBaseComponent s = ChatSerializer.a( nbttaglist.getString( i ) );
|
|
+ String newString = SpigotComponentReverter.toLegacy( s );
|
|
+ newList.add( new NBTTagString( newString ) );
|
|
+ }
|
|
+ itemstack.tag.set( "pages", newList );
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java
|
|
index 71ec28c..5213f1f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketDecoder.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketDecoder.java
|
|
@@ -26,7 +26,7 @@ public class PacketDecoder extends ByteToMessageDecoder {
|
|
int i = bytebuf.readableBytes();
|
|
|
|
if (i != 0) {
|
|
- PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf);
|
|
+ PacketDataSerializer packetdataserializer = new PacketDataSerializer( bytebuf, NetworkManager.getVersion( channelhandlercontext.channel() ) ); // Spigot
|
|
int j = packetdataserializer.a();
|
|
Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java
|
|
index 91df585..91d9e58 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java
|
|
@@ -8,8 +8,15 @@ public class PacketPlayInArmAnimation extends Packet {
|
|
public PacketPlayInArmAnimation() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.b = packetdataserializer.readByte();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.b = packetdataserializer.readByte();
|
|
+ } else {
|
|
+ b = 1;
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java
|
|
index 3c5ed45..e85ba8c 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java
|
|
@@ -12,9 +12,20 @@ public class PacketPlayInBlockDig extends Packet {
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
this.e = packetdataserializer.readUnsignedByte();
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.b = packetdataserializer.readUnsignedByte();
|
|
- this.c = packetdataserializer.readInt();
|
|
+ // Spigot start
|
|
+ if ( packetdataserializer.version < 16)
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.b = packetdataserializer.readUnsignedByte();
|
|
+ this.c = packetdataserializer.readInt();
|
|
+ } else
|
|
+ {
|
|
+ long position = packetdataserializer.readLong();
|
|
+ a = packetdataserializer.readPositionX( position );
|
|
+ b = packetdataserializer.readPositionY( position );
|
|
+ c = packetdataserializer.readPositionZ( position );
|
|
+ }
|
|
+ // Spigot end
|
|
this.face = packetdataserializer.readUnsignedByte();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java
|
|
index 701b3a2..b9cea4c 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java
|
|
@@ -14,9 +14,20 @@ public class PacketPlayInBlockPlace extends Packet {
|
|
public PacketPlayInBlockPlace() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.b = packetdataserializer.readUnsignedByte();
|
|
- this.c = packetdataserializer.readInt();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.b = packetdataserializer.readUnsignedByte();
|
|
+ this.c = packetdataserializer.readInt();
|
|
+ } else
|
|
+ {
|
|
+ long position = packetdataserializer.readLong();
|
|
+ a = packetdataserializer.readPositionX( position );
|
|
+ b = packetdataserializer.readPositionY( position );
|
|
+ c = packetdataserializer.readPositionZ( position );
|
|
+ }
|
|
+ // Spigot end
|
|
this.d = packetdataserializer.readUnsignedByte();
|
|
this.e = packetdataserializer.c();
|
|
this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F;
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
|
|
index 5df99a4..54ac5b7 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
|
|
@@ -12,7 +12,15 @@ public class PacketPlayInCustomPayload extends Packet {
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
|
|
this.tag = packetdataserializer.c(20);
|
|
- this.length = packetdataserializer.readShort();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 29 )
|
|
+ {
|
|
+ this.length = packetdataserializer.readShort();
|
|
+ } else
|
|
+ {
|
|
+ this.length = packetdataserializer.readableBytes();
|
|
+ }
|
|
+ // Spigot end
|
|
if (this.length > 0 && this.length < 32767) {
|
|
this.data = new byte[this.length];
|
|
packetdataserializer.readBytes(this.data);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java
|
|
index e05fe07..5e4a377 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java
|
|
@@ -9,9 +9,19 @@ public class PacketPlayInEntityAction extends Packet {
|
|
public PacketPlayInEntityAction() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.animation = packetdataserializer.readByte();
|
|
- this.c = packetdataserializer.readInt();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.animation = packetdataserializer.readByte();
|
|
+ this.c = packetdataserializer.readInt();
|
|
+ } else
|
|
+ {
|
|
+ a = packetdataserializer.a();
|
|
+ animation = packetdataserializer.readUnsignedByte() + 1;
|
|
+ c = packetdataserializer.a();
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java
|
|
index 6dab3b9..5c88cf1 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java
|
|
@@ -11,7 +11,15 @@ public class PacketPlayInKeepAlive extends Packet {
|
|
}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
- this.a = packetdataserializer.readInt();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ } else
|
|
+ {
|
|
+ this.a = packetdataserializer.a();
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java
|
|
index 63b8e4b..2f3a2ec 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java
|
|
@@ -8,8 +8,17 @@ public class PacketPlayInPosition extends PacketPlayInFlying {
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
this.x = packetdataserializer.readDouble();
|
|
- this.y = packetdataserializer.readDouble();
|
|
- this.stance = packetdataserializer.readDouble();
|
|
+ // Spigot start - protocol patch
|
|
+ if (packetdataserializer.version < 16)
|
|
+ {
|
|
+ this.y = packetdataserializer.readDouble();
|
|
+ this.stance = packetdataserializer.readDouble();
|
|
+ } else
|
|
+ {
|
|
+ this.y = packetdataserializer.readDouble();
|
|
+ this.stance = y + 1.62;
|
|
+ }
|
|
+ // Spigot end
|
|
this.z = packetdataserializer.readDouble();
|
|
super.a(packetdataserializer);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java
|
|
index 9a6b726..0266592 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java
|
|
@@ -9,8 +9,17 @@ public class PacketPlayInPositionLook extends PacketPlayInFlying {
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
this.x = packetdataserializer.readDouble();
|
|
- this.y = packetdataserializer.readDouble();
|
|
- this.stance = packetdataserializer.readDouble();
|
|
+ // Spigot start - protocol patch
|
|
+ if (packetdataserializer.version < 16)
|
|
+ {
|
|
+ this.y = packetdataserializer.readDouble();
|
|
+ this.stance = packetdataserializer.readDouble();
|
|
+ } else
|
|
+ {
|
|
+ this.y = packetdataserializer.readDouble();
|
|
+ this.stance = y + 1.62;
|
|
+ }
|
|
+ // Spigot end
|
|
this.z = packetdataserializer.readDouble();
|
|
this.yaw = packetdataserializer.readFloat();
|
|
this.pitch = packetdataserializer.readFloat();
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java
|
|
index 034fd5e..ea51d91 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java
|
|
@@ -11,6 +11,11 @@ public class PacketPlayInSettings extends Packet {
|
|
private EnumDifficulty e;
|
|
private boolean f;
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ public int version;
|
|
+ public int flags;
|
|
+ // Spigot end
|
|
+
|
|
public PacketPlayInSettings() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
|
@@ -18,8 +23,17 @@ public class PacketPlayInSettings extends Packet {
|
|
this.b = packetdataserializer.readByte();
|
|
this.c = EnumChatVisibility.a(packetdataserializer.readByte());
|
|
this.d = packetdataserializer.readBoolean();
|
|
- this.e = EnumDifficulty.getById(packetdataserializer.readByte());
|
|
- this.f = packetdataserializer.readBoolean();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.e = EnumDifficulty.getById( packetdataserializer.readByte() );
|
|
+ this.f = packetdataserializer.readBoolean();
|
|
+ } else
|
|
+ {
|
|
+ flags = packetdataserializer.readUnsignedByte();
|
|
+ }
|
|
+ version = packetdataserializer.version;
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java
|
|
index d304284..c26bf77 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java
|
|
@@ -12,8 +12,17 @@ public class PacketPlayInSteerVehicle extends Packet {
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
this.a = packetdataserializer.readFloat();
|
|
this.b = packetdataserializer.readFloat();
|
|
- this.c = packetdataserializer.readBoolean();
|
|
- this.d = packetdataserializer.readBoolean();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.c = packetdataserializer.readBoolean();
|
|
+ this.d = packetdataserializer.readBoolean();
|
|
+ } else {
|
|
+ int flags = packetdataserializer.readUnsignedByte();
|
|
+ c = (flags & 0x1) != 0;
|
|
+ d = (flags & 0x2) != 0;
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java
|
|
index 476638e..5909876 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java
|
|
@@ -16,6 +16,14 @@ public class PacketPlayInTabComplete extends Packet {
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
|
this.a = packetdataserializer.c(32767);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 37 )
|
|
+ {
|
|
+ if (packetdataserializer.readBoolean()) {
|
|
+ long position = packetdataserializer.readLong();
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java
|
|
index 3458448..f6cf5c8 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java
|
|
@@ -12,13 +12,35 @@ public class PacketPlayInUpdateSign extends Packet {
|
|
public PacketPlayInUpdateSign() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.b = packetdataserializer.readShort();
|
|
- this.c = packetdataserializer.readInt();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.b = packetdataserializer.readShort();
|
|
+ this.c = packetdataserializer.readInt();
|
|
+ } else
|
|
+ {
|
|
+ long position = packetdataserializer.readLong();
|
|
+ a = packetdataserializer.readPositionX( position );
|
|
+ b = packetdataserializer.readPositionY( position );
|
|
+ c = packetdataserializer.readPositionZ( position );
|
|
+ }
|
|
+ // Spigot end
|
|
this.d = new String[4];
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
- this.d[i] = packetdataserializer.c(15);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 21 )
|
|
+ {
|
|
+ this.d[ i ] = packetdataserializer.c( 15 );
|
|
+ } else
|
|
+ {
|
|
+ this.d[ i ] = ChatSerializer.a( packetdataserializer.c( Short.MAX_VALUE ) ).c();
|
|
+ }
|
|
+ if (this.d[i].length() > 15) {
|
|
+ this.d[i] = this.d[i].substring( 0, 15 );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
|
index 39f3037..3f12453 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
|
|
@@ -8,8 +8,24 @@ public class PacketPlayInUseEntity extends Packet {
|
|
public PacketPlayInUseEntity() {}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
- this.a = packetdataserializer.readInt();
|
|
- this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length];
|
|
+ // Spigot start
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ this.a = packetdataserializer.readInt();
|
|
+ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length];
|
|
+ } else {
|
|
+ this.a = packetdataserializer.a();
|
|
+ int val = packetdataserializer.a();
|
|
+ if ( val == 2 ) {
|
|
+ packetdataserializer.readFloat();
|
|
+ packetdataserializer.readFloat();
|
|
+ packetdataserializer.readFloat();
|
|
+ } else
|
|
+ {
|
|
+ this.action = EnumEntityUseAction.values()[ val % EnumEntityUseAction.values().length ];
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java
|
|
index 2bba639..87daa8e 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java
|
|
@@ -3,7 +3,7 @@ package net.minecraft.server;
|
|
public class PacketPlayInWindowClick extends Packet {
|
|
|
|
private int a;
|
|
- private int slot;
|
|
+ public int slot; // Spigot
|
|
private int button;
|
|
private short d;
|
|
private ItemStack item;
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java
|
|
index d7954ff..b361f38 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutBed.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java
|
|
@@ -24,10 +24,19 @@ public class PacketPlayOutBed extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeInt(this.b);
|
|
- packetdataserializer.writeByte(this.c);
|
|
- packetdataserializer.writeInt(this.d);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeInt( this.b );
|
|
+ packetdataserializer.writeByte( this.c );
|
|
+ packetdataserializer.writeInt( this.d );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ packetdataserializer.writePosition( b, c, d );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java
|
|
index cdcdfd6..959d052 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java
|
|
@@ -30,9 +30,17 @@ public class PacketPlayOutBlockAction extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeShort(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
+ // Spigot start
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeShort( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( a, b, c );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeByte(this.d);
|
|
packetdataserializer.writeByte(this.e);
|
|
packetdataserializer.b(Block.getId(this.f) & 4095);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java
|
|
index c93e8bc..1d70129 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java
|
|
@@ -28,9 +28,17 @@ public class PacketPlayOutBlockBreakAnimation extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.b(this.a);
|
|
- packetdataserializer.writeInt(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
- packetdataserializer.writeInt(this.d);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ packetdataserializer.writeInt( this.d );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( b, c, d );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeByte(this.e);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
index 4c622e2..dfa68b0 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
@@ -27,11 +27,22 @@ public class PacketPlayOutBlockChange extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeByte(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
- packetdataserializer.b(Block.getId(this.block));
|
|
- packetdataserializer.writeByte(this.data);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 25 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeByte( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ packetdataserializer.b( Block.getId( this.block ) );
|
|
+ packetdataserializer.writeByte(this.data);
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( a, b, c );
|
|
+ int id = Block.getId( this.block );
|
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data );
|
|
+ packetdataserializer.b( (id << 4) | this.data );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
index f6863bd..fdbdcc6 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
|
|
@@ -27,6 +27,12 @@ public class PacketPlayOutChat extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
packetdataserializer.a(ChatSerializer.a(this.a));
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 16 )
|
|
+ {
|
|
+ packetdataserializer.writeByte(0);
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java
|
|
index 0870ac9..8eff9e5 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java
|
|
@@ -18,8 +18,17 @@ public class PacketPlayOutCollect extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeInt(this.b);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeInt( this.b );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( this.a );
|
|
+ packetdataserializer.b( this.b );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java
|
|
index f2a032e..e6d9165 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java
|
|
@@ -31,8 +31,22 @@ public class PacketPlayOutCustomPayload extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
packetdataserializer.a(this.tag);
|
|
- packetdataserializer.writeShort(this.data.length);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 29 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.data.length );
|
|
+ }
|
|
+ if ( packetdataserializer.version >= 47 && tag.equals( "MC|Brand" ) )
|
|
+ {
|
|
+ packetdataserializer.a( new String( data, "UTF-8" ) );
|
|
+ return;
|
|
+ }
|
|
packetdataserializer.writeBytes(this.data);
|
|
+ if ( packetdataserializer.version >= 29 && tag.equals( "MC|AdvCdm" ) )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( true );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
index dc4259d..749b32d 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
@@ -21,7 +21,15 @@ public class PacketPlayOutEntity extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java
|
|
index 4fa5b82..bef5ae3 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java
|
|
@@ -19,11 +19,22 @@ public class PacketPlayOutEntityDestroy extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeByte(this.a.length);
|
|
-
|
|
- for (int i = 0; i < this.a.length; ++i) {
|
|
- packetdataserializer.writeInt(this.a[i]);
|
|
+ // Spigot start - protocol lib
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeByte( this.a.length );
|
|
+
|
|
+ for ( int i = 0; i < this.a.length; ++i )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a[ i ] );
|
|
+ }
|
|
+ } else {
|
|
+ packetdataserializer.b( a.length );
|
|
+ for ( int i : a ) {
|
|
+ packetdataserializer.b( i );
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java
|
|
index 97752ca..3693850 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java
|
|
@@ -28,10 +28,22 @@ public class PacketPlayOutEntityEffect extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeByte(this.b);
|
|
- packetdataserializer.writeByte(this.c);
|
|
- packetdataserializer.writeShort(this.d);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeByte( this.b );
|
|
+ packetdataserializer.writeByte( this.c );
|
|
+ packetdataserializer.writeShort( this.d );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ packetdataserializer.writeByte( b );
|
|
+ packetdataserializer.writeByte( c );
|
|
+ packetdataserializer.b( d );
|
|
+ packetdataserializer.writeBoolean( false );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java
|
|
index 736e3fd..1ca4f08 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java
|
|
@@ -21,7 +21,14 @@ public class PacketPlayOutEntityEquipment extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt(this.a);
|
|
+ } else {
|
|
+ packetdataserializer.b( this.a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeShort(this.b);
|
|
packetdataserializer.a(this.c);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java
|
|
index 0204062..2e4abe1 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java
|
|
@@ -18,7 +18,15 @@ public class PacketPlayOutEntityHeadRotation extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeByte(this.b);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java
|
|
index 72243ec..617adb3 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java
|
|
@@ -2,15 +2,18 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutEntityLook extends PacketPlayOutEntity {
|
|
|
|
+ private boolean onGround; // Spigot - protocol patch
|
|
+
|
|
public PacketPlayOutEntityLook() {
|
|
this.g = true;
|
|
}
|
|
|
|
- public PacketPlayOutEntityLook(int i, byte b0, byte b1) {
|
|
+ public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch
|
|
super(i);
|
|
this.e = b0;
|
|
this.f = b1;
|
|
this.g = true;
|
|
+ this.onGround = onGround; // Spigot - protocol patch
|
|
}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
@@ -23,6 +26,12 @@ public class PacketPlayOutEntityLook extends PacketPlayOutEntity {
|
|
super.b(packetdataserializer);
|
|
packetdataserializer.writeByte(this.e);
|
|
packetdataserializer.writeByte(this.f);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 22 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( onGround );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public String b() {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java
|
|
index a95877f..c937f59 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java
|
|
@@ -24,8 +24,16 @@ public class PacketPlayOutEntityMetadata extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- DataWatcher.a(this.b, packetdataserializer);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ DataWatcher.a(this.b, packetdataserializer, packetdataserializer.version);
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
index c988bcc..87260d5 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
@@ -8,6 +8,7 @@ public class PacketPlayOutEntityTeleport extends Packet {
|
|
private int d;
|
|
private byte e;
|
|
private byte f;
|
|
+ private boolean onGround; // Spigot - protocol patch
|
|
|
|
public PacketPlayOutEntityTeleport() {}
|
|
|
|
@@ -20,13 +21,14 @@ public class PacketPlayOutEntityTeleport extends Packet {
|
|
this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
|
|
}
|
|
|
|
- public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) {
|
|
+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch
|
|
this.a = i;
|
|
this.b = j;
|
|
this.c = k;
|
|
this.d = l;
|
|
this.e = b0;
|
|
this.f = b1;
|
|
+ this.onGround = onGround; // Spigot - protocol patch
|
|
}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
@@ -39,12 +41,26 @@ public class PacketPlayOutEntityTeleport extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeInt(this.b);
|
|
packetdataserializer.writeInt(this.c);
|
|
packetdataserializer.writeInt(this.d);
|
|
packetdataserializer.writeByte(this.e);
|
|
packetdataserializer.writeByte(this.f);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 22 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( onGround );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java
|
|
index 46f2543..170f27f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java
|
|
@@ -54,7 +54,15 @@ public class PacketPlayOutEntityVelocity extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeShort(this.b);
|
|
packetdataserializer.writeShort(this.c);
|
|
packetdataserializer.writeShort(this.d);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java
|
|
index 4038cc8..35788b2 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java
|
|
@@ -22,8 +22,17 @@ public class PacketPlayOutExperience extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.writeFloat(this.a);
|
|
- packetdataserializer.writeShort(this.c);
|
|
- packetdataserializer.writeShort(this.b);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.c );
|
|
+ packetdataserializer.writeShort( this.b );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( c );
|
|
+ packetdataserializer.b( b );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
index 456532b..e9ff5ee 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
@@ -19,7 +19,15 @@ public class PacketPlayOutKeepAlive extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start
|
|
+ if ( packetdataserializer.version >= 32 )
|
|
+ {
|
|
+ packetdataserializer.b( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public boolean a() {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java
|
|
index 49e0ff5..9ebf9b5 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java
|
|
@@ -54,6 +54,13 @@ public class PacketPlayOutLogin extends Packet {
|
|
packetdataserializer.writeByte(this.e.a());
|
|
packetdataserializer.writeByte(this.f);
|
|
packetdataserializer.a(this.g.name());
|
|
+
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 29 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( false );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java
|
|
index 5980c2d..b45a9ce 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java
|
|
@@ -1,13 +1,19 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.util.Arrays;
|
|
+
|
|
public class PacketPlayOutMap extends Packet {
|
|
|
|
private int a;
|
|
private byte[] b;
|
|
+ private byte scale; // Spigot - protocol patch
|
|
|
|
public PacketPlayOutMap() {}
|
|
|
|
- public PacketPlayOutMap(int i, byte[] abyte) {
|
|
+ // Spigot start - protocol patch
|
|
+ public PacketPlayOutMap(int i, byte[] abyte, byte scale) {
|
|
+ this.scale = scale;
|
|
+ // Spigot end
|
|
this.a = i;
|
|
this.b = abyte;
|
|
}
|
|
@@ -20,8 +26,35 @@ public class PacketPlayOutMap extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.b(this.a);
|
|
- packetdataserializer.writeShort(this.b.length);
|
|
- packetdataserializer.writeBytes(this.b);
|
|
+ if ( packetdataserializer.version < 27 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.b.length );
|
|
+ packetdataserializer.writeBytes( this.b );
|
|
+ } else {
|
|
+ packetdataserializer.writeByte( scale );
|
|
+ if (b[0] == 1) {
|
|
+ int count = (b.length - 1) / 3;
|
|
+ packetdataserializer.b( count );
|
|
+ for (int i = 0; i < count; i++) {
|
|
+ packetdataserializer.writeByte( b[1 + i * 3] );
|
|
+ packetdataserializer.writeByte( b[2 + i * 3] );
|
|
+ packetdataserializer.writeByte( b[3 + i * 3] );
|
|
+ }
|
|
+ } else {
|
|
+ packetdataserializer.b( 0 );
|
|
+ }
|
|
+
|
|
+ if (b[0] == 0) {
|
|
+ packetdataserializer.writeByte( 1 );
|
|
+ int rows = (b.length - 3);
|
|
+ packetdataserializer.writeByte( rows );
|
|
+ packetdataserializer.writeByte( b[1] );
|
|
+ packetdataserializer.writeByte( b[2] );
|
|
+ a( packetdataserializer, Arrays.copyOfRange(b, 3, b.length) );
|
|
+ } else {
|
|
+ packetdataserializer.writeByte( 0 );
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
index 7479600..fcd126b 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
@@ -17,28 +17,24 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
private int h;
|
|
private static byte[] i = new byte[196864];
|
|
|
|
+ private Chunk chunk; // Spigot
|
|
+ private int mask; // Spigot
|
|
+
|
|
public PacketPlayOutMapChunk() {}
|
|
|
|
- public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) {
|
|
+ // Spigot start - protocol patch
|
|
+ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i, int version) {
|
|
+ this.chunk = chunk;
|
|
+ this.mask = i;
|
|
this.a = chunk.locX;
|
|
this.b = chunk.locZ;
|
|
this.g = flag;
|
|
- ChunkMap chunkmap = a(chunk, flag, i);
|
|
- Deflater deflater = new Deflater(4); // Spigot
|
|
+ ChunkMap chunkmap = a(chunk, flag, i, version);
|
|
|
|
this.d = chunkmap.c;
|
|
this.c = chunkmap.b;
|
|
- chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot
|
|
|
|
- try {
|
|
- this.f = chunkmap.a;
|
|
- deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
|
|
- deflater.finish();
|
|
- this.e = new byte[chunkmap.a.length];
|
|
- this.h = deflater.deflate(this.e);
|
|
- } finally {
|
|
- deflater.end();
|
|
- }
|
|
+ this.f = chunkmap.a;
|
|
}
|
|
|
|
public static int c() {
|
|
@@ -89,9 +85,28 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
packetdataserializer.writeInt(this.b);
|
|
packetdataserializer.writeBoolean(this.g);
|
|
packetdataserializer.writeShort((short) (this.c & '\uffff'));
|
|
- packetdataserializer.writeShort((short) (this.d & '\uffff'));
|
|
- packetdataserializer.writeInt(this.h);
|
|
- packetdataserializer.writeBytes(this.e, 0, this.h);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 27 )
|
|
+ {
|
|
+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, false); // Spigot
|
|
+ Deflater deflater = new Deflater(4); // Spigot
|
|
+ try {
|
|
+ deflater.setInput(this.f, 0, this.f.length);
|
|
+ deflater.finish();
|
|
+ this.e = new byte[this.f.length];
|
|
+ this.h = deflater.deflate(this.e);
|
|
+ } finally {
|
|
+ deflater.end();
|
|
+ }
|
|
+ packetdataserializer.writeShort( (short) ( this.d & '\uffff' ) );
|
|
+ packetdataserializer.writeInt( this.h );
|
|
+ packetdataserializer.writeBytes( this.e, 0, this.h );
|
|
+ } else
|
|
+ {
|
|
+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, true); // Spigot
|
|
+ a( packetdataserializer, this.f );
|
|
+ }
|
|
+ // Spigot end - protocol patch
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
@@ -102,7 +117,8 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
return String.format("x=%d, z=%d, full=%b, sects=%d, add=%d, size=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Boolean.valueOf(this.g), Integer.valueOf(this.c), Integer.valueOf(this.d), Integer.valueOf(this.h)});
|
|
}
|
|
|
|
- public static ChunkMap a(Chunk chunk, boolean flag, int i) {
|
|
+ // Spigot start - protocol patch
|
|
+ public static ChunkMap a(Chunk chunk, boolean flag, int i, int version) {
|
|
int j = 0;
|
|
ChunkSection[] achunksection = chunk.getSections();
|
|
int k = 0;
|
|
@@ -125,22 +141,59 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
}
|
|
}
|
|
|
|
- for (l = 0; l < achunksection.length; ++l) {
|
|
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
|
|
- byte[] abyte1 = achunksection[l].getIdArray();
|
|
+ if ( version < 24 )
|
|
+ {
|
|
+ for ( l = 0; l < achunksection.length; ++l )
|
|
+ {
|
|
+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 )
|
|
+ {
|
|
+ byte[] abyte1 = achunksection[ l ].getIdArray();
|
|
|
|
- System.arraycopy(abyte1, 0, abyte, j, abyte1.length);
|
|
- j += abyte1.length;
|
|
+ System.arraycopy( abyte1, 0, abyte, j, abyte1.length );
|
|
+ j += abyte1.length;
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ for ( l = 0; l < achunksection.length; ++l )
|
|
+ {
|
|
+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 )
|
|
+ {
|
|
+ byte[] abyte1 = achunksection[ l ].getIdArray();
|
|
+ NibbleArray nibblearray = achunksection[ l ].getDataArray();
|
|
+ for ( int ind = 0; ind < abyte1.length; ind++ )
|
|
+ {
|
|
+ int id = abyte1[ ind ] & 0xFF;
|
|
+ int px = ind & 0xF;
|
|
+ int py = ( ind >> 8 ) & 0xF;
|
|
+ int pz = ( ind >> 4 ) & 0xF;
|
|
+ int data = nibblearray.a( px, py, pz );
|
|
+ if ( id == 90 && data == 0 )
|
|
+ {
|
|
+ Blocks.PORTAL.updateShape( chunk.world, ( chunk.locX << 4 ) + px, ( l << 4 ) + py, ( chunk.locZ << 4 ) + pz );
|
|
+ } else
|
|
+ {
|
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data );
|
|
+ }
|
|
+ char val = (char) ( id << 4 | data );
|
|
+ abyte[ j++ ] = (byte) ( val & 0xFF );
|
|
+ abyte[ j++ ] = (byte) ( ( val >> 8 ) & 0xFF );
|
|
+ }
|
|
+ }
|
|
}
|
|
}
|
|
|
|
NibbleArray nibblearray;
|
|
|
|
- for (l = 0; l < achunksection.length; ++l) {
|
|
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
|
|
- nibblearray = achunksection[l].getDataArray();
|
|
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
|
- j += nibblearray.a.length;
|
|
+ if ( version < 24 )
|
|
+ {
|
|
+ for ( l = 0; l < achunksection.length; ++l )
|
|
+ {
|
|
+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 )
|
|
+ {
|
|
+ nibblearray = achunksection[ l ].getDataArray();
|
|
+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
|
|
+ j += nibblearray.a.length;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -162,7 +215,7 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
}
|
|
}
|
|
|
|
- if (k > 0) {
|
|
+ if (k > 0 && version < 24) {
|
|
for (l = 0; l < achunksection.length; ++l) {
|
|
if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) {
|
|
nibblearray = achunksection[l].getExtendedIdArray();
|
|
@@ -183,7 +236,9 @@ public class PacketPlayOutMapChunk extends Packet {
|
|
System.arraycopy(abyte, 0, chunkmap.a, 0, j);
|
|
return chunkmap;
|
|
}
|
|
+ // Spigot end - protocol patch
|
|
|
|
+ @Override
|
|
public void handle(PacketListener packetlistener) {
|
|
this.a((PacketPlayOutListener) packetlistener);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
|
index 30bf8a7..b9db43c 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
|
@@ -30,7 +30,7 @@ public class PacketPlayOutMapChunkBulk extends Packet {
|
|
|
|
public PacketPlayOutMapChunkBulk() {}
|
|
|
|
- public PacketPlayOutMapChunkBulk(List list) {
|
|
+ public PacketPlayOutMapChunkBulk(List list, int version) {
|
|
int i = list.size();
|
|
|
|
this.a = new int[i];
|
|
@@ -43,7 +43,7 @@ public class PacketPlayOutMapChunkBulk extends Packet {
|
|
|
|
for (int k = 0; k < i; ++k) {
|
|
Chunk chunk = (Chunk) list.get(k);
|
|
- ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff');
|
|
+ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff', version);
|
|
|
|
// Spigot start
|
|
world = chunk.world;
|
|
@@ -89,7 +89,7 @@ public class PacketPlayOutMapChunkBulk extends Packet {
|
|
int finalBufferSize = 0;
|
|
// Obfuscate all sections
|
|
for (int i = 0; i < a.length; i++) {
|
|
- world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world);
|
|
+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, false);
|
|
finalBufferSize += inflatedBuffers[i].length;
|
|
}
|
|
|
|
@@ -174,17 +174,34 @@ public class PacketPlayOutMapChunkBulk extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - throws IOException
|
|
- compress(); // CraftBukkit
|
|
- packetdataserializer.writeShort(this.a.length);
|
|
- packetdataserializer.writeInt(this.size);
|
|
- packetdataserializer.writeBoolean(this.h);
|
|
- packetdataserializer.writeBytes(this.buffer, 0, this.size);
|
|
-
|
|
- for (int i = 0; i < this.a.length; ++i) {
|
|
- packetdataserializer.writeInt(this.a[i]);
|
|
- packetdataserializer.writeInt(this.b[i]);
|
|
- packetdataserializer.writeShort((short) (this.c[i] & '\uffff'));
|
|
- packetdataserializer.writeShort((short) (this.d[i] & '\uffff'));
|
|
+ if ( packetdataserializer.version < 27 )
|
|
+ {
|
|
+ compress(); // CraftBukkit
|
|
+ packetdataserializer.writeShort( this.a.length );
|
|
+ packetdataserializer.writeInt( this.size );
|
|
+ packetdataserializer.writeBoolean( this.h );
|
|
+ packetdataserializer.writeBytes( this.buffer, 0, this.size );
|
|
+
|
|
+ for (int i = 0; i < this.a.length; ++i) {
|
|
+ packetdataserializer.writeInt(this.a[i]);
|
|
+ packetdataserializer.writeInt(this.b[i]);
|
|
+ packetdataserializer.writeShort((short) (this.c[i] & '\uffff'));
|
|
+ packetdataserializer.writeShort( (short) ( this.d[i] & '\uffff' ) );
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( this.h );
|
|
+ packetdataserializer.b( this.a.length );
|
|
+
|
|
+ for (int i = 0; i < this.a.length; ++i) {
|
|
+ packetdataserializer.writeInt(this.a[i]);
|
|
+ packetdataserializer.writeInt(this.b[i]);
|
|
+ packetdataserializer.writeShort((short) (this.c[i] & '\uffff'));
|
|
+ }
|
|
+ for (int i = 0; i < this.a.length; ++i) {
|
|
+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, true);
|
|
+ packetdataserializer.writeBytes( inflatedBuffers[i] );
|
|
+ }
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
index 0a12db5..1e86a8f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
@@ -13,26 +13,44 @@ public class PacketPlayOutMultiBlockChange extends Packet {
|
|
private ChunkCoordIntPair b;
|
|
private byte[] c;
|
|
private int d;
|
|
+ // Spigot start - protocol patch
|
|
+ private short[] ashort;
|
|
+ private int[] blocks;
|
|
+ private Chunk chunk;
|
|
+ // Spigot end
|
|
|
|
public PacketPlayOutMultiBlockChange() {}
|
|
|
|
public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) {
|
|
+ // Spigot start
|
|
+ this.ashort = ashort;
|
|
+ this.chunk = chunk;
|
|
+ // Spigot end
|
|
this.b = new ChunkCoordIntPair(chunk.locX, chunk.locZ);
|
|
this.d = i;
|
|
int j = 4 * i;
|
|
|
|
- try {
|
|
- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(j);
|
|
- DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
|
|
+ try
|
|
+ {
|
|
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream( j );
|
|
+ DataOutputStream dataoutputstream = new DataOutputStream( bytearrayoutputstream );
|
|
|
|
+ // Spigot start
|
|
+ blocks = new int[i];
|
|
for (int k = 0; k < i; ++k) {
|
|
int l = ashort[k] >> 12 & 15;
|
|
int i1 = ashort[k] >> 8 & 15;
|
|
int j1 = ashort[k] & 255;
|
|
|
|
dataoutputstream.writeShort(ashort[k]);
|
|
- dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15));
|
|
+ int blockId = Block.getId( chunk.getType( l, j1, i1 ) );
|
|
+ int data = chunk.getData( l, j1, i1 );
|
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( blockId, data );
|
|
+ int id = ( blockId & 4095 ) << 4 | data & 15;
|
|
+ dataoutputstream.writeShort((short) id);
|
|
+ blocks[k] = id;
|
|
}
|
|
+ // Spigot end
|
|
|
|
this.c = bytearrayoutputstream.toByteArray();
|
|
if (this.c.length != j) {
|
|
@@ -56,15 +74,31 @@ public class PacketPlayOutMultiBlockChange extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.b.x);
|
|
- packetdataserializer.writeInt(this.b.z);
|
|
- packetdataserializer.writeShort((short) this.d);
|
|
- if (this.c != null) {
|
|
- packetdataserializer.writeInt(this.c.length);
|
|
- packetdataserializer.writeBytes(this.c);
|
|
+ // Spigot start - protocol patch
|
|
+ if (packetdataserializer.version < 25)
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.b.x );
|
|
+ packetdataserializer.writeInt( this.b.z );
|
|
+ packetdataserializer.writeShort( (short) this.d );
|
|
+ if ( this.c != null )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.c.length );
|
|
+ packetdataserializer.writeBytes( this.c );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeInt( 0 );
|
|
+ }
|
|
} else {
|
|
- packetdataserializer.writeInt(0);
|
|
+ packetdataserializer.writeInt( this.b.x );
|
|
+ packetdataserializer.writeInt( this.b.z );
|
|
+ packetdataserializer.b( this.d );
|
|
+ for ( int i = 0; i < d; i++ )
|
|
+ {
|
|
+ packetdataserializer.writeShort( ashort[ i ] );
|
|
+ packetdataserializer.b( blocks[ i ] );
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
|
index ccd4cec..80857c9 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
|
@@ -64,8 +64,10 @@ public class PacketPlayOutNamedEntitySpawn extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
|
|
packetdataserializer.b(this.a);
|
|
- UUID uuid = this.b.getId();
|
|
|
|
+ UUID uuid = this.b.getId();
|
|
+ // Spigot start - protocol patch
|
|
+ if (packetdataserializer.version < 20) {
|
|
packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot
|
|
packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters
|
|
if (packetdataserializer.version >= 5 ) { // Spigot
|
|
@@ -79,14 +81,26 @@ public class PacketPlayOutNamedEntitySpawn extends Packet {
|
|
packetdataserializer.a(property.getValue());
|
|
packetdataserializer.a(property.getSignature());
|
|
}
|
|
- } // Spigot
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeUUID( uuid );
|
|
+ }
|
|
+ // Spigot end
|
|
|
|
packetdataserializer.writeInt(this.c);
|
|
packetdataserializer.writeInt(this.d);
|
|
packetdataserializer.writeInt(this.e);
|
|
packetdataserializer.writeByte(this.f);
|
|
packetdataserializer.writeByte(this.g);
|
|
- packetdataserializer.writeShort(this.h);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 47 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( org.spigotmc.SpigotDebreakifier.getItemId( this.h ) );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.h );
|
|
+ }
|
|
this.i.a(packetdataserializer);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
|
index d67a364..052da02 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
|
@@ -25,9 +25,17 @@ public class PacketPlayOutOpenSignEditor extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeInt(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeInt( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( a, b, c );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void handle(PacketListener packetlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java
|
|
index 860592d..8e9ea33 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java
|
|
@@ -1,5 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
|
+
|
|
import java.io.IOException;
|
|
|
|
public class PacketPlayOutOpenWindow extends Packet {
|
|
@@ -43,15 +45,68 @@ public class PacketPlayOutOpenWindow extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.writeByte(this.a);
|
|
- packetdataserializer.writeByte(this.b);
|
|
- packetdataserializer.a(this.c);
|
|
- packetdataserializer.writeByte(this.d);
|
|
- packetdataserializer.writeBoolean(this.e);
|
|
- if (this.b == 11) {
|
|
- packetdataserializer.writeInt(this.f);
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeByte( this.a );
|
|
+ packetdataserializer.writeByte( this.b );
|
|
+ packetdataserializer.a( this.c );
|
|
+ packetdataserializer.writeByte( this.d );
|
|
+ packetdataserializer.writeBoolean( this.e );
|
|
+ if ( this.b == 11 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.f );
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeByte( a );
|
|
+ packetdataserializer.a( getInventoryString( b ) );
|
|
+ if ( e )
|
|
+ {
|
|
+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( c )[ 0 ] ) );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.a( ChatSerializer.a( new ChatMessage( c ) ) );
|
|
+ }
|
|
+ packetdataserializer.writeByte( d );
|
|
+ if ( this.b == 11 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.f );
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // Spigot start - protocol patch
|
|
+ private String getInventoryString(int b)
|
|
+ {
|
|
+ switch ( b ) {
|
|
+ case 0:
|
|
+ return "minecraft:chest";
|
|
+ case 1:
|
|
+ return "minecraft:crafting_table";
|
|
+ case 2:
|
|
+ return "minecraft:furnace";
|
|
+ case 3:
|
|
+ return "minecraft:dispenser";
|
|
+ case 4:
|
|
+ return "minecraft:enchanting_table";
|
|
+ case 5:
|
|
+ return "minecraft:brewing_stand";
|
|
+ case 6:
|
|
+ return "minecraft:villager";
|
|
+ case 7:
|
|
+ return "minecraft:beacon";
|
|
+ case 8:
|
|
+ return "minecraft:anvil";
|
|
+ case 9:
|
|
+ return "minecraft:hopper";
|
|
+ case 10:
|
|
+ return "minecraft:dropper";
|
|
+ case 11:
|
|
+ return "EntityHorse";
|
|
}
|
|
+ throw new IllegalArgumentException( "Unknown type " + b );
|
|
}
|
|
+ // Spigot end
|
|
|
|
public void handle(PacketListener packetlistener) {
|
|
this.a((PacketPlayOutListener) packetlistener);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java
|
|
index 7cae01e..adb8e8f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java
|
|
@@ -1,31 +1,138 @@
|
|
package net.minecraft.server;
|
|
|
|
import java.io.IOException;
|
|
+// Spigot start - protocol patch
|
|
+import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
+import net.minecraft.util.com.mojang.authlib.properties.Property;
|
|
+import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
|
|
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
|
|
|
public class PacketPlayOutPlayerInfo extends Packet {
|
|
|
|
- private String a;
|
|
- private boolean b;
|
|
- private int c;
|
|
+ private static final int ADD_PLAYER = 0;
|
|
+ private static final int UPDATE_GAMEMODE = 1;
|
|
+ private static final int UPDATE_LATENCY = 2;
|
|
+ private static final int UPDATE_DISPLAY_NAME = 3;
|
|
+ private static final int REMOVE_PLAYER = 4;
|
|
+
|
|
+ private int action;
|
|
+ // private int length; We don't batch (yet)
|
|
+ private GameProfile player;
|
|
+
|
|
+ private int gamemode;
|
|
+ private int ping;
|
|
+ private String username;
|
|
|
|
public PacketPlayOutPlayerInfo() {}
|
|
|
|
+ /* removed to force breaking
|
|
public PacketPlayOutPlayerInfo(String s, boolean flag, int i) {
|
|
this.a = s;
|
|
this.b = flag;
|
|
this.c = i;
|
|
}
|
|
+ */
|
|
+
|
|
+ public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) {
|
|
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
|
+ packet.action = ADD_PLAYER;
|
|
+ packet.username = player.listName;
|
|
+ packet.player = player.getProfile();
|
|
+ packet.ping = player.ping;
|
|
+ packet.gamemode = player.playerInteractManager.getGameMode().getId();
|
|
+ return packet;
|
|
+ }
|
|
+
|
|
+ public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) {
|
|
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
|
+ packet.action = UPDATE_LATENCY;
|
|
+ packet.username = player.listName;
|
|
+ packet.player = player.getProfile();
|
|
+ packet.ping = player.ping;
|
|
+ return packet;
|
|
+ }
|
|
+
|
|
+ public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) {
|
|
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
|
+ packet.action = UPDATE_GAMEMODE;
|
|
+ packet.username = player.listName;
|
|
+ packet.player = player.getProfile();
|
|
+ packet.gamemode = player.playerInteractManager.getGameMode().getId();
|
|
+ return packet;
|
|
+ }
|
|
+
|
|
+ public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
|
|
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
|
+ packet.action = UPDATE_DISPLAY_NAME;
|
|
+ packet.username = player.listName;
|
|
+ packet.player = player.getProfile();
|
|
+ return packet;
|
|
+ }
|
|
+
|
|
+ public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) {
|
|
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
|
+ packet.action = REMOVE_PLAYER;
|
|
+ packet.username = player.listName;
|
|
+ packet.player = player.getProfile();
|
|
+ return packet;
|
|
+ }
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- this.a = packetdataserializer.c(16);
|
|
- this.b = packetdataserializer.readBoolean();
|
|
- this.c = packetdataserializer.readShort();
|
|
+ // Not needed
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.a(this.a);
|
|
- packetdataserializer.writeBoolean(this.b);
|
|
- packetdataserializer.writeShort(this.c);
|
|
+ if ( packetdataserializer.version >= 20 )
|
|
+ {
|
|
+ packetdataserializer.b( action );
|
|
+ packetdataserializer.b( 1 );
|
|
+ packetdataserializer.writeUUID( player.getId() );
|
|
+ switch ( action )
|
|
+ {
|
|
+ case ADD_PLAYER:
|
|
+ packetdataserializer.a( player.getName() );
|
|
+ PropertyMap properties = player.getProperties();
|
|
+ packetdataserializer.b( properties.size() );
|
|
+ for ( Property property : properties.values() )
|
|
+ {
|
|
+ packetdataserializer.a( property.getName() );
|
|
+ packetdataserializer.a( property.getValue() );
|
|
+ packetdataserializer.writeBoolean( property.hasSignature() );
|
|
+ if ( property.hasSignature() )
|
|
+ {
|
|
+ packetdataserializer.a( property.getSignature() );
|
|
+ }
|
|
+ }
|
|
+ packetdataserializer.b( gamemode );
|
|
+ packetdataserializer.b( ping );
|
|
+ packetdataserializer.writeBoolean( username != null );
|
|
+ if ( username != null )
|
|
+ {
|
|
+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) );
|
|
+ }
|
|
+ break;
|
|
+ case UPDATE_GAMEMODE:
|
|
+ packetdataserializer.b( gamemode );
|
|
+ break;
|
|
+ case UPDATE_LATENCY:
|
|
+ packetdataserializer.b( ping );
|
|
+ break;
|
|
+ case UPDATE_DISPLAY_NAME:
|
|
+ packetdataserializer.writeBoolean( username != null );
|
|
+ if ( username != null )
|
|
+ {
|
|
+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) );
|
|
+ }
|
|
+ break;
|
|
+ case REMOVE_PLAYER:
|
|
+ break;
|
|
+
|
|
+ }
|
|
+ } else {
|
|
+ packetdataserializer.a( username );
|
|
+ packetdataserializer.writeBoolean( action != REMOVE_PLAYER );
|
|
+ packetdataserializer.writeShort( ping );
|
|
+ }
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
@@ -36,3 +143,4 @@ public class PacketPlayOutPlayerInfo extends Packet {
|
|
this.a((PacketPlayOutListener) packetlistener);
|
|
}
|
|
}
|
|
+// Spigot end
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
index f2234f0..b3c0ccf 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
@@ -30,12 +30,20 @@ public class PacketPlayOutPosition extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
+ // Spigot start - protocol patch
|
|
packetdataserializer.writeDouble(this.a);
|
|
- packetdataserializer.writeDouble(this.b);
|
|
+ packetdataserializer.writeDouble(this.b - (packetdataserializer.version >= 16 ? 1.62 : 0));
|
|
packetdataserializer.writeDouble(this.c);
|
|
packetdataserializer.writeFloat(this.d);
|
|
packetdataserializer.writeFloat(this.e);
|
|
- packetdataserializer.writeBoolean(this.f);
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( this.f );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeByte( 0 );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
index d83ae7b..37e5a38 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
@@ -2,13 +2,16 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity {
|
|
|
|
+ private boolean onGround; // Spigot - protocol patch
|
|
+
|
|
public PacketPlayOutRelEntityMove() {}
|
|
|
|
- public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2) {
|
|
+ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2, boolean onGround) { // Spigot - protocol patch
|
|
super(i);
|
|
this.b = b0;
|
|
this.c = b1;
|
|
this.d = b2;
|
|
+ this.onGround = onGround; // Spigot - protocol patch
|
|
}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
@@ -23,6 +26,12 @@ public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity {
|
|
packetdataserializer.writeByte(this.b);
|
|
packetdataserializer.writeByte(this.c);
|
|
packetdataserializer.writeByte(this.d);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 22 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( onGround );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public String b() {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java
|
|
index 9155c96..2ad234b 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java
|
|
@@ -2,11 +2,13 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity {
|
|
|
|
+ private boolean onGround; // Spigot - protocol patch
|
|
+
|
|
public PacketPlayOutRelEntityMoveLook() {
|
|
this.g = true;
|
|
}
|
|
|
|
- public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4) {
|
|
+ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4, boolean onGround) { // Spigot - protocol patch
|
|
super(i);
|
|
this.b = b0;
|
|
this.c = b1;
|
|
@@ -14,6 +16,7 @@ public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity {
|
|
this.e = b3;
|
|
this.f = b4;
|
|
this.g = true;
|
|
+ this.onGround = onGround; // Spigot - protocol patch
|
|
}
|
|
|
|
public void a(PacketDataSerializer packetdataserializer) {
|
|
@@ -32,6 +35,12 @@ public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity {
|
|
packetdataserializer.writeByte(this.d);
|
|
packetdataserializer.writeByte(this.e);
|
|
packetdataserializer.writeByte(this.f);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 22 )
|
|
+ {
|
|
+ packetdataserializer.writeBoolean( onGround );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public String b() {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java
|
|
index 9041f82..f2c38c5 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java
|
|
@@ -18,7 +18,14 @@ public class PacketPlayOutRemoveEntityEffect extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeByte(this.b);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java
|
|
index 7403dbd..700e94e 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java
|
|
@@ -23,9 +23,22 @@ public class PacketPlayOutScoreboardObjective extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.a(this.a);
|
|
- packetdataserializer.a(this.b);
|
|
- packetdataserializer.writeByte(this.c);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.a( this.a );
|
|
+ packetdataserializer.a( this.b );
|
|
+ packetdataserializer.writeByte( this.c );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.a( a );
|
|
+ packetdataserializer.writeByte( c );
|
|
+ if ( c == 0 || c == 2 ) {
|
|
+ packetdataserializer.a( b );
|
|
+ packetdataserializer.a( "integer" );
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java
|
|
index f50851b..446e308 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java
|
|
@@ -35,12 +35,25 @@ public class PacketPlayOutScoreboardScore extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.a(this.a);
|
|
- packetdataserializer.writeByte(this.d);
|
|
- if (this.d != 1) {
|
|
- packetdataserializer.a(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
+ packetdataserializer.a( this.a );
|
|
+ packetdataserializer.writeByte( this.d );
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ if ( this.d != 1 )
|
|
+ {
|
|
+ packetdataserializer.a( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ }
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.a( this.b );
|
|
+ if ( this.d != 1 )
|
|
+ {
|
|
+ packetdataserializer.b( c );
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
index e8f0971..abba46c 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
|
|
@@ -71,10 +71,25 @@ public class PacketPlayOutScoreboardTeam extends Packet {
|
|
packetdataserializer.a(this.c);
|
|
packetdataserializer.a(this.d);
|
|
packetdataserializer.writeByte(this.g);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 16 )
|
|
+ {
|
|
+ packetdataserializer.a( "always" );
|
|
+ packetdataserializer.writeByte( EnumChatFormat.WHITE.ordinal() );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
if (this.f == 0 || this.f == 3 || this.f == 4) {
|
|
- packetdataserializer.writeShort(this.e.size());
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.e.size() );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( e.size() );
|
|
+ }
|
|
+ // Spigot end
|
|
Iterator iterator = this.e.iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java
|
|
index 5aeb4e3..8893b61 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java
|
|
@@ -2,8 +2,8 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutSetSlot extends Packet {
|
|
|
|
- private int a;
|
|
- private int b;
|
|
+ public int a; // Spigot
|
|
+ public int b; // Spigot
|
|
private ItemStack c;
|
|
|
|
public PacketPlayOutSetSlot() {}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
|
index 17302e0..dcf1204 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
|
@@ -84,6 +84,39 @@ public class PacketPlayOutSpawnEntity extends Packet {
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.b(this.a);
|
|
packetdataserializer.writeByte(this.j);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( j == 71 && packetdataserializer.version >= 28 )
|
|
+ {
|
|
+ // North: 0 256
|
|
+ // West: 64 192
|
|
+ // South: 128 128
|
|
+ // East: 192 320
|
|
+ switch ( k ) {
|
|
+ case 0:
|
|
+ d += 32;
|
|
+ i = 0;
|
|
+ break;
|
|
+ case 1:
|
|
+ b -= 32;
|
|
+ i = 64;
|
|
+ break;
|
|
+ case 2:
|
|
+ d -= 32;
|
|
+ i = 128;
|
|
+ break;
|
|
+ case 3:
|
|
+ b += 32;
|
|
+ i = 192;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if ( j == 70 && packetdataserializer.version >= 36 )
|
|
+ {
|
|
+ int id = k & 0xFFFF;
|
|
+ int data = k >> 16;
|
|
+ k = id | ( data << 12 );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeInt(this.b);
|
|
packetdataserializer.writeInt(this.c);
|
|
packetdataserializer.writeInt(this.d);
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
|
index 435fe8d..98b4d97 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
|
@@ -91,7 +91,7 @@ public class PacketPlayOutSpawnEntityLiving extends Packet {
|
|
packetdataserializer.writeShort(this.f);
|
|
packetdataserializer.writeShort(this.g);
|
|
packetdataserializer.writeShort(this.h);
|
|
- this.l.a(packetdataserializer);
|
|
+ this.l.a(packetdataserializer, packetdataserializer.version); // Spigot
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java
|
|
index 2c86b81..47efb16 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java
|
|
@@ -34,10 +34,40 @@ public class PacketPlayOutSpawnEntityPainting extends Packet {
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
packetdataserializer.b(this.a);
|
|
packetdataserializer.a(this.f);
|
|
- packetdataserializer.writeInt(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
- packetdataserializer.writeInt(this.d);
|
|
- packetdataserializer.writeInt(this.e);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version >= 28 )
|
|
+ {
|
|
+ // North: 0 256
|
|
+ // West: 64 192
|
|
+ // South: 128 128
|
|
+ // East: 192 320
|
|
+ switch ( e ) {
|
|
+ case 0:
|
|
+ d += 1;
|
|
+ break;
|
|
+ case 1:
|
|
+ b -= 1;
|
|
+ break;
|
|
+ case 2:
|
|
+ d -= 1;
|
|
+ break;
|
|
+ case 3:
|
|
+ b += 1;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ packetdataserializer.writeInt( this.d );
|
|
+ packetdataserializer.writeInt( this.e );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( b, c, d );
|
|
+ packetdataserializer.writeByte( e );
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java
|
|
index 92e4036..191d213 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java
|
|
@@ -21,9 +21,16 @@ public class PacketPlayOutSpawnPosition extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.x);
|
|
- packetdataserializer.writeInt(this.y);
|
|
- packetdataserializer.writeInt(this.z);
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.x );
|
|
+ packetdataserializer.writeInt( this.y );
|
|
+ packetdataserializer.writeInt( this.z );
|
|
+
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( x, y, z );
|
|
+ }
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
|
index 3887d15..ed54ddd 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
|
@@ -27,9 +27,17 @@ public class PacketPlayOutTileEntityData extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
- packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeShort(this.b);
|
|
- packetdataserializer.writeInt(this.c);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ packetdataserializer.writeShort( this.b );
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( a, b, c );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeByte((byte) this.d);
|
|
packetdataserializer.a(this.e);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java
|
|
index 7b288ad..0c38297 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java
|
|
@@ -46,7 +46,15 @@ public class PacketPlayOutUpdateAttributes extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.writeInt(this.a);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16)
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( a );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeInt(this.b.size());
|
|
Iterator iterator = this.b.iterator();
|
|
|
|
@@ -55,7 +63,14 @@ public class PacketPlayOutUpdateAttributes extends Packet {
|
|
|
|
packetdataserializer.a(attributesnapshot.a());
|
|
packetdataserializer.writeDouble(attributesnapshot.b());
|
|
- packetdataserializer.writeShort(attributesnapshot.c().size());
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( attributesnapshot.c().size() );
|
|
+ } else {
|
|
+ packetdataserializer.b( attributesnapshot.c().size() );
|
|
+ }
|
|
+ // Spigot end
|
|
Iterator iterator1 = attributesnapshot.c().iterator();
|
|
|
|
while (iterator1.hasNext()) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
|
|
index 72b3219..37ede05 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
|
|
@@ -22,7 +22,15 @@ public class PacketPlayOutUpdateHealth extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.writeFloat(this.a);
|
|
- packetdataserializer.writeShort(this.b);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeShort( this.b );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.b( this.b );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeFloat(this.c);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java
|
|
index 7c5d2eb..e68fc18 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java
|
|
@@ -2,6 +2,8 @@ package net.minecraft.server;
|
|
|
|
import java.io.IOException;
|
|
|
|
+import org.bukkit.craftbukkit.util.CraftChatMessage; // Spigot - protocol patch
|
|
+
|
|
public class PacketPlayOutUpdateSign extends Packet {
|
|
|
|
private int x;
|
|
@@ -30,13 +32,28 @@ public class PacketPlayOutUpdateSign extends Packet {
|
|
}
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.writeInt(this.x);
|
|
- packetdataserializer.writeShort(this.y);
|
|
- packetdataserializer.writeInt(this.z);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.x );
|
|
+ packetdataserializer.writeShort( this.y );
|
|
+ packetdataserializer.writeInt( this.z );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( x, y, z );
|
|
+ }
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
- packetdataserializer.a(this.lines[i]);
|
|
+ if ( packetdataserializer.version < 21 )
|
|
+ {
|
|
+ packetdataserializer.a( this.lines[ i ] );
|
|
+ } else
|
|
+ {
|
|
+ String line = ChatSerializer.a( CraftChatMessage.fromString( this.lines[ i ] )[ 0 ] );
|
|
+ packetdataserializer.a( line );
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
|
|
index 7ea6702..2a96e2d 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
|
|
@@ -4,8 +4,8 @@ import java.util.List;
|
|
|
|
public class PacketPlayOutWindowItems extends Packet {
|
|
|
|
- private int a;
|
|
- private ItemStack[] b;
|
|
+ public int a; // Spigot
|
|
+ public ItemStack[] b; // Spigot
|
|
|
|
public PacketPlayOutWindowItems() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java
|
|
index f1001c6..a9577b8 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java
|
|
@@ -31,9 +31,17 @@ public class PacketPlayOutWorldEvent extends Packet {
|
|
|
|
public void b(PacketDataSerializer packetdataserializer) {
|
|
packetdataserializer.writeInt(this.a);
|
|
- packetdataserializer.writeInt(this.c);
|
|
- packetdataserializer.writeByte(this.d & 255);
|
|
- packetdataserializer.writeInt(this.e);
|
|
+ // Spigot start - protocol patch
|
|
+ if ( packetdataserializer.version < 16 )
|
|
+ {
|
|
+ packetdataserializer.writeInt( this.c );
|
|
+ packetdataserializer.writeByte( this.d & 255 );
|
|
+ packetdataserializer.writeInt( this.e );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writePosition( c, d, e );
|
|
+ }
|
|
+ // Spigot end
|
|
packetdataserializer.writeInt(this.b);
|
|
packetdataserializer.writeBoolean(this.f);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java
|
|
index 29f0c99..07b564f 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java
|
|
@@ -1,6 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
import java.io.IOException;
|
|
+import java.util.HashMap; // Spigot
|
|
|
|
public class PacketPlayOutWorldParticles extends Packet {
|
|
|
|
@@ -40,8 +41,19 @@ public class PacketPlayOutWorldParticles extends Packet {
|
|
this.i = packetdataserializer.readInt();
|
|
}
|
|
|
|
+ // Spigot start - protocol patch
|
|
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
- packetdataserializer.a(this.a);
|
|
+ String[] parts = this.a.split( "_" );
|
|
+ Particle particle = Particle.find( parts[ 0 ] );
|
|
+ if (particle == null) particle = Particle.CRIT;
|
|
+ if ( packetdataserializer.version < 17 )
|
|
+ {
|
|
+ packetdataserializer.a( this.a );
|
|
+ } else
|
|
+ {
|
|
+ packetdataserializer.writeInt( particle.ordinal() );
|
|
+ packetdataserializer.writeBoolean( false );
|
|
+ }
|
|
packetdataserializer.writeFloat(this.b);
|
|
packetdataserializer.writeFloat(this.c);
|
|
packetdataserializer.writeFloat(this.d);
|
|
@@ -50,7 +62,31 @@ public class PacketPlayOutWorldParticles extends Packet {
|
|
packetdataserializer.writeFloat(this.g);
|
|
packetdataserializer.writeFloat(this.h);
|
|
packetdataserializer.writeInt(this.i);
|
|
+ if ( packetdataserializer.version >= 17 )
|
|
+ {
|
|
+ for ( int i = 0; i < particle.extra; i++ )
|
|
+ {
|
|
+ int toWrite = 0;
|
|
+ if ( parts.length - 1 > i )
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ toWrite = Integer.parseInt( parts[i + 1] );
|
|
+ if ( particle.extra == 1 && parts.length == 3 )
|
|
+ {
|
|
+ i++;
|
|
+ toWrite = toWrite | (Integer.parseInt( parts[i + 1] ) << 12);
|
|
+ }
|
|
+ } catch ( NumberFormatException e )
|
|
+ {
|
|
+
|
|
+ }
|
|
+ }
|
|
+ packetdataserializer.b( toWrite );
|
|
+ }
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
|
|
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
packetplayoutlistener.a(this);
|
|
@@ -59,4 +95,80 @@ public class PacketPlayOutWorldParticles extends Packet {
|
|
public void handle(PacketListener packetlistener) {
|
|
this.a((PacketPlayOutListener) packetlistener);
|
|
}
|
|
+
|
|
+ // Spigot start - protocol patch
|
|
+ private enum Particle
|
|
+ {
|
|
+ EXPLOSION_NORMAL( "explode" ),
|
|
+ EXPLOSION_LARGE( "largeexplode" ),
|
|
+ EXPLOSION_HUGE( "hugeexplosion" ),
|
|
+ FIREWORKS_SPARK( "fireworksSpark" ),
|
|
+ WATER_BUBBLE( "bubble" ),
|
|
+ WATER_SPLASH( "splash" ),
|
|
+ WATER_WAKE( "wake" ),
|
|
+ SUSPENDED( "suspended" ),
|
|
+ SUSPENDED_DEPTH( "depthsuspend" ),
|
|
+ CRIT( "crit" ),
|
|
+ CRIT_MAGIC( "magicCrit" ),
|
|
+ SMOKE_NORMAL( "smoke" ),
|
|
+ SMOKE_LARGE( "largesmoke" ),
|
|
+ SPELL( "spell" ),
|
|
+ SPELL_INSTANT( "instantSpell" ),
|
|
+ SPELL_MOB( "mobSpell" ),
|
|
+ SPELL_MOB_AMBIENT( "mobSpellAmbient" ),
|
|
+ SPELL_WITCH( "witchMagic" ),
|
|
+ DRIP_WATER( "dripWater" ),
|
|
+ DRIP_LAVA( "dripLava" ),
|
|
+ VILLAGER_ANGRY( "angryVillager" ),
|
|
+ VILLAGER_HAPPY( "happyVillager" ),
|
|
+ TOWN_AURA( "townaura" ),
|
|
+ NOTE( "note" ),
|
|
+ PORTAL( "portal" ),
|
|
+ ENCHANTMENT_TABLE( "enchantmenttable" ),
|
|
+ FLAME( "flame" ),
|
|
+ LAVA( "lava" ),
|
|
+ FOOTSTEP( "footstep" ),
|
|
+ CLOUD( "cloud" ),
|
|
+ REDSTONE( "reddust" ),
|
|
+ SNOWBALL( "snowballpoof" ),
|
|
+ SNOW_SHOVEL( "snowshovel" ),
|
|
+ SLIME( "slime" ),
|
|
+ HEART( "heart" ),
|
|
+ BARRIER( "barrier" ),
|
|
+ ICON_CRACK( "iconcrack", 2 ),
|
|
+ BLOCK_CRACK( "blockcrack", 1 ),
|
|
+ BLOCK_DUST( "blockdust", 1 ),
|
|
+ WATER_DROP( "droplet" ),
|
|
+ ITEM_TAKE( "take" ),
|
|
+ MOB_APPEARANCE( "mobappearance" );
|
|
+
|
|
+ public final String name;
|
|
+ public final int extra;
|
|
+ private final static HashMap<String, Particle> particleMap = new HashMap<String, Particle>();
|
|
+
|
|
+ Particle(String name)
|
|
+ {
|
|
+ this( name, 0 );
|
|
+ }
|
|
+
|
|
+ Particle(String name, int extra)
|
|
+ {
|
|
+ this.name = name;
|
|
+ this.extra = extra;
|
|
+ }
|
|
+
|
|
+ public static Particle find(String part)
|
|
+ {
|
|
+ return particleMap.get( part );
|
|
+ }
|
|
+
|
|
+ static
|
|
+ {
|
|
+ for ( Particle particle : values() )
|
|
+ {
|
|
+ particleMap.put( particle.name, particle );
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
index f5afcb7..07b9d35 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
@@ -85,7 +85,7 @@ class PlayerChunk {
|
|
Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z);
|
|
|
|
if (chunk.isReady()) {
|
|
- entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0));
|
|
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0, entityplayer.playerConnection.networkManager.getVersion())); // Spigot - protocol patch
|
|
}
|
|
|
|
this.players.remove(entityplayer); // CraftBukkit
|
|
@@ -164,8 +164,21 @@ class PlayerChunk {
|
|
if (this.dirtyCount == 64) {
|
|
i = this.location.x * 16;
|
|
j = this.location.z * 16;
|
|
- this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
|
|
+ // Spigot start - protocol patch
|
|
+ //this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
|
|
|
|
+ Chunk chunk = PlayerChunkMap.a( this.playerChunkMap ).getChunkAt( this.location.x, this.location.z );
|
|
+ for (int idx = 0; idx < this.b.size(); ++idx) {
|
|
+ EntityPlayer entityplayer = (EntityPlayer) this.b.get(idx);
|
|
+
|
|
+ if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
|
|
+ entityplayer.playerConnection.sendPacket(
|
|
+ new PacketPlayOutMapChunk( chunk, (this.f == 0xFFFF), this.f, entityplayer.playerConnection.networkManager.getVersion())
|
|
+ );
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // Spigot end - protocol patch
|
|
for (k = 0; k < 16; ++k) {
|
|
if ((this.f & 1 << k) != 0) {
|
|
l = k << 4;
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 188393c..10faa8c 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -747,6 +747,36 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
}
|
|
|
|
public void sendPacket(Packet packet) {
|
|
+ // Spigot start - protocol patch
|
|
+ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 )
|
|
+ {
|
|
+ if ( packet instanceof PacketPlayOutWindowItems )
|
|
+ {
|
|
+ PacketPlayOutWindowItems items = (PacketPlayOutWindowItems) packet;
|
|
+ if ( player.activeContainer instanceof ContainerEnchantTable
|
|
+ && player.activeContainer.windowId == items.a )
|
|
+ {
|
|
+ ItemStack[] old = items.b;
|
|
+ items.b = new ItemStack[ old.length + 1 ];
|
|
+ items.b[ 0 ] = old[ 0 ];
|
|
+ System.arraycopy( old, 1, items.b, 2, old.length - 1 );
|
|
+ items.b[ 1 ] = new ItemStack( Items.INK_SACK, 3, 4 );
|
|
+
|
|
+ }
|
|
+ } else if ( packet instanceof PacketPlayOutSetSlot )
|
|
+ {
|
|
+ PacketPlayOutSetSlot items = (PacketPlayOutSetSlot) packet;
|
|
+ if ( player.activeContainer instanceof ContainerEnchantTable
|
|
+ && player.activeContainer.windowId == items.a )
|
|
+ {
|
|
+ if ( items.b >= 1 )
|
|
+ {
|
|
+ items.b++;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
if (packet instanceof PacketPlayOutChat) {
|
|
PacketPlayOutChat packetplayoutchat = (PacketPlayOutChat) packet;
|
|
EnumChatVisibility enumchatvisibility = this.player.getChatFlags();
|
|
@@ -1108,6 +1138,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
}
|
|
|
|
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
|
+ if ( packetplayinuseentity.c() == null ) return; // Spigot - protocol patch
|
|
if (this.player.dead) return; // CraftBukkit
|
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
|
Entity entity = packetplayinuseentity.a((World) worldserver);
|
|
@@ -1237,6 +1268,21 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
}
|
|
|
|
InventoryView inventory = this.player.activeContainer.getBukkitView();
|
|
+ // Spigot start - protocol patch
|
|
+ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 )
|
|
+ {
|
|
+ if ( player.activeContainer instanceof ContainerEnchantTable )
|
|
+ {
|
|
+ if ( packetplayinwindowclick.slot == 1 )
|
|
+ {
|
|
+ return;
|
|
+ } else if ( packetplayinwindowclick.slot > 1 )
|
|
+ {
|
|
+ packetplayinwindowclick.slot--;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.d());
|
|
|
|
InventoryClickEvent event = null;
|
|
@@ -1587,7 +1633,20 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
if (entityitem != null) {
|
|
entityitem.e();
|
|
}
|
|
+ // Spigot start - protocol patch
|
|
+ } else
|
|
+ {
|
|
+ if ( flag1 )
|
|
+ {
|
|
+ player.playerConnection.sendPacket(
|
|
+ new PacketPlayOutSetSlot( 0,
|
|
+ packetplayinsetcreativeslot.c(),
|
|
+ player.defaultContainer.getSlot( packetplayinsetcreativeslot.c() ).getItem()
|
|
+ )
|
|
+ );
|
|
+ }
|
|
}
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
|
|
@@ -1721,7 +1780,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
// CraftBukkit end
|
|
|
|
if ("MC|BEdit".equals(packetplayincustompayload.c())) {
|
|
- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()));
|
|
+ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch
|
|
|
|
try {
|
|
itemstack = packetdataserializer.c();
|
|
@@ -1753,7 +1812,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
|
|
return;
|
|
} else if ("MC|BSign".equals(packetplayincustompayload.c())) {
|
|
- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()));
|
|
+ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch
|
|
|
|
try {
|
|
itemstack = packetdataserializer.c();
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
index b4461b9..036be30 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
@@ -328,6 +328,13 @@ public class PlayerInteractManager {
|
|
int j = itemstack.getData();
|
|
ItemStack itemstack1 = itemstack.a(world, entityhuman);
|
|
|
|
+ // Spigot start - protocol patch
|
|
+ if ( itemstack1 != null && itemstack1.getItem() == Items.WRITTEN_BOOK )
|
|
+ {
|
|
+ player.playerConnection.sendPacket( new PacketPlayOutCustomPayload( "MC|BOpen", new byte[0] ) );
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i && itemstack1.n() <= 0 && itemstack1.getData() == j)) {
|
|
return false;
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index 75ea5c9..0359cb3 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -284,7 +284,7 @@ public abstract class PlayerList {
|
|
// CraftBukkit end
|
|
|
|
// CraftBukkit start - sendAll above replaced with this loop
|
|
- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, true, 1000);
|
|
+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer( entityplayer ); // Spigot - protocol patch
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
|
|
|
@@ -302,7 +302,7 @@ public abstract class PlayerList {
|
|
continue;
|
|
}
|
|
// .name -> .listName
|
|
- entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
|
|
+ entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch
|
|
// CraftBukkit end
|
|
}
|
|
}
|
|
@@ -338,7 +338,7 @@ public abstract class PlayerList {
|
|
|
|
// CraftBukkit start - .name -> .listName, replace sendAll with loop
|
|
// this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), false, 9999));
|
|
- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, false, 9999);
|
|
+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.removePlayer( entityplayer ); // Spigot - protocol patch
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
|
|
|
@@ -830,7 +830,7 @@ public abstract class PlayerList {
|
|
EntityPlayer player = (EntityPlayer) this.players.get( currentPing );
|
|
if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 )
|
|
{
|
|
- Packet packet = new PacketPlayOutPlayerInfo( player.listName, true, player.ping );
|
|
+ Packet packet = PacketPlayOutPlayerInfo.updatePing( player ); // Spigot - protocol patch
|
|
for ( EntityPlayer splayer : (List<EntityPlayer>) this.players )
|
|
{
|
|
if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) )
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index e5f73fc..0c4976d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -1,13 +1,16 @@
|
|
package org.bukkit.craftbukkit;
|
|
|
|
-import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
-import java.io.InputStreamReader;
|
|
+import java.net.URL;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Arrays;
|
|
+import java.util.Calendar;
|
|
+import java.util.Date;
|
|
+import java.util.Enumeration;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
+import java.util.jar.Manifest;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import joptsimple.OptionParser;
|
|
@@ -18,7 +21,7 @@ public class Main {
|
|
public static boolean useJline = true;
|
|
public static boolean useConsole = true;
|
|
|
|
- public static void main(String[] args) throws IOException {
|
|
+ public static void main(String[] args) throws Exception {
|
|
// Spigot Start
|
|
File lock = new File( ".update-lock" );
|
|
if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null )
|
|
@@ -39,6 +42,32 @@ public class Main {
|
|
{
|
|
}
|
|
}
|
|
+
|
|
+ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n"
|
|
+ + "*** It is imperative that backups be taken before running this build on your server! ***\n"
|
|
+ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n"
|
|
+ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" );
|
|
+
|
|
+ Enumeration<URL> resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" );
|
|
+ while ( resources.hasMoreElements() )
|
|
+ {
|
|
+ Manifest manifest = new Manifest( resources.nextElement().openStream() );
|
|
+ String ts = manifest.getMainAttributes().getValue( "Timestamp" );
|
|
+ if ( ts != null )
|
|
+ {
|
|
+ Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts );
|
|
+
|
|
+ Calendar cal = Calendar.getInstance();
|
|
+ cal.add( Calendar.DAY_OF_YEAR, -2 );
|
|
+ if ( buildDate.before(cal.getTime() ) )
|
|
+ {
|
|
+ System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" );
|
|
+ System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" );
|
|
+ System.err.println( "The server will start in 10 seconds!" );
|
|
+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
|
|
+ }
|
|
+ }
|
|
+ }
|
|
// Spigot End
|
|
// Todo: Installation script
|
|
OptionParser parser = new OptionParser() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index e7569c6..35f2bfa 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -203,17 +203,29 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
getHandle().listName = name;
|
|
|
|
// Change the name on the client side
|
|
- PacketPlayOutPlayerInfo oldpacket = new PacketPlayOutPlayerInfo(oldName, false, 9999);
|
|
- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(name, true, getHandle().ping);
|
|
+ // Spigot start - protocol patch
|
|
+ String temp = getHandle().listName;
|
|
+ getHandle().listName = oldName;
|
|
+ PacketPlayOutPlayerInfo oldpacket = PacketPlayOutPlayerInfo.removePlayer(getHandle());
|
|
+ getHandle().listName = temp;
|
|
+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer(getHandle());
|
|
+ PacketPlayOutPlayerInfo newPacket = PacketPlayOutPlayerInfo.updateDisplayName(getHandle());
|
|
for (int i = 0; i < server.getHandle().players.size(); ++i) {
|
|
EntityPlayer entityplayer = (EntityPlayer) server.getHandle().players.get(i);
|
|
if (entityplayer.playerConnection == null) continue;
|
|
|
|
if (entityplayer.getBukkitEntity().canSee(this)) {
|
|
- entityplayer.playerConnection.sendPacket(oldpacket);
|
|
- entityplayer.playerConnection.sendPacket(packet);
|
|
+ if (entityplayer.playerConnection.networkManager.getVersion() < 28)
|
|
+ {
|
|
+ entityplayer.playerConnection.sendPacket( oldpacket );
|
|
+ entityplayer.playerConnection.sendPacket( packet );
|
|
+ } else {
|
|
+ entityplayer.playerConnection.sendPacket( newPacket );
|
|
+ }
|
|
}
|
|
}
|
|
+
|
|
+ // Spigot end
|
|
}
|
|
|
|
@Override
|
|
@@ -442,7 +454,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
for (int y = 0; y < 128; ++y) {
|
|
bytes[y + 3] = data.buffer[y * 128 + x];
|
|
}
|
|
- PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes);
|
|
+ PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes, map.getScale().getValue()); // Spigot - protocol patch
|
|
getHandle().playerConnection.sendPacket(packet);
|
|
}
|
|
}
|
|
@@ -894,7 +906,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
|
|
//remove the hidden player from this player user list
|
|
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), false, 9999));
|
|
+ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.removePlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch
|
|
}
|
|
|
|
public void showPlayer(Player player) {
|
|
@@ -911,7 +923,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
entry.updatePlayer(getHandle());
|
|
}
|
|
|
|
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), true, getHandle().ping));
|
|
+ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch
|
|
}
|
|
|
|
public void removeDisconnectingPlayer(Player player) {
|
|
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
|
|
index fad22e2..80e538c 100644
|
|
--- a/src/main/java/org/spigotmc/AntiXray.java
|
|
+++ b/src/main/java/org/spigotmc/AntiXray.java
|
|
@@ -65,7 +65,7 @@ public class AntiXray
|
|
if ( world.spigotConfig.antiXray )
|
|
{
|
|
obfuscate.startTiming();
|
|
- obfuscate( chunkX, chunkY, bitmask, buffer, world );
|
|
+ obfuscate( chunkX, chunkY, bitmask, buffer, world, false );
|
|
obfuscate.stopTiming();
|
|
}
|
|
}
|
|
@@ -73,7 +73,7 @@ public class AntiXray
|
|
/**
|
|
* Removes all non exposed ores from the chunk buffer.
|
|
*/
|
|
- public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world)
|
|
+ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, boolean newFormat)
|
|
{
|
|
// If the world is marked as obfuscated
|
|
if ( world.spigotConfig.antiXray )
|
|
@@ -120,11 +120,22 @@ public class AntiXray
|
|
if ( index >= buffer.length )
|
|
{
|
|
index++;
|
|
+ if ( newFormat ) index++;
|
|
continue;
|
|
}
|
|
// Grab the block ID in the buffer.
|
|
// TODO: extended IDs are not yet supported
|
|
- int blockId = buffer[index] & 0xFF;
|
|
+ int blockId;
|
|
+ int data = 0;
|
|
+ if ( newFormat )
|
|
+ {
|
|
+ blockId = (buffer[ index ] & 0xFF) | ( ( buffer[ index + 1 ] & 0xFF ) << 8 );
|
|
+ data = blockId & 0xF;
|
|
+ blockId >>>= 4; // Remove data value
|
|
+ } else
|
|
+ {
|
|
+ blockId = buffer[ index ] & 0xFF;
|
|
+ }
|
|
// Check if the block should be obfuscated
|
|
if ( obfuscateBlocks[blockId] )
|
|
{
|
|
@@ -132,6 +143,7 @@ public class AntiXray
|
|
if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) )
|
|
{
|
|
index++;
|
|
+ if ( newFormat ) index++;
|
|
continue;
|
|
}
|
|
// On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate
|
|
@@ -141,7 +153,15 @@ public class AntiXray
|
|
{
|
|
case 1:
|
|
// Replace with replacement material
|
|
- buffer[index] = replaceWithTypeId;
|
|
+ if ( newFormat )
|
|
+ {
|
|
+ char replace = (char) ((replaceWithTypeId << 4) | data);
|
|
+ buffer[ index ] = (byte) ( replace & 0xFF );
|
|
+ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF );
|
|
+ } else
|
|
+ {
|
|
+ buffer[ index ] = replaceWithTypeId;
|
|
+ }
|
|
break;
|
|
case 2:
|
|
// Replace with random ore.
|
|
@@ -149,13 +169,23 @@ public class AntiXray
|
|
{
|
|
randomOre = 0;
|
|
}
|
|
- buffer[index] = replacementOres[randomOre++];
|
|
+ if ( newFormat )
|
|
+ {
|
|
+ char replace = (char) (replacementOres[ randomOre++ ] & 0xFF);
|
|
+ replace = (char) ((replace << 4) | data);
|
|
+ buffer[ index ] = (byte) ( replace & 0xFF );
|
|
+ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF );
|
|
+ } else
|
|
+ {
|
|
+ buffer[ index ] = replacementOres[ randomOre++ ];
|
|
+ }
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
index++;
|
|
+ if (newFormat) index++;
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/ProtocolData.java b/src/main/java/org/spigotmc/ProtocolData.java
|
|
new file mode 100644
|
|
index 0000000..ff93cbe
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/ProtocolData.java
|
|
@@ -0,0 +1,190 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+public class ProtocolData
|
|
+{
|
|
+ public static class ByteShort extends Number
|
|
+ {
|
|
+
|
|
+ private short value;
|
|
+
|
|
+ public ByteShort(short value)
|
|
+ {
|
|
+ this.value = value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int intValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public long longValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float floatValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double doubleValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class DualByte extends Number
|
|
+ {
|
|
+
|
|
+ public byte value;
|
|
+ public byte value2;
|
|
+
|
|
+ public DualByte(byte value, byte value2)
|
|
+ {
|
|
+ this.value = value;
|
|
+ this.value2 = value2;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int intValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public long longValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float floatValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double doubleValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class HiddenByte extends Number
|
|
+ {
|
|
+
|
|
+ private byte value;
|
|
+
|
|
+ public HiddenByte(byte value)
|
|
+ {
|
|
+ this.value = value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int intValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public long longValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float floatValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double doubleValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+ }
|
|
+ public static class IntByte extends Number
|
|
+ {
|
|
+
|
|
+ public int value;
|
|
+ public byte value2;
|
|
+
|
|
+ public IntByte(int value, byte value2)
|
|
+ {
|
|
+ this.value = value;
|
|
+ this.value2 = value2;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public byte byteValue()
|
|
+ {
|
|
+ return value2;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int intValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public long longValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float floatValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double doubleValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class DualInt extends Number
|
|
+ {
|
|
+
|
|
+ public int value;
|
|
+ public int value2;
|
|
+
|
|
+ public DualInt(int value, int value2)
|
|
+ {
|
|
+ this.value = value;
|
|
+ this.value2 = value2;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int intValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public long longValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float floatValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double doubleValue()
|
|
+ {
|
|
+ return value;
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/spigotmc/ProtocolInjector.java b/src/main/java/org/spigotmc/ProtocolInjector.java
|
|
new file mode 100644
|
|
index 0000000..3b2df91
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/ProtocolInjector.java
|
|
@@ -0,0 +1,253 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+import net.minecraft.server.ChatSerializer;
|
|
+import net.minecraft.server.EnumProtocol;
|
|
+import net.minecraft.server.IChatBaseComponent;
|
|
+import net.minecraft.server.Packet;
|
|
+import net.minecraft.server.PacketDataSerializer;
|
|
+import net.minecraft.server.PacketListener;
|
|
+import net.minecraft.util.com.google.common.collect.BiMap;
|
|
+
|
|
+import java.io.IOException;
|
|
+import java.lang.reflect.Field;
|
|
+import java.util.Map;
|
|
+
|
|
+public class ProtocolInjector
|
|
+{
|
|
+ public static void inject()
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ addPacket( EnumProtocol.LOGIN, true, 0x3, PacketLoginCompression.class );
|
|
+
|
|
+ addPacket( EnumProtocol.PLAY, true, 0x45, PacketTitle.class );
|
|
+ addPacket( EnumProtocol.PLAY, true, 0x47, PacketTabHeader.class );
|
|
+ addPacket( EnumProtocol.PLAY, true, 0x48, PacketPlayResourcePackSend.class );
|
|
+ addPacket( EnumProtocol.PLAY, false, 0x19, PacketPlayResourcePackStatus.class );
|
|
+ } catch ( NoSuchFieldException e )
|
|
+ {
|
|
+ e.printStackTrace();
|
|
+ } catch ( IllegalAccessException e )
|
|
+ {
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private static void addPacket(EnumProtocol protocol, boolean clientbound, int id, Class<? extends Packet> packet) throws NoSuchFieldException, IllegalAccessException
|
|
+ {
|
|
+ Field packets;
|
|
+ if (!clientbound) {
|
|
+ packets = EnumProtocol.class.getDeclaredField( "h" );
|
|
+ } else {
|
|
+ packets = EnumProtocol.class.getDeclaredField( "i" );
|
|
+ }
|
|
+ packets.setAccessible( true );
|
|
+ BiMap<Integer, Class<? extends Packet>> pMap = (BiMap<Integer, Class<? extends Packet>>) packets.get( protocol );
|
|
+ pMap.put( id, packet );
|
|
+ Field map = EnumProtocol.class.getDeclaredField( "f" );
|
|
+ map.setAccessible( true );
|
|
+ Map<Class<? extends Packet>, EnumProtocol> protocolMap = (Map<Class<? extends Packet>, EnumProtocol>) map.get( null );
|
|
+ protocolMap.put( packet, protocol );
|
|
+ }
|
|
+
|
|
+ public static class PacketPlayResourcePackStatus extends Packet {
|
|
+
|
|
+ @Override
|
|
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ packetdataserializer.c( 255 ); // Hash
|
|
+ packetdataserializer.a(); // Result
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(PacketListener packetlistener)
|
|
+ {
|
|
+
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class PacketPlayResourcePackSend extends Packet {
|
|
+
|
|
+ private String url;
|
|
+ private String hash;
|
|
+
|
|
+ public PacketPlayResourcePackSend(String url, String hash)
|
|
+ {
|
|
+ this.url = url;
|
|
+ this.hash = hash;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ packetdataserializer.a( url );
|
|
+ packetdataserializer.a( hash );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(PacketListener packetlistener)
|
|
+ {
|
|
+
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class PacketLoginCompression extends Packet {
|
|
+
|
|
+ private int threshold;
|
|
+
|
|
+ public PacketLoginCompression(int threshold)
|
|
+ {
|
|
+ this.threshold = threshold;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ packetdataserializer.b( threshold );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(PacketListener packetlistener)
|
|
+ {
|
|
+
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class PacketTabHeader extends Packet
|
|
+ {
|
|
+
|
|
+ private IChatBaseComponent header;
|
|
+ private IChatBaseComponent footer;
|
|
+
|
|
+ public PacketTabHeader()
|
|
+ {
|
|
+ }
|
|
+
|
|
+ public PacketTabHeader(IChatBaseComponent header, IChatBaseComponent footer)
|
|
+ {
|
|
+ this.header = header;
|
|
+ this.footer = footer;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ this.header = ChatSerializer.a( packetdataserializer.c( 32767 ) );
|
|
+ this.footer = ChatSerializer.a( packetdataserializer.c( 32767 ) );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ packetdataserializer.a( ChatSerializer.a( this.header ) );
|
|
+ packetdataserializer.a( ChatSerializer.a( this.footer ) );
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(PacketListener packetlistener)
|
|
+ {
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static class PacketTitle extends Packet
|
|
+ {
|
|
+ private Action action;
|
|
+
|
|
+ // TITLE & SUBTITLE
|
|
+ private IChatBaseComponent text;
|
|
+
|
|
+ // TIMES
|
|
+ private int fadeIn = -1;
|
|
+ private int stay = -1;
|
|
+ private int fadeOut = -1;
|
|
+
|
|
+ public PacketTitle() {}
|
|
+
|
|
+ public PacketTitle(Action action)
|
|
+ {
|
|
+ this.action = action;
|
|
+ }
|
|
+
|
|
+ public PacketTitle(Action action, IChatBaseComponent text)
|
|
+ {
|
|
+ this( action );
|
|
+ this.text = text;
|
|
+ }
|
|
+
|
|
+ public PacketTitle(Action action, int fadeIn, int stay, int fadeOut)
|
|
+ {
|
|
+ this( action );
|
|
+ this.fadeIn = fadeIn;
|
|
+ this.stay = stay;
|
|
+ this.fadeOut = fadeOut;
|
|
+ }
|
|
+
|
|
+
|
|
+ @Override
|
|
+ public void a(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ this.action = Action.values()[packetdataserializer.a()];
|
|
+ switch ( action )
|
|
+ {
|
|
+ case TITLE:
|
|
+ case SUBTITLE:
|
|
+ this.text = ChatSerializer.a( packetdataserializer.c(32767) );
|
|
+ break;
|
|
+ case TIMES:
|
|
+ this.fadeIn = packetdataserializer.readInt();
|
|
+ this.stay = packetdataserializer.readInt();
|
|
+ this.fadeOut = packetdataserializer.readInt();
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(PacketDataSerializer packetdataserializer) throws IOException
|
|
+ {
|
|
+ packetdataserializer.b( action.ordinal() );
|
|
+ switch ( action )
|
|
+ {
|
|
+ case TITLE:
|
|
+ case SUBTITLE:
|
|
+ packetdataserializer.a( ChatSerializer.a( this.text ) );
|
|
+ break;
|
|
+ case TIMES:
|
|
+ packetdataserializer.writeInt( this.fadeIn );
|
|
+ packetdataserializer.writeInt( this.stay );
|
|
+ packetdataserializer.writeInt( this.fadeOut );
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void handle(PacketListener packetlistener)
|
|
+ {
|
|
+ }
|
|
+
|
|
+ public static enum Action {
|
|
+ TITLE,
|
|
+ SUBTITLE,
|
|
+ TIMES,
|
|
+ CLEAR,
|
|
+ RESET
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java
|
|
new file mode 100644
|
|
index 0000000..6093d62
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/SpigotComponentReverter.java
|
|
@@ -0,0 +1,105 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+import net.minecraft.server.ChatComponentText;
|
|
+import net.minecraft.server.ChatModifier;
|
|
+import net.minecraft.server.EnumChatFormat;
|
|
+import net.minecraft.server.IChatBaseComponent;
|
|
+import org.bukkit.ChatColor;
|
|
+
|
|
+import java.util.Iterator;
|
|
+import java.util.List;
|
|
+
|
|
+public class SpigotComponentReverter
|
|
+{
|
|
+ public static String toLegacy(IChatBaseComponent s)
|
|
+ {
|
|
+ StringBuilder builder = new StringBuilder();
|
|
+ legacy( builder, s );
|
|
+ return builder.toString();
|
|
+ }
|
|
+
|
|
+ private static void legacy(StringBuilder builder, IChatBaseComponent s)
|
|
+ {
|
|
+ ChatModifier modifier = s.getChatModifier();
|
|
+ colorize( builder, modifier );
|
|
+ if ( s instanceof ChatComponentText )
|
|
+ {
|
|
+ builder.append( s.e() );
|
|
+ } else {
|
|
+ throw new RuntimeException( "Unhandled type: " + s.getClass().getSimpleName() );
|
|
+ }
|
|
+
|
|
+ for ( IChatBaseComponent c : getExtra( s ) ) {
|
|
+ legacy( builder, c );
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private static void colorize(StringBuilder builder, ChatModifier modifier)
|
|
+ {
|
|
+ if ( modifier == null ) return;
|
|
+ // Color first
|
|
+ EnumChatFormat color = getColor( modifier );
|
|
+ if ( color == null )
|
|
+ {
|
|
+ color = EnumChatFormat.BLACK;
|
|
+ }
|
|
+ builder.append( color.toString() );
|
|
+
|
|
+ if ( isBold( modifier ) )
|
|
+ {
|
|
+ builder.append( ChatColor.BOLD );
|
|
+ }
|
|
+ if ( isItalic( modifier ) )
|
|
+ {
|
|
+ builder.append( ChatColor.ITALIC );
|
|
+ }
|
|
+ if ( isRandom( modifier ) )
|
|
+ {
|
|
+ builder.append( ChatColor.MAGIC );
|
|
+ }
|
|
+ if ( isStrikethrough( modifier ) )
|
|
+ {
|
|
+ builder.append( ChatColor.STRIKETHROUGH );
|
|
+ }
|
|
+ if ( isUnderline( modifier ) )
|
|
+ {
|
|
+ builder.append( ChatColor.UNDERLINE );
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // Helpers
|
|
+ private static List<IChatBaseComponent> getExtra(IChatBaseComponent c)
|
|
+ {
|
|
+ return c.a();
|
|
+ }
|
|
+
|
|
+ private static EnumChatFormat getColor(ChatModifier c)
|
|
+ {
|
|
+ return c.a();
|
|
+ }
|
|
+
|
|
+ private static boolean isBold(ChatModifier c)
|
|
+ {
|
|
+ return c.b();
|
|
+ }
|
|
+
|
|
+ private static boolean isItalic(ChatModifier c)
|
|
+ {
|
|
+ return c.c();
|
|
+ }
|
|
+
|
|
+ private static boolean isStrikethrough(ChatModifier c)
|
|
+ {
|
|
+ return c.d();
|
|
+ }
|
|
+
|
|
+ private static boolean isUnderline(ChatModifier c)
|
|
+ {
|
|
+ return c.e();
|
|
+ }
|
|
+
|
|
+ private static boolean isRandom(ChatModifier c)
|
|
+ {
|
|
+ return c.f();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotCompressor.java b/src/main/java/org/spigotmc/SpigotCompressor.java
|
|
new file mode 100644
|
|
index 0000000..2e0857e
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/SpigotCompressor.java
|
|
@@ -0,0 +1,43 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+import net.minecraft.server.PacketDataSerializer;
|
|
+import net.minecraft.util.io.netty.buffer.ByteBuf;
|
|
+import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
|
|
+import net.minecraft.util.io.netty.handler.codec.MessageToByteEncoder;
|
|
+
|
|
+import java.util.zip.Deflater;
|
|
+
|
|
+public class SpigotCompressor extends MessageToByteEncoder
|
|
+{
|
|
+
|
|
+ private final byte[] buffer = new byte[8192];
|
|
+ private final Deflater deflater = new Deflater();
|
|
+
|
|
+ @Override
|
|
+ protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception
|
|
+ {
|
|
+ ByteBuf in = (ByteBuf) msg;
|
|
+ int origSize = in.readableBytes();
|
|
+ PacketDataSerializer serializer = new PacketDataSerializer( out );
|
|
+
|
|
+ if ( origSize < 256 )
|
|
+ {
|
|
+ serializer.b( 0 );
|
|
+ serializer.writeBytes( in );
|
|
+ } else
|
|
+ {
|
|
+ byte[] data = new byte[ origSize ];
|
|
+ in.readBytes( data );
|
|
+
|
|
+ serializer.b( data.length );
|
|
+
|
|
+ deflater.setInput( data );
|
|
+ deflater.finish();
|
|
+ while (!deflater.finished()) {
|
|
+ int count = deflater.deflate( buffer );
|
|
+ serializer.writeBytes( buffer, 0, count );
|
|
+ }
|
|
+ deflater.reset();
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotDebreakifier.java b/src/main/java/org/spigotmc/SpigotDebreakifier.java
|
|
new file mode 100644
|
|
index 0000000..d811f55
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/SpigotDebreakifier.java
|
|
@@ -0,0 +1,102 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+import com.google.common.base.Charsets;
|
|
+import com.google.gson.JsonArray;
|
|
+import com.google.gson.JsonElement;
|
|
+import com.google.gson.JsonParser;
|
|
+import net.minecraft.server.Block;
|
|
+import net.minecraft.server.Blocks;
|
|
+import net.minecraft.server.Item;
|
|
+import net.minecraft.server.Items;
|
|
+import net.minecraft.util.gnu.trove.map.hash.TIntIntHashMap;
|
|
+
|
|
+import java.io.IOException;
|
|
+import java.io.InputStream;
|
|
+import java.io.InputStreamReader;
|
|
+import java.util.Arrays;
|
|
+
|
|
+public class SpigotDebreakifier
|
|
+{
|
|
+
|
|
+ private static final boolean[] validBlocks = new boolean[ 198 << 4 ];
|
|
+ private static final int[] correctedValues = new int[ 198 ];
|
|
+
|
|
+ static
|
|
+ {
|
|
+ Arrays.fill( correctedValues, -1 );
|
|
+ InputStream in = SpigotDebreakifier.class.getResourceAsStream( "/blocks.json" );
|
|
+ try
|
|
+ {
|
|
+ JsonArray e = new JsonParser().parse( new InputStreamReader( in, Charsets.UTF_8 ) ).getAsJsonArray();
|
|
+ for ( JsonElement entry : e )
|
|
+ {
|
|
+ String[] parts = entry.getAsString().split( ":" );
|
|
+ int id = Integer.parseInt( parts[ 0 ] );
|
|
+ int data = Integer.parseInt( parts[ 1 ] );
|
|
+ validBlocks[ ( id << 4 ) | data ] = true;
|
|
+ if ( correctedValues[ id ] == -1 || data < correctedValues[ id ] )
|
|
+ {
|
|
+ correctedValues[ id ] = data;
|
|
+ }
|
|
+ }
|
|
+ } finally
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ in.close();
|
|
+ } catch ( IOException e )
|
|
+ {
|
|
+ throw new RuntimeException( e );
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static int getCorrectedData(int id, int data)
|
|
+ {
|
|
+ if ( id > 197 ) return data;
|
|
+ if ( id == 175 && data > 8 )
|
|
+ {
|
|
+ data = 8;
|
|
+ }
|
|
+ if ( validBlocks[ ( id << 4 ) | data ] )
|
|
+ {
|
|
+ return data;
|
|
+ } else
|
|
+ {
|
|
+ return correctedValues[ id ] & 0xF;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ private static TIntIntHashMap invalidItems = new TIntIntHashMap();
|
|
+ static {
|
|
+ replace( Blocks.WATER, Items.WATER_BUCKET );
|
|
+ replace( Blocks.STATIONARY_WATER, Items.WATER_BUCKET );
|
|
+ replace( Blocks.LAVA, Items.LAVA_BUCKET );
|
|
+ replace( Blocks.STATIONARY_LAVA, Items.LAVA_BUCKET );
|
|
+ replace( Blocks.PORTAL, Items.NETHER_BRICK );
|
|
+ replace( Blocks.DOUBLE_STEP, Blocks.STEP );
|
|
+ replace( Blocks.FIRE, Items.FLINT_AND_STEEL );
|
|
+ replace( Blocks.ENDER_PORTAL, Blocks.ENDER_PORTAL_FRAME );
|
|
+ replace( Blocks.WOOD_DOUBLE_STEP, Blocks.WOOD_STEP );
|
|
+ replace( Blocks.COCOA, Items.SEEDS );
|
|
+ replace( Blocks.CARROTS, Items.CARROT );
|
|
+ replace( Blocks.POTATOES, Items.POTATO );
|
|
+ }
|
|
+
|
|
+ public static int getItemId(int id)
|
|
+ {
|
|
+ return invalidItems.containsKey( id ) ? invalidItems.get( id ) : id;
|
|
+ }
|
|
+
|
|
+ private static void replace(Block block, Block other) {
|
|
+ replace( Block.getId( block ), Block.getId( other ) );
|
|
+ }
|
|
+
|
|
+ private static void replace(Block block, Item other) {
|
|
+ replace( Block.getId( block ), Item.getId( other ) );
|
|
+ }
|
|
+
|
|
+ private static void replace(int block, int other) {
|
|
+ invalidItems.put( block, other );
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotDecompressor.java b/src/main/java/org/spigotmc/SpigotDecompressor.java
|
|
new file mode 100644
|
|
index 0000000..ffebf5d
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/spigotmc/SpigotDecompressor.java
|
|
@@ -0,0 +1,42 @@
|
|
+package org.spigotmc;
|
|
+
|
|
+import net.minecraft.server.PacketDataSerializer;
|
|
+import net.minecraft.util.io.netty.buffer.ByteBuf;
|
|
+import net.minecraft.util.io.netty.buffer.Unpooled;
|
|
+import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
|
|
+import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder;
|
|
+
|
|
+import java.util.List;
|
|
+import java.util.zip.Inflater;
|
|
+
|
|
+public class SpigotDecompressor extends ByteToMessageDecoder
|
|
+{
|
|
+
|
|
+ private final Inflater inflater = new Inflater();
|
|
+
|
|
+ @Override
|
|
+ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> objects) throws Exception
|
|
+ {
|
|
+ if ( byteBuf.readableBytes() == 0 )
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ PacketDataSerializer serializer = new PacketDataSerializer( byteBuf );
|
|
+ int size = serializer.a();
|
|
+ if ( size == 0 )
|
|
+ {
|
|
+ objects.add( serializer.readBytes( serializer.readableBytes() ) );
|
|
+ } else
|
|
+ {
|
|
+ byte[] compressedData = new byte[ serializer.readableBytes() ];
|
|
+ serializer.readBytes( compressedData );
|
|
+ inflater.setInput( compressedData );
|
|
+
|
|
+ byte[] data = new byte[ size ];
|
|
+ inflater.inflate( data );
|
|
+ objects.add( Unpooled.wrappedBuffer( data ) );
|
|
+ inflater.reset();
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/resources/blocks.json b/src/main/resources/blocks.json
|
|
new file mode 100644
|
|
index 0000000..8dd484d
|
|
--- /dev/null
|
|
+++ b/src/main/resources/blocks.json
|
|
@@ -0,0 +1 @@
|
|
+["0:0","1:0","1:1","1:2","1:3","1:4","1:5","1:6","2:0","3:0","3:1","3:2","4:0","5:0","5:1","5:2","5:3","5:4","5:5","6:0","6:1","6:2","6:3","6:4","6:5","6:8","6:9","6:10","6:11","6:12","6:13","7:0","8:0","8:1","8:2","8:3","8:4","8:5","8:6","8:7","8:8","8:9","8:10","8:11","8:12","8:13","8:14","8:15","9:0","9:1","9:2","9:3","9:4","9:5","9:6","9:7","9:8","9:9","9:10","9:11","9:12","9:13","9:14","9:15","10:0","10:1","10:2","10:3","10:4","10:5","10:6","10:7","10:8","10:9","10:10","10:11","10:12","10:13","10:14","10:15","11:0","11:1","11:2","11:3","11:4","11:5","11:6","11:7","11:8","11:9","11:10","11:11","11:12","11:13","11:14","11:15","12:0","12:1","13:0","14:0","15:0","16:0","17:0","17:1","17:2","17:3","17:4","17:5","17:6","17:7","17:8","17:9","17:10","17:11","17:12","17:13","17:14","17:15","18:0","18:1","18:2","18:3","18:4","18:5","18:6","18:7","18:8","18:9","18:10","18:11","18:12","18:13","18:14","18:15","19:0","19:1","20:0","21:0","22:0","23:0","23:1","23:2","23:3","23:4","23:5","23:8","23:9","23:10","23:11","23:12","23:13","24:0","24:1","24:2","25:0","26:0","26:1","26:2","26:3","26:8","26:9","26:10","26:11","26:12","26:13","26:14","26:15","27:0","27:1","27:2","27:3","27:4","27:5","27:8","27:9","27:10","27:11","27:12","27:13","28:0","28:1","28:2","28:3","28:4","28:5","28:8","28:9","28:10","28:11","28:12","28:13","29:0","29:1","29:2","29:3","29:4","29:5","29:8","29:9","29:10","29:11","29:12","29:13","30:0","31:0","31:1","31:2","32:0","33:0","33:1","33:2","33:3","33:4","33:5","33:8","33:9","33:10","33:11","33:12","33:13","34:0","34:1","34:2","34:3","34:4","34:5","34:8","34:9","34:10","34:11","34:12","34:13","35:0","35:1","35:2","35:3","35:4","35:5","35:6","35:7","35:8","35:9","35:10","35:11","35:12","35:13","35:14","35:15","36:0","36:1","36:2","36:3","36:4","36:5","36:8","36:9","36:10","36:11","36:12","36:13","37:0","38:0","38:1","38:2","38:3","38:4","38:5","38:6","38:7","38:8","39:0","40:0","41:0","42:0","43:0","43:1","43:2","43:3","43:4","43:5","43:6","43:7","43:8","43:9","43:10","43:11","43:12","43:13","43:14","43:15","44:0","44:1","44:2","44:3","44:4","44:5","44:6","44:7","44:8","44:9","44:10","44:11","44:12","44:13","44:14","44:15","45:0","46:0","46:1","47:0","48:0","49:0","50:1","50:2","50:3","50:4","50:5","51:0","51:1","51:2","51:3","51:4","51:5","51:6","51:7","51:8","51:9","51:10","51:11","51:12","51:13","51:14","51:15","52:0","53:0","53:1","53:2","53:3","53:4","53:5","53:6","53:7","54:2","54:3","54:4","54:5","55:0","55:1","55:2","55:3","55:4","55:5","55:6","55:7","55:8","55:9","55:10","55:11","55:12","55:13","55:14","55:15","56:0","57:0","58:0","59:0","59:1","59:2","59:3","59:4","59:5","59:6","59:7","60:0","60:1","60:2","60:3","60:4","60:5","60:6","60:7","61:2","61:3","61:4","61:5","62:2","62:3","62:4","62:5","63:0","63:1","63:2","63:3","63:4","63:5","63:6","63:7","63:8","63:9","63:10","63:11","63:12","63:13","63:14","63:15","64:0","64:1","64:2","64:3","64:4","64:5","64:6","64:7","64:8","64:9","64:10","64:11","65:2","65:3","65:4","65:5","66:0","66:1","66:2","66:3","66:4","66:5","66:6","66:7","66:8","66:9","67:0","67:1","67:2","67:3","67:4","67:5","67:6","67:7","68:2","68:3","68:4","68:5","69:0","69:1","69:2","69:3","69:4","69:5","69:6","69:7","69:8","69:9","69:10","69:11","69:12","69:13","69:14","69:15","70:0","70:1","71:0","71:1","71:2","71:3","71:4","71:5","71:6","71:7","71:8","71:9","71:10","71:11","72:0","72:1","73:0","74:0","75:1","75:2","75:3","75:4","75:5","76:1","76:2","76:3","76:4","76:5","77:0","77:1","77:2","77:3","77:4","77:5","77:8","77:9","77:10","77:11","77:12","77:13","78:0","78:1","78:2","78:3","78:4","78:5","78:6","78:7","79:0","80:0","81:0","81:1","81:2","81:3","81:4","81:5","81:6","81:7","81:8","81:9","81:10","81:11","81:12","81:13","81:14","81:15","82:0","83:0","83:1","83:2","83:3","83:4","83:5","83:6","83:7","83:8","83:9","83:10","83:11","83:12","83:13","83:14","83:15","84:0","84:1","85:0","86:0","86:1","86:2","86:3","87:0","88:0","89:0","90:1","90:2","91:0","91:1","91:2","91:3","92:0","92:1","92:2","92:3","92:4","92:5","92:6","93:0","93:1","93:2","93:3","93:4","93:5","93:6","93:7","93:8","93:9","93:10","93:11","93:12","93:13","93:14","93:15","94:0","94:1","94:2","94:3","94:4","94:5","94:6","94:7","94:8","94:9","94:10","94:11","94:12","94:13","94:14","94:15","95:0","95:1","95:2","95:3","95:4","95:5","95:6","95:7","95:8","95:9","95:10","95:11","95:12","95:13","95:14","95:15","96:0","96:1","96:2","96:3","96:4","96:5","96:6","96:7","96:8","96:9","96:10","96:11","96:12","96:13","96:14","96:15","97:0","97:1","97:2","97:3","97:4","97:5","98:0","98:1","98:2","98:3","99:0","99:1","99:2","99:3","99:4","99:5","99:6","99:7","99:8","99:9","99:10","99:14","99:15","100:0","100:1","100:2","100:3","100:4","100:5","100:6","100:7","100:8","100:9","100:10","100:14","100:15","101:0","102:0","103:0","104:0","104:1","104:2","104:3","104:4","104:5","104:6","104:7","105:0","105:1","105:2","105:3","105:4","105:5","105:6","105:7","106:0","106:1","106:2","106:3","106:4","106:5","106:6","106:7","106:8","106:9","106:10","106:11","106:12","106:13","106:14","106:15","107:0","107:1","107:2","107:3","107:4","107:5","107:6","107:7","107:8","107:9","107:10","107:11","107:12","107:13","107:14","107:15","108:0","108:1","108:2","108:3","108:4","108:5","108:6","108:7","109:0","109:1","109:2","109:3","109:4","109:5","109:6","109:7","110:0","111:0","112:0","113:0","114:0","114:1","114:2","114:3","114:4","114:5","114:6","114:7","115:0","115:1","115:2","115:3","116:0","117:0","117:1","117:2","117:3","117:4","117:5","117:6","117:7","118:0","118:1","118:2","118:3","119:0","120:0","120:1","120:2","120:3","120:4","120:5","120:6","120:7","121:0","122:0","123:0","124:0","125:0","125:1","125:2","125:3","125:4","125:5","126:0","126:1","126:2","126:3","126:4","126:5","126:8","126:9","126:10","126:11","126:12","126:13","127:0","127:1","127:2","127:3","127:4","127:5","127:6","127:7","127:8","127:9","127:10","127:11","128:0","128:1","128:2","128:3","128:4","128:5","128:6","128:7","129:0","130:2","130:3","130:4","130:5","131:0","131:1","131:2","131:3","131:4","131:5","131:6","131:7","131:8","131:9","131:10","131:11","131:12","131:13","131:14","131:15","132:0","132:1","132:2","132:3","132:4","132:5","132:6","132:7","132:8","132:9","132:10","132:11","132:12","132:13","132:14","132:15","133:0","134:0","134:1","134:2","134:3","134:4","134:5","134:6","134:7","135:0","135:1","135:2","135:3","135:4","135:5","135:6","135:7","136:0","136:1","136:2","136:3","136:4","136:5","136:6","136:7","137:0","137:1","138:0","139:0","139:1","140:0","140:1","140:2","140:3","140:4","140:5","140:6","140:7","140:8","140:9","140:10","140:11","140:12","140:13","140:14","140:15","141:0","141:1","141:2","141:3","141:4","141:5","141:6","141:7","142:0","142:1","142:2","142:3","142:4","142:5","142:6","142:7","143:0","143:1","143:2","143:3","143:4","143:5","143:8","143:9","143:10","143:11","143:12","143:13","144:0","144:1","144:2","144:3","144:4","144:5","144:8","144:9","144:10","144:11","144:12","144:13","145:0","145:1","145:2","145:3","145:4","145:5","145:6","145:7","145:8","145:9","145:10","145:11","146:2","146:3","146:4","146:5","147:0","147:1","147:2","147:3","147:4","147:5","147:6","147:7","147:8","147:9","147:10","147:11","147:12","147:13","147:14","147:15","148:0","148:1","148:2","148:3","148:4","148:5","148:6","148:7","148:8","148:9","148:10","148:11","148:12","148:13","148:14","148:15","149:0","149:1","149:2","149:3","149:4","149:5","149:6","149:7","149:8","149:9","149:10","149:11","149:12","149:13","149:14","149:15","150:0","150:1","150:2","150:3","150:4","150:5","150:6","150:7","150:8","150:9","150:10","150:11","150:12","150:13","150:14","150:15","151:0","151:1","151:2","151:3","151:4","151:5","151:6","151:7","151:8","151:9","151:10","151:11","151:12","151:13","151:14","151:15","152:0","153:0","154:0","154:2","154:3","154:4","154:5","154:8","154:10","154:11","154:12","154:13","155:0","155:1","155:2","155:3","155:4","156:0","156:1","156:2","156:3","156:4","156:5","156:6","156:7","157:0","157:1","157:2","157:3","157:4","157:5","157:8","157:9","157:10","157:11","157:12","157:13","158:0","158:1","158:2","158:3","158:4","158:5","158:8","158:9","158:10","158:11","158:12","158:13","159:0","159:1","159:2","159:3","159:4","159:5","159:6","159:7","159:8","159:9","159:10","159:11","159:12","159:13","159:14","159:15","160:0","160:1","160:2","160:3","160:4","160:5","160:6","160:7","160:8","160:9","160:10","160:11","160:12","160:13","160:14","160:15","161:0","161:1","161:4","161:5","161:8","161:9","161:12","161:13","162:0","162:1","162:4","162:5","162:8","162:9","162:12","162:13","163:0","163:1","163:2","163:3","163:4","163:5","163:6","163:7","164:0","164:1","164:2","164:3","164:4","164:5","164:6","164:7","165:0","166:0","167:0","167:1","167:2","167:3","167:4","167:5","167:6","167:7","167:8","167:9","167:10","167:11","167:12","167:13","167:14","167:15","168:0","168:1","168:2","169:0","170:0","170:4","170:8","171:0","171:1","171:2","171:3","171:4","171:5","171:6","171:7","171:8","171:9","171:10","171:11","171:12","171:13","171:14","171:15","172:0","173:0","174:0","175:0","175:1","175:2","175:3","175:4","175:5","175:8","176:0","176:1","176:2","176:3","176:4","176:5","176:6","176:7","176:8","176:9","176:10","176:11","176:12","176:13","176:14","176:15","177:2","177:3","177:4","177:5","178:0","178:1","178:2","178:3","178:4","178:5","178:6","178:7","178:8","178:9","178:10","178:11","178:12","178:13","178:14","178:15","179:0","179:1","179:2","180:0","180:1","180:2","180:3","180:4","180:5","180:6","180:7","181:0","181:8","182:0","182:8","183:0","183:1","183:2","183:3","183:4","183:5","183:6","183:7","183:8","183:9","183:10","183:11","183:12","183:13","183:14","183:15","184:0","184:1","184:2","184:3","184:4","184:5","184:6","184:7","184:8","184:9","184:10","184:11","184:12","184:13","184:14","184:15","185:0","185:1","185:2","185:3","185:4","185:5","185:6","185:7","185:8","185:9","185:10","185:11","185:12","185:13","185:14","185:15","186:0","186:1","186:2","186:3","186:4","186:5","186:6","186:7","186:8","186:9","186:10","186:11","186:12","186:13","186:14","186:15","187:0","187:1","187:2","187:3","187:4","187:5","187:6","187:7","187:8","187:9","187:10","187:11","187:12","187:13","187:14","187:15","188:0","189:0","190:0","191:0","192:0","193:0","193:1","193:2","193:3","193:4","193:5","193:6","193:7","193:8","193:9","193:10","193:11","194:0","194:1","194:2","194:3","194:4","194:5","194:6","194:7","194:8","194:9","194:10","194:11","195:0","195:1","195:2","195:3","195:4","195:5","195:6","195:7","195:8","195:9","195:10","195:11","196:0","196:1","196:2","196:3","196:4","196:5","196:6","196:7","196:8","196:9","196:10","196:11","197:0","197:1","197:2","197:3","197:4","197:5","197:6","197:7","197:8","197:9","197:10","197:11"]
|
|
--
|
|
1.9.1
|
|
|