mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
Update 1.8-proto from upstream SpigotMC
Fix ProtocolLib compatibility. SpigotMC/Spigot@710eb7514b Bump protocol to 1.8 SpigotMC/Spigot@dd01fbe415 Merge the Protocollib fix into the snapshot branch SpigotMC/Spigot@8ff46693f6 Correctly send the MC|Brand packet SpigotMC/Spigot@0e0982d98c Block EchoPet as it causes client crashes with the 1.8 patch SpigotMC/Spigot@480804b38f Replace invalid items for 1.8 clients with (kinda) sane replacements SpigotMC/Spigot@892c121ff1 Fix the furnace progress bars for 1.8 clients SpigotMC/Spigot@a799b4d5ea
This commit is contained in:
parent
b7e702dacc
commit
8afe9168c7
@ -1,9 +1,9 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <git@md-5.net>
|
From: md_5 <git@md-5.net>
|
||||||
Date: Mon, 1 Sep 2014 19:36:20 +1000
|
Date: Mon, 1 Sep 2014 19:36:20 +1000
|
||||||
Subject: [PATCH] Skip loading of ProtocolLib and Orebfuscator.
|
Subject: [PATCH] Skip loading of plugins which are not 1.8 compatible.
|
||||||
|
|
||||||
As it does not work with Spigot 1.8 builds!
|
As they do not work with Spigot 1.8 builds!
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
@ -14,16 +14,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
description = loader.getPluginDescription(file);
|
description = loader.getPluginDescription(file);
|
||||||
String name = description.getName();
|
String name = description.getName();
|
||||||
+ // Spigot Start
|
+ // Spigot Start
|
||||||
+ if ( name.equalsIgnoreCase( "ProtocolLib" ) && !description.getVersion().endsWith( "-HACK" ) )
|
|
||||||
+ {
|
|
||||||
+ server.getLogger().log( Level.WARNING, "Skipping loading of ProtocolLib as it does not work with Spigot 1.8 builds!" );
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if ( name.equalsIgnoreCase( "Orebfuscator" ) )
|
+ if ( name.equalsIgnoreCase( "Orebfuscator" ) )
|
||||||
+ {
|
+ {
|
||||||
+ server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" );
|
+ server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" );
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
+ if ( name.equalsIgnoreCase( "EchoPet" ) )
|
||||||
|
+ {
|
||||||
|
+ server.getLogger().log( Level.WARNING, "Skipping loading of EchoPet as it does not work with Spigot 1.8 builds!" );
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
+ // Spigot End
|
+ // Spigot End
|
||||||
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
|
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
|
||||||
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
|
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
|
@ -472,6 +472,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
packetdataserializer.writeInt(this.containerCounter);
|
packetdataserializer.writeInt(this.containerCounter);
|
||||||
|
@@ -0,0 +0,0 @@ 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));
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||||
this.server.a(packetplayinsettings.g());
|
this.server.a(packetplayinsettings.g());
|
||||||
}
|
}
|
||||||
@ -563,7 +586,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
- if (packethandshakinginsetprotocol.d() > 5) {
|
- if (packethandshakinginsetprotocol.d() > 5) {
|
||||||
+ if (packethandshakinginsetprotocol.d() > 5 && packethandshakinginsetprotocol.d() != 46) { // Spigot
|
+ if (packethandshakinginsetprotocol.d() > 5 && packethandshakinginsetprotocol.d() != 47) { // Spigot
|
||||||
chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot
|
chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot
|
||||||
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
|
||||||
this.b.close(chatcomponenttext);
|
this.b.close(chatcomponenttext);
|
||||||
@ -675,7 +698,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Spigot Start
|
// Spigot Start
|
||||||
public static final AttributeKey<Integer> protocolVersion = new AttributeKey<Integer>("protocol_version");
|
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);
|
||||||
+ public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 46);
|
+ public static final ImmutableSet<Integer> SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 47);
|
||||||
public static final int CURRENT_VERSION = 5;
|
public static final int CURRENT_VERSION = 5;
|
||||||
public static int getVersion(Channel attr)
|
public static int getVersion(Channel attr)
|
||||||
{
|
{
|
||||||
@ -687,7 +710,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ // Spigot start - protocol patch
|
+ // Spigot start - protocol patch
|
||||||
+ public void enableCompression() {
|
+ public void enableCompression() {
|
||||||
+ m.pipeline().addBefore( "decoder", "decompress", new SpigotDecompressor() );
|
+ // 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() );
|
+ m.pipeline().addBefore( "encoder", "compress", new SpigotCompressor() );
|
||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
@ -877,6 +906,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
public void a(ItemStack itemstack) {
|
public void a(ItemStack itemstack) {
|
||||||
if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
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;
|
||||||
@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf {
|
@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf {
|
||||||
nbttagcompound = itemstack.tag;
|
nbttagcompound = itemstack.tag;
|
||||||
}
|
}
|
||||||
@ -1412,7 +1456,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ {
|
+ {
|
||||||
+ packetdataserializer.writePosition( a, b, c );
|
+ packetdataserializer.writePosition( a, b, c );
|
||||||
+ int id = Block.getId( this.block );
|
+ int id = Block.getId( this.block );
|
||||||
+ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( id, data );
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data );
|
||||||
+ packetdataserializer.b( (id << 4) | this.data );
|
+ packetdataserializer.b( (id << 4) | this.data );
|
||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
@ -1473,6 +1517,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if ( packetdataserializer.version < 29 )
|
+ if ( packetdataserializer.version < 29 )
|
||||||
+ {
|
+ {
|
||||||
+ packetdataserializer.writeShort( this.data.length );
|
+ 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);
|
packetdataserializer.writeBytes(this.data);
|
||||||
+ if ( packetdataserializer.version >= 29 && tag.equals( "MC|AdvCdm" ) )
|
+ if ( packetdataserializer.version >= 29 && tag.equals( "MC|AdvCdm" ) )
|
||||||
@ -1994,7 +2043,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ Blocks.PORTAL.updateShape( chunk.world, ( chunk.locX << 4 ) + px, ( l << 4 ) + py, ( chunk.locZ << 4 ) + pz );
|
+ Blocks.PORTAL.updateShape( chunk.world, ( chunk.locX << 4 ) + px, ( l << 4 ) + py, ( chunk.locZ << 4 ) + pz );
|
||||||
+ } else
|
+ } else
|
||||||
+ {
|
+ {
|
||||||
+ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( id, data );
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data );
|
||||||
+ }
|
+ }
|
||||||
+ char val = (char) ( id << 4 | data );
|
+ char val = (char) ( id << 4 | data );
|
||||||
+ abyte[ j++ ] = (byte) ( val & 0xFF );
|
+ abyte[ j++ ] = (byte) ( val & 0xFF );
|
||||||
@ -2164,7 +2213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15));
|
- 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 blockId = Block.getId( chunk.getType( l, j1, i1 ) );
|
||||||
+ int data = chunk.getData( l, j1, i1 );
|
+ int data = chunk.getData( l, j1, i1 );
|
||||||
+ data = org.spigotmc.SpigotBlockDebreakifier.getCorrectedData( blockId, data );
|
+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( blockId, data );
|
||||||
+ int id = ( blockId & 4095 ) << 4 | data & 15;
|
+ int id = ( blockId & 4095 ) << 4 | data & 15;
|
||||||
+ dataoutputstream.writeShort((short) id);
|
+ dataoutputstream.writeShort((short) id);
|
||||||
+ blocks[k] = id;
|
+ blocks[k] = id;
|
||||||
@ -2242,6 +2291,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
packetdataserializer.writeInt(this.c);
|
packetdataserializer.writeInt(this.c);
|
||||||
packetdataserializer.writeInt(this.d);
|
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
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java
|
||||||
@ -3951,76 +4015,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java b/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotBlockDebreakifier.java
|
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
+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 java.io.IOException;
|
|
||||||
+import java.io.InputStream;
|
|
||||||
+import java.io.InputStreamReader;
|
|
||||||
+import java.util.Arrays;
|
|
||||||
+
|
|
||||||
+public class SpigotBlockDebreakifier
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ private static final boolean[] validBlocks = new boolean[ 198 << 4 ];
|
|
||||||
+ private static final int[] correctedValues = new int[ 198 ];
|
|
||||||
+
|
|
||||||
+ static
|
|
||||||
+ {
|
|
||||||
+ Arrays.fill( correctedValues, -1 );
|
|
||||||
+ InputStream in = SpigotBlockDebreakifier.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;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java
|
diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@ -4181,6 +4175,114 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/main/java/org/spigotmc/SpigotDebreakifier.java b/src/main/java/org/spigotmc/SpigotDebreakifier.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/spigotmc/SpigotDebreakifier.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
+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
|
diff --git a/src/main/java/org/spigotmc/SpigotDecompressor.java b/src/main/java/org/spigotmc/SpigotDecompressor.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user