diff --git a/.gitignore b/.gitignore index c101ffb154..952f896233 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ Spigot-API Spigot-Server PaperSpigot-Server PaperSpigot-API +Bukkit +CraftBukkit diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 975323705c..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "Bukkit"] - path = Bukkit - url = https://github.com/Bukkit/Bukkit.git -[submodule "CraftBukkit"] - path = CraftBukkit - url = https://github.com/Zbob750/CraftBukkit.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4d8c2a7bf7..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: java -jdk: - - openjdk7 - - oraclejdk7 - - oraclejdk8 -notifications: - email: false -before_install: - - git config --global user.email "admin@ecocitycraft.com" - - git config --global user.name "EcoCityCraft" - - ./applyPatches.sh diff --git a/Bukkit b/Bukkit deleted file mode 160000 index f210234e59..0000000000 --- a/Bukkit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f210234e59275330f83b994e199c76f6abd41ee7 diff --git a/Bukkit-Patches/0001-POM-Changes.patch b/Bukkit-Patches/0001-POM-Changes.patch index ff670db3b2..811a986c0e 100644 --- a/Bukkit-Patches/0001-POM-Changes.patch +++ b/Bukkit-Patches/0001-POM-Changes.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - bukkit + org.spigotmc + spigot-api - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Bukkit - http://www.bukkit.org + Spigot-API @@ -25,40 +25,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 UTF-8 -- -- scm:git:git@github.com:Bukkit/Bukkit.git -- scm:git:git://github.com/Bukkit/Bukkit.git -- https://github.com/Bukkit/Bukkit/tree/master/ -- -- -- -- jenkins -- http://ci.bukkit.org -- -- -- -- -- jd.bukkit.org -- file:///home/javadocs/public_html/ -- -- -- repobo-rel -- repo.bukkit.org Releases -- http://repo.bukkit.org/content/repositories/releases/ -- -- -- repobo-snap -- repo.bukkit.org Snapshots -- http://repo.bukkit.org/content/repositories/snapshots/ -- -- + + org.spigotmc + spigot-parent + dev-SNAPSHOT + ../pom.xml + - ++ ++ ++ ++ sonatype-snapshots ++ https://oss.sonatype.org/content/repositories/public ++ ++ ++ + -- \ No newline at end of file diff --git a/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch b/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch index 864bbf1866..8377632c3f 100644 --- a/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch +++ b/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -0,0 +0,0 @@ public interface Entity extends Metadatable { - * @return The current vehicle. + * @return if the custom name is displayed */ - public Entity getVehicle(); + public boolean isCustomNameVisible(); + + // Spigot Start + public class Spigot diff --git a/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch b/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch index 6a596fbad0..c7ba2c0815 100644 --- a/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch +++ b/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch @@ -20,6 +20,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void updateInventory(); /** --- -1.8.4.2 - +-- \ No newline at end of file diff --git a/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch b/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch index 89bf129cc9..31eb9299ed 100644 --- a/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch +++ b/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch @@ -19,11 +19,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); + 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 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"); diff --git a/Bukkit-Patches/0032-Spigot-Update-20140909a.patch b/Bukkit-Patches/0032-Spigot-Update-20140909a.patch deleted file mode 100644 index 198f1850df..0000000000 --- a/Bukkit-Patches/0032-Spigot-Update-20140909a.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 11 Sep 2014 01:06:54 -0700 -Subject: [PATCH] Spigot Update - 20140909a - - -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - ../pom.xml - - -+ -+ -+ sonatype-snapshots -+ https://oss.sonatype.org/content/repositories/public -+ -+ -+ - - - -@@ -0,0 +0,0 @@ - - - -+ net.md-5 -+ bungeecord-chat -+ 1.8-SNAPSHOT -+ jar -+ compile -+ -+ - org.yaml - snakeyaml - 1.12 -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ import java.util.Set; - import java.util.UUID; - import java.util.logging.Logger; - -+import net.md_5.bungee.api.chat.BaseComponent; - import org.bukkit.Warning.WarningState; - import org.bukkit.command.CommandException; - import org.bukkit.command.CommandSender; -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ public void broadcast(BaseComponent component) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void broadcast(BaseComponent... components) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - - import java.net.InetSocketAddress; - -+import net.md_5.bungee.api.chat.BaseComponent; - import org.bukkit.Achievement; - import org.bukkit.ChatColor; - import org.bukkit.Effect; -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ public void sendMessage(BaseComponent component) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void sendMessage(BaseComponent... components) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -1.9.4.msysgit.0 - diff --git a/Bukkit-Patches/0033-Spigot-Update-20140909b.patch b/Bukkit-Patches/0033-Spigot-Update-20140909b.patch deleted file mode 100644 index 3b61dd99e9..0000000000 --- a/Bukkit-Patches/0033-Spigot-Update-20140909b.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 17:16:11 -0700 -Subject: [PATCH] Spigot Update - 20140909b - - -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); - 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 - 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"); --- -1.9.4.msysgit.0 - diff --git a/Bukkit-Patches/0034-Spigot-Update-20140911a.patch b/Bukkit-Patches/0034-Spigot-Update-20140911a.patch deleted file mode 100644 index b057b73f4b..0000000000 --- a/Bukkit-Patches/0034-Spigot-Update-20140911a.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 18:20:53 -0700 -Subject: [PATCH] Spigot Update - 20140911a - - -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - 1.8-SNAPSHOT - jar - compile -+ -+ -+ com.google.code.gson -+ gson -+ -+ -+ net.sf.trove4j -+ trove4j -+ -+ - - - org.yaml --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit b/CraftBukkit deleted file mode 160000 index 07d4558b48..0000000000 --- a/CraftBukkit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 07d4558b48d0717cb7f9e07015c76599b9fe9697 diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch index 8e8d7b97fa..149bfcff24 100644 --- a/CraftBukkit-Patches/0001-POM-Changes.patch +++ b/CraftBukkit-Patches/0001-POM-Changes.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc + spigot jar - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - CraftBukkit - http://www.bukkit.org + Spigot @@ -30,33 +30,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -- -- scm:git:git://github.com/Bukkit/CraftBukkit.git -- scm:git:ssh://git@github.com/Bukkit/CraftBukkit.git -- https://github.com/Bukkit/CraftBukkit -- -- -- -- -- repobo-rel -- repo.bukkit.org Releases -- http://repo.bukkit.org/content/repositories/releases/ -- -- -- repobo-snap -- repo.bukkit.org Snapshots -- http://repo.bukkit.org/content/repositories/snapshots/ -- -- + + org.spigotmc + spigot-parent + dev-SNAPSHOT + ../pom.xml + - ++ + repobo-snap @@ -0,0 +0,0 @@ @@ -68,50 +51,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ${project.version} jar compile - - -- org.bukkit -+ org.spigotmc - minecraft-server -- ${minecraft.version} -+ ${minecraft.version}-SNAPSHOT - jar - compile - -@@ -0,0 +0,0 @@ - gson - 2.1 - -- -- org.avaje -- ebean -- 2.7.3 -- jar -- provided -- -- -- org.yaml -- snakeyaml -- 1.9 -- jar -- provided -- -- -- com.google.guava -- guava -- 10.0 -- jar -- provided -- -- -- commons-lang -- commons-lang -- 2.3 -- provided -- - - - junit @@ -0,0 +0,0 @@ @@ -140,19 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 package -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - loadIcon(); - - updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel")); -- updater.setEnabled(configuration.getBoolean("auto-updater.enabled")); -+ updater.setEnabled(false); // Spigot - updater.setSuggestChannels(configuration.getBoolean("auto-updater.suggest-channels")); - updater.getOnBroken().addAll(configuration.getStringList("auto-updater.on-broken")); - updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index ea0ba618a7..30bcde69c5 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final double b; + private String c; + -+ public AttributeRanged(String s, double d0, double d1, double d2) { -+ super(s, d0); ++ public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { ++ super(iattribute, s, d0); + this.a = d1; + this.b = d2; + if (d1 > d2) { @@ -37,19 +37,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this; + } + -+ public String f() { ++ public String g() { + return this.c; + } + + public double a(double d0) { -+ if (d0 < this.a) { -+ d0 = this.a; -+ } -+ -+ if (d0 > this.b) { -+ d0 = this.b; -+ } -+ ++ d0 = MathHelper.a(d0, this.a, this.b); + return d0; + } +} @@ -61,19 +54,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.gson.JsonDeserializationContext; ++import com.google.gson.JsonDeserializer; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonSerializationContext; ++import com.google.gson.JsonSerializer; ++import com.mojang.authlib.GameProfile; +import java.lang.reflect.Type; +import java.text.ParseException; +import java.util.Date; +import java.util.UUID; + -+import net.minecraft.util.com.google.gson.JsonDeserializationContext; -+import net.minecraft.util.com.google.gson.JsonDeserializer; -+import net.minecraft.util.com.google.gson.JsonElement; -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.google.gson.JsonSerializationContext; -+import net.minecraft.util.com.google.gson.JsonSerializer; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +class BanEntrySerializer implements JsonDeserializer, JsonSerializer { + + final UserCache a; @@ -162,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + protected World a; + protected Random b; -+ protected int c; -+ protected int d; ++ protected BlockPosition c; ++ protected CustomWorldSettingsFinal d; + protected WorldGenerator e = new WorldGenClay(4); + protected WorldGenerator f; + protected WorldGenerator g; @@ -175,16 +167,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected WorldGenerator m; + protected WorldGenerator n; + protected WorldGenerator o; -+ protected WorldGenFlowers p; ++ protected WorldGenerator p; + protected WorldGenerator q; + protected WorldGenerator r; -+ protected WorldGenerator s; ++ protected WorldGenFlowers s; + protected WorldGenerator t; + protected WorldGenerator u; + protected WorldGenerator v; -+ protected int w; -+ protected int x; -+ protected int y; ++ protected WorldGenerator w; ++ protected WorldGenerator x; ++ protected WorldGenerator y; + protected int z; + protected int A; + protected int B; @@ -194,42 +186,55 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected int F; + protected int G; + protected int H; -+ public boolean I; ++ protected int I; ++ protected int J; ++ protected int K; ++ public boolean L; + + public BiomeDecorator() { + this.f = new WorldGenSand(Blocks.SAND, 7); + this.g = new WorldGenSand(Blocks.GRAVEL, 6); -+ this.h = new WorldGenMinable(Blocks.DIRT, 32); -+ this.i = new WorldGenMinable(Blocks.GRAVEL, 32); -+ this.j = new WorldGenMinable(Blocks.COAL_ORE, 16); -+ this.k = new WorldGenMinable(Blocks.IRON_ORE, 8); -+ this.l = new WorldGenMinable(Blocks.GOLD_ORE, 8); -+ this.m = new WorldGenMinable(Blocks.REDSTONE_ORE, 7); -+ this.n = new WorldGenMinable(Blocks.DIAMOND_ORE, 7); -+ this.o = new WorldGenMinable(Blocks.LAPIS_ORE, 6); -+ this.p = new WorldGenFlowers(Blocks.YELLOW_FLOWER); -+ this.q = new WorldGenFlowers(Blocks.BROWN_MUSHROOM); -+ this.r = new WorldGenFlowers(Blocks.RED_MUSHROOM); -+ this.s = new WorldGenHugeMushroom(); -+ this.t = new WorldGenReed(); -+ this.u = new WorldGenCactus(); -+ this.v = new WorldGenWaterLily(); -+ this.y = 2; -+ this.z = 1; -+ this.E = 1; -+ this.F = 3; -+ this.G = 1; -+ this.I = true; ++ this.s = new WorldGenFlowers(Blocks.YELLOW_FLOWER, EnumFlowerVarient.DANDELION); ++ this.t = new WorldGenMushrooms(Blocks.BROWN_MUSHROOM); ++ this.u = new WorldGenMushrooms(Blocks.RED_MUSHROOM); ++ this.v = new WorldGenHugeMushroom(); ++ this.w = new WorldGenReed(); ++ this.x = new WorldGenCactus(); ++ this.y = new WorldGenWaterLily(); ++ this.B = 2; ++ this.C = 1; ++ this.H = 1; ++ this.I = 3; ++ this.J = 1; ++ this.L = true; + } + -+ public void a(World world, Random random, BiomeBase biomebase, int i, int j) { ++ public void a(World world, Random random, BiomeBase biomebase, BlockPosition blockposition) { + if (this.a != null) { -+ throw new RuntimeException("Already decorating!!"); ++ throw new RuntimeException("Already decorating"); + } else { + this.a = world; ++ String s = world.getWorldData().getGeneratorOptions(); ++ ++ if (s != null) { ++ this.d = CustomWorldSettings.a(s).b(); ++ } else { ++ this.d = CustomWorldSettings.a("").b(); ++ } ++ + this.b = random; -+ this.c = i; -+ this.d = j; ++ this.c = blockposition; ++ this.h = new WorldGenMinable(Blocks.DIRT.getBlockData(), this.d.I); ++ this.i = new WorldGenMinable(Blocks.GRAVEL.getBlockData(), this.d.M); ++ this.j = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.GRANITE), this.d.Q); ++ this.k = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.DIORITE), this.d.U); ++ this.l = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.ANDESITE), this.d.Y); ++ this.m = new WorldGenMinable(Blocks.COAL_ORE.getBlockData(), this.d.ac); ++ this.n = new WorldGenMinable(Blocks.IRON_ORE.getBlockData(), this.d.ag); ++ this.o = new WorldGenMinable(Blocks.GOLD_ORE.getBlockData(), this.d.ak); ++ this.p = new WorldGenMinable(Blocks.REDSTONE_ORE.getBlockData(), this.d.ao); ++ this.q = new WorldGenMinable(Blocks.DIAMOND_ORE.getBlockData(), this.d.as); ++ this.r = new WorldGenMinable(Blocks.LAPIS_ORE.getBlockData(), this.d.aw); + this.a(biomebase); + this.a = null; + this.b = null; @@ -243,194 +248,224 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int j; + int k; + -+ for (i = 0; i < this.F; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.f.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.I; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.f.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ for (i = 0; i < this.G; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.e.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.J; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.e.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ for (i = 0; i < this.E; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.g.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.H; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.g.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ i = this.x; ++ i = this.A; + if (this.b.nextInt(10) == 0) { + ++i; + } + + int l; -+ int i1; ++ BlockPosition blockposition; + + for (j = 0; j < i; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.a.getHighestBlockYAt(k, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; + WorldGenTreeAbstract worldgentreeabstract = biomebase.a(this.b); + -+ worldgentreeabstract.a(1.0D, 1.0D, 1.0D); -+ if (worldgentreeabstract.generate(this.a, this.b, k, i1, l)) { -+ worldgentreeabstract.b(this.a, this.b, k, i1, l); ++ worldgentreeabstract.e(); ++ blockposition = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); ++ if (worldgentreeabstract.generate(this.a, this.b, blockposition)) { ++ worldgentreeabstract.a(this.a, this.b, blockposition); + } + } + -+ for (j = 0; j < this.H; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ this.s.generate(this.a, this.b, k, this.a.getHighestBlockYAt(k, l), l); ++ for (j = 0; j < this.K; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ this.v.generate(this.a, this.b, this.a.getHighestBlockYAt(this.c.a(k, 0, l))); + } + -+ for (j = 0; j < this.y; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) + 32); -+ String s = biomebase.a(this.b, k, i1, l); -+ BlockFlowers blockflowers = BlockFlowers.e(s); -+ -+ if (blockflowers.getMaterial() != Material.AIR) { -+ this.p.a(blockflowers, BlockFlowers.f(s)); -+ this.p.generate(this.a, this.b, k, i1, l); -+ } -+ } -+ -+ for (j = 0; j < this.z; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ WorldGenerator worldgenerator = biomebase.b(this.b); -+ -+ worldgenerator.generate(this.a, this.b, k, i1, l); -+ } -+ -+ for (j = 0; j < this.A; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ (new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l); -+ } -+ -+ for (j = 0; j < this.w; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ -+ for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { -+ ; -+ } -+ -+ this.v.generate(this.a, this.b, k, i1, l); -+ } ++ int i1; + + for (j = 0; j < this.B; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); ++ blockposition = this.c.a(k, i1, l); ++ EnumFlowerVarient enumflowervarient = biomebase.a(this.b, blockposition); ++ BlockFlowers blockflowers = enumflowervarient.a().a(); ++ ++ if (blockflowers.getMaterial() != Material.AIR) { ++ this.s.a(blockflowers, enumflowervarient); ++ this.s.generate(this.a, this.b, blockposition); ++ } ++ } ++ ++ for (j = 0; j < this.C; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ biomebase.b(this.b).generate(this.a, this.b, this.c.a(k, i1, l)); ++ } ++ ++ for (j = 0; j < this.D; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ (new WorldGenDeadBush()).generate(this.a, this.b, this.c.a(k, i1, l)); ++ } ++ ++ j = 0; ++ ++ while (j < this.z) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ blockposition = this.c.a(k, i1, l); ++ ++ while (true) { ++ if (blockposition.getY() > 0) { ++ BlockPosition blockposition1 = blockposition.down(); ++ ++ if (this.a.isEmpty(blockposition1)) { ++ blockposition = blockposition1; ++ continue; ++ } ++ } ++ ++ this.y.generate(this.a, this.b, blockposition); ++ ++j; ++ break; ++ } ++ } ++ ++ for (j = 0; j < this.E; ++j) { + if (this.b.nextInt(4) == 0) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.a.getHighestBlockYAt(k, l); -+ this.q.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ BlockPosition blockposition2 = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); ++ ++ this.t.generate(this.a, this.b, blockposition2); + } + + if (this.b.nextInt(8) == 0) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.r.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ blockposition = this.c.a(k, i1, l); ++ this.u.generate(this.a, this.b, blockposition); + } + } + + if (this.b.nextInt(4) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ this.q.generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ this.t.generate(this.a, this.b, this.c.a(j, l, k)); + } + + if (this.b.nextInt(8) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ this.r.generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ this.u.generate(this.a, this.b, this.c.a(j, l, k)); + } + -+ for (j = 0; j < this.C; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.t.generate(this.a, this.b, k, i1, l); ++ for (j = 0; j < this.F; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.w.generate(this.a, this.b, this.c.a(k, i1, l)); + } + + for (j = 0; j < 10; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.t.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.w.generate(this.a, this.b, this.c.a(k, i1, l)); + } + + if (this.b.nextInt(32) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ (new WorldGenPumpkin()).generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ (new WorldGenPumpkin()).generate(this.a, this.b, this.c.a(j, l, k)); + } + -+ for (j = 0; j < this.D; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.u.generate(this.a, this.b, k, i1, l); ++ for (j = 0; j < this.G; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.x.generate(this.a, this.b, this.c.a(k, i1, l)); + } + -+ if (this.I) { ++ if (this.L) { ++ BlockPosition blockposition3; ++ + for (j = 0; j < 50; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.b.nextInt(248) + 8); -+ i1 = this.d + this.b.nextInt(16) + 8; -+ (new WorldGenLiquids(Blocks.WATER)).generate(this.a, this.b, k, l, i1); ++ blockposition3 = this.c.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(248) + 8), this.b.nextInt(16) + 8); ++ (new WorldGenLiquids(Blocks.FLOWING_WATER)).generate(this.a, this.b, blockposition3); + } + + for (j = 0; j < 20; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.b.nextInt(this.b.nextInt(240) + 8) + 8); -+ i1 = this.d + this.b.nextInt(16) + 8; -+ (new WorldGenLiquids(Blocks.LAVA)).generate(this.a, this.b, k, l, i1); ++ blockposition3 = this.c.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(this.b.nextInt(240) + 8) + 8), this.b.nextInt(16) + 8); ++ (new WorldGenLiquids(Blocks.FLOWING_LAVA)).generate(this.a, this.b, blockposition3); + } + } ++ + } + + protected void a(int i, WorldGenerator worldgenerator, int j, int k) { -+ for (int l = 0; l < i; ++l) { -+ int i1 = this.c + this.b.nextInt(16); -+ int j1 = this.b.nextInt(k - j) + j; -+ int k1 = this.d + this.b.nextInt(16); ++ int l; + -+ worldgenerator.generate(this.a, this.b, i1, j1, k1); ++ if (k < j) { ++ l = j; ++ j = k; ++ k = l; ++ } else if (k == j) { ++ if (j < 255) { ++ ++k; ++ } else { ++ --j; ++ } + } ++ ++ for (l = 0; l < i; ++l) { ++ BlockPosition blockposition = this.c.a(this.b.nextInt(16), this.b.nextInt(k - j) + j, this.b.nextInt(16)); ++ ++ worldgenerator.generate(this.a, this.b, blockposition); ++ } ++ + } + + protected void b(int i, WorldGenerator worldgenerator, int j, int k) { + for (int l = 0; l < i; ++l) { -+ int i1 = this.c + this.b.nextInt(16); -+ int j1 = this.b.nextInt(k) + this.b.nextInt(k) + (j - k); -+ int k1 = this.d + this.b.nextInt(16); ++ BlockPosition blockposition = this.c.a(this.b.nextInt(16), this.b.nextInt(k) + this.b.nextInt(k) + j - k, this.b.nextInt(16)); + -+ worldgenerator.generate(this.a, this.b, i1, j1, k1); ++ worldgenerator.generate(this.a, this.b, blockposition); + } ++ + } + + protected void a() { -+ this.a(20, this.h, 0, 256); -+ this.a(10, this.i, 0, 256); -+ this.a(20, this.j, 0, 128); -+ this.a(20, this.k, 0, 64); -+ this.a(2, this.l, 0, 32); -+ this.a(8, this.m, 0, 16); -+ this.a(1, this.n, 0, 16); -+ this.b(1, this.o, 16, 16); ++ this.a(this.d.J, this.h, this.d.K, this.d.L); ++ this.a(this.d.N, this.i, this.d.O, this.d.P); ++ this.a(this.d.V, this.k, this.d.W, this.d.X); ++ this.a(this.d.R, this.j, this.d.S, this.d.T); ++ this.a(this.d.Z, this.l, this.d.aa, this.d.ab); ++ this.a(this.d.ad, this.m, this.d.ae, this.d.af); ++ this.a(this.d.ah, this.n, this.d.ai, this.d.aj); ++ this.a(this.d.al, this.o, this.d.am, this.d.an); ++ this.a(this.d.ap, this.p, this.d.aq, this.d.ar); ++ this.a(this.d.at, this.q, this.d.au, this.d.av); ++ this.b(this.d.ax, this.r, this.d.ay, this.d.az); + } +} diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java @@ -441,14 +476,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.base.Predicate; ++ +public class BlockAnvil extends BlockFalling { + -+ public static final String[] a = new String[] { "intact", "slightlyDamaged", "veryDamaged"}; -+ private static final String[] N = new String[] { "anvil_top_damaged_0", "anvil_top_damaged_1", "anvil_top_damaged_2"}; ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); ++ public static final BlockStateInteger DAMAGE = BlockStateInteger.of("damage", 0, 2); + + protected BlockAnvil() { + super(Material.HEAVY); -+ this.g(0); ++ this.j(this.blockStateList.getBlockData().set(BlockAnvil.FACING, EnumDirection.NORTH).set(BlockAnvil.DAMAGE, Integer.valueOf(0))); ++ this.e(0); + this.a(CreativeModeTab.c); + } + @@ -460,63 +498,59 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + -+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) { -+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3; -+ int i1 = world.getData(i, j, k) >> 2; ++ public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { ++ EnumDirection enumdirection1 = entityliving.getDirection().e(); + -+ ++l; -+ l %= 4; -+ if (l == 0) { -+ world.setData(i, j, k, 2 | i1 << 2, 2); -+ } -+ -+ if (l == 1) { -+ world.setData(i, j, k, 3 | i1 << 2, 2); -+ } -+ -+ if (l == 2) { -+ world.setData(i, j, k, 0 | i1 << 2, 2); -+ } -+ -+ if (l == 3) { -+ world.setData(i, j, k, 1 | i1 << 2, 2); -+ } ++ return super.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityliving).set(BlockAnvil.FACING, enumdirection1).set(BlockAnvil.DAMAGE, Integer.valueOf(i >> 2)); + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { -+ if (world.isStatic) { -+ return true; -+ } else { -+ entityhuman.openAnvil(i, j, k); -+ return true; ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (!world.isStatic) { ++ entityhuman.openTileEntity(new TileEntityContainerAnvil(world, blockposition)); + } ++ ++ return true; + } + -+ public int b() { -+ return 35; ++ public int getDropData(IBlockData iblockdata) { ++ return ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue(); + } + -+ public int getDropData(int i) { -+ return i >> 2; -+ } ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockAnvil.FACING); + -+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { -+ int l = iblockaccess.getData(i, j, k) & 3; -+ -+ if (l != 3 && l != 1) { -+ this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); -+ } else { ++ if (enumdirection.k() == EnumAxis.X) { + this.a(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); ++ } else { ++ this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); + } ++ + } + + protected void a(EntityFallingBlock entityfallingblock) { + entityfallingblock.a(true); + } + -+ public void a(World world, int i, int j, int k, int l) { -+ world.triggerEffect(1022, i, j, k, 0); ++ public void a_(World world, BlockPosition blockposition) { ++ world.triggerEffect(1022, blockposition, 0); + } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockAnvil.FACING, EnumDirection.fromType2(i & 3)).set(BlockAnvil.DAMAGE, Integer.valueOf((i & 15) >> 2)); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ byte b0 = 0; ++ int i = b0 | ((EnumDirection) iblockdata.get(BlockAnvil.FACING)).b(); ++ ++ i |= ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue() << 2; ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockAnvil.FACING, BlockAnvil.DAMAGE}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java new file mode 100644 @@ -531,10 +565,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class BlockBrewingStand extends BlockContainer { + -+ private Random a = new Random(); ++ public static final BlockStateBoolean[] HAS_BOTTLE = new BlockStateBoolean[] { BlockStateBoolean.of("has_bottle_0"), BlockStateBoolean.of("has_bottle_1"), BlockStateBoolean.of("has_bottle_2")}; ++ private final Random b = new Random(); + + public BlockBrewingStand() { + super(Material.ORE); ++ this.j(this.blockStateList.getBlockData().set(BlockBrewingStand.HAS_BOTTLE[0], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[1], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[2], Boolean.valueOf(false))); + } + + public boolean c() { @@ -542,7 +578,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public int b() { -+ return 25; ++ return 3; + } + + public TileEntity a(World world, int i) { @@ -553,75 +589,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + -+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { + this.a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); -+ super.a(world, i, j, k, axisalignedbb, list, entity); -+ this.g(); -+ super.a(world, i, j, k, axisalignedbb, list, entity); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.h(); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); + } + -+ public void g() { ++ public void h() { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { + if (world.isStatic) { + return true; + } else { -+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) world.getTileEntity(i, j, k); ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ if (tileentitybrewingstand != null) { -+ entityhuman.openBrewingStand(tileentitybrewingstand); ++ if (tileentity instanceof TileEntityBrewingStand) { ++ entityhuman.openContainer((TileEntityBrewingStand) tileentity); + } + + return true; + } + } + -+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) { ++ public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) { + if (itemstack.hasName()) { -+ ((TileEntityBrewingStand) world.getTileEntity(i, j, k)).a(itemstack.getName()); -+ } -+ } ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ TileEntity tileentity = world.getTileEntity(i, j, k); -+ -+ if (tileentity instanceof TileEntityBrewingStand) { -+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) tileentity; -+ -+ for (int i1 = 0; i1 < tileentitybrewingstand.getSize(); ++i1) { -+ ItemStack itemstack = tileentitybrewingstand.getItem(i1); -+ -+ if (itemstack != null) { -+ float f = this.a.nextFloat() * 0.8F + 0.1F; -+ float f1 = this.a.nextFloat() * 0.8F + 0.1F; -+ float f2 = this.a.nextFloat() * 0.8F + 0.1F; -+ -+ while (itemstack.count > 0) { -+ int j1 = this.a.nextInt(21) + 10; -+ -+ if (j1 > itemstack.count) { -+ j1 = itemstack.count; -+ } -+ -+ itemstack.count -= j1; -+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData())); -+ float f3 = 0.05F; -+ -+ entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); -+ entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); -+ entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); -+ world.addEntity(entityitem); -+ } -+ } ++ if (tileentity instanceof TileEntityBrewingStand) { ++ ((TileEntityBrewingStand) tileentity).a(itemstack.getName()); + } + } + -+ super.remove(world, i, j, k, block, l); + } + -+ public Item getDropType(int i, Random random, int j) { ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityBrewingStand) { ++ InventoryUtils.dropInventory(world, blockposition, (TileEntityBrewingStand) tileentity); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public Item getDropType(IBlockData iblockdata, Random random, int i) { + return Items.BREWING_STAND; + } + @@ -629,9 +643,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return true; + } + -+ public int g(World world, int i, int j, int k, int l) { -+ return Container.b((IInventory) world.getTileEntity(i, j, k)); ++ public int l(World world, BlockPosition blockposition) { ++ return Container.a(world.getTileEntity(blockposition)); + } ++ ++ public IBlockData fromLegacyData(int i) { ++ IBlockData iblockdata = this.getBlockData(); ++ ++ for (int j = 0; j < 3; ++j) { ++ iblockdata = iblockdata.set(BlockBrewingStand.HAS_BOTTLE[j], Boolean.valueOf((i & 1 << j) > 0)); ++ } ++ ++ return iblockdata; ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ int i = 0; ++ ++ for (int j = 0; j < 3; ++j) { ++ if (((Boolean) iblockdata.get(BlockBrewingStand.HAS_BOTTLE[j])).booleanValue()) { ++ i |= 1 << j; ++ } ++ } ++ ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockBrewingStand.HAS_BOTTLE[0], BlockBrewingStand.HAS_BOTTLE[1], BlockBrewingStand.HAS_BOTTLE[2]}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java new file mode 100644 @@ -645,12 +686,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class BlockFlowerPot extends BlockContainer { + ++ public static final BlockStateInteger LEGACY_DATA = BlockStateInteger.of("legacy_data", 0, 15); ++ public static final BlockStateEnum CONTENTS = BlockStateEnum.of("contents", EnumFlowerPotContents.class); ++ + public BlockFlowerPot() { + super(Material.ORIENTABLE); -+ this.g(); ++ this.j(this.blockStateList.getBlockData().set(BlockFlowerPot.CONTENTS, EnumFlowerPotContents.EMPTY).set(BlockFlowerPot.LEGACY_DATA, Integer.valueOf(0))); ++ this.h(); + } + -+ public void g() { ++ public void h() { + float f = 0.375F; + float f1 = f / 2.0F; + @@ -662,43 +707,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public int b() { -+ return 33; ++ return 3; + } + + public boolean d() { + return false; + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { + ItemStack itemstack = entityhuman.inventory.getItemInHand(); + + if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + -+ if (tileentityflowerpot != null) { -+ if (tileentityflowerpot.a() != null) { ++ if (tileentityflowerpot == null) { ++ return false; ++ } else if (tileentityflowerpot.b() != null) { ++ return false; ++ } else { ++ Block block = Block.asBlock(itemstack.getItem()); ++ ++ if (!this.a(block, itemstack.getData())) { + return false; + } else { -+ Block block = Block.a(itemstack.getItem()); -+ -+ if (!this.a(block, itemstack.getData())) { -+ return false; -+ } else { -+ tileentityflowerpot.a(itemstack.getItem(), itemstack.getData()); -+ tileentityflowerpot.update(); -+ if (!world.setData(i, j, k, itemstack.getData(), 2)) { -+ world.notify(i, j, k); -+ } -+ -+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { -+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); -+ } -+ -+ return true; ++ tileentityflowerpot.a(itemstack.getItem(), itemstack.getData()); ++ tileentityflowerpot.update(); ++ world.notify(blockposition); ++ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { ++ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); + } ++ ++ return true; + } -+ } else { -+ return false; + } + } else { + return false; @@ -706,65 +746,67 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private boolean a(Block block, int i) { -+ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_ROSE && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEAD_BUSH ? block == Blocks.LONG_GRASS && i == 2 : true; ++ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_FLOWER && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEADBUSH ? block == Blocks.TALLGRASS && i == EnumTallGrassType.FERN.a() : true; + } + -+ public int getDropData(World world, int i, int j, int k) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ public int getDropData(World world, BlockPosition blockposition) { ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + -+ return tileentityflowerpot != null && tileentityflowerpot.a() != null ? tileentityflowerpot.b() : 0; ++ return tileentityflowerpot != null && tileentityflowerpot.b() != null ? tileentityflowerpot.c() : 0; + } + -+ public boolean canPlace(World world, int i, int j, int k) { -+ return super.canPlace(world, i, j, k) && World.a((IBlockAccess) world, i, j - 1, k); ++ public boolean canPlace(World world, BlockPosition blockposition) { ++ return super.canPlace(world, blockposition) && World.a((IBlockAccess) world, blockposition.down()); + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ if (!World.a((IBlockAccess) world, i, j - 1, k)) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ } -+ } -+ -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); -+ -+ if (tileentityflowerpot != null && tileentityflowerpot.a() != null) { -+ this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b())); ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ if (!World.a((IBlockAccess) world, blockposition.down())) { ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); + } + -+ super.remove(world, i, j, k, block, l); + } + -+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) { -+ super.a(world, i, j, k, l, entityhuman); ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ ++ if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { ++ a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { ++ super.a(world, blockposition, iblockdata, entityhuman); + if (entityhuman.abilities.canInstantlyBuild) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + + if (tileentityflowerpot != null) { -+ tileentityflowerpot.a(Item.getById(0), 0); ++ tileentityflowerpot.a((Item) null, 0); + } + } ++ + } + -+ public Item getDropType(int i, Random random, int j) { ++ public Item getDropType(IBlockData iblockdata, Random random, int i) { + return Items.FLOWER_POT; + } + -+ private TileEntityFlowerPot e(World world, int i, int j, int k) { -+ TileEntity tileentity = world.getTileEntity(i, j, k); ++ private TileEntityFlowerPot d(World world, BlockPosition blockposition) { ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ return tileentity != null && tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; ++ return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; + } + + public TileEntity a(World world, int i) { + Object object = null; -+ byte b0 = 0; ++ int j = 0; + + switch (i) { + case 1: -+ object = Blocks.RED_ROSE; -+ b0 = 0; ++ object = Blocks.RED_FLOWER; ++ j = EnumFlowerVarient.POPPY.b(); + break; + + case 2: @@ -773,22 +815,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + case 3: + object = Blocks.SAPLING; -+ b0 = 0; ++ j = EnumLogVariant.OAK.a(); + break; + + case 4: + object = Blocks.SAPLING; -+ b0 = 1; ++ j = EnumLogVariant.SPRUCE.a(); + break; + + case 5: + object = Blocks.SAPLING; -+ b0 = 2; ++ j = EnumLogVariant.BIRCH.a(); + break; + + case 6: + object = Blocks.SAPLING; -+ b0 = 3; ++ j = EnumLogVariant.JUNGLE.a(); + break; + + case 7: @@ -804,25 +846,304 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + + case 10: -+ object = Blocks.DEAD_BUSH; ++ object = Blocks.DEADBUSH; + break; + + case 11: -+ object = Blocks.LONG_GRASS; -+ b0 = 2; ++ object = Blocks.TALLGRASS; ++ j = EnumTallGrassType.FERN.a(); + break; + + case 12: + object = Blocks.SAPLING; -+ b0 = 4; ++ j = EnumLogVariant.ACACIA.a(); + break; + + case 13: + object = Blocks.SAPLING; -+ b0 = 5; ++ j = EnumLogVariant.DARK_OAK.a(); + } + -+ return new TileEntityFlowerPot(Item.getItemOf((Block) object), b0); ++ return new TileEntityFlowerPot(Item.getItemOf((Block) object), j); ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockFlowerPot.CONTENTS, BlockFlowerPot.LEGACY_DATA}); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ return ((Integer) iblockdata.get(BlockFlowerPot.LEGACY_DATA)).intValue(); ++ } ++ ++ public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ EnumFlowerPotContents enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ TileEntity tileentity = iblockaccess.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityFlowerPot) { ++ TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot) tileentity; ++ Item item = tileentityflowerpot.b(); ++ ++ if (item instanceof ItemBlock) { ++ int i = tileentityflowerpot.c(); ++ Block block = Block.asBlock(item); ++ ++ if (block == Blocks.SAPLING) { ++ switch (SwitchHelperBlockFlowerPot.a[EnumLogVariant.a(i).ordinal()]) { ++ case 1: ++ enumflowerpotcontents = EnumFlowerPotContents.OAK_SAPLING; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.SPRUCE_SAPLING; ++ break; ++ ++ case 3: ++ enumflowerpotcontents = EnumFlowerPotContents.BIRCH_SAPLING; ++ break; ++ ++ case 4: ++ enumflowerpotcontents = EnumFlowerPotContents.JUNGLE_SAPLING; ++ break; ++ ++ case 5: ++ enumflowerpotcontents = EnumFlowerPotContents.ACACIA_SAPLING; ++ break; ++ ++ case 6: ++ enumflowerpotcontents = EnumFlowerPotContents.DARK_OAK_SAPLING; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.TALLGRASS) { ++ switch (i) { ++ case 0: ++ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.FERN; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.YELLOW_FLOWER) { ++ enumflowerpotcontents = EnumFlowerPotContents.DANDELION; ++ } else if (block == Blocks.RED_FLOWER) { ++ switch (SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.a(EnumFlowerType.RED, i).ordinal()]) { ++ case 1: ++ enumflowerpotcontents = EnumFlowerPotContents.POPPY; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.BLUE_ORCHID; ++ break; ++ ++ case 3: ++ enumflowerpotcontents = EnumFlowerPotContents.ALLIUM; ++ break; ++ ++ case 4: ++ enumflowerpotcontents = EnumFlowerPotContents.HOUSTONIA; ++ break; ++ ++ case 5: ++ enumflowerpotcontents = EnumFlowerPotContents.RED_TULIP; ++ break; ++ ++ case 6: ++ enumflowerpotcontents = EnumFlowerPotContents.ORANGE_TULIP; ++ break; ++ ++ case 7: ++ enumflowerpotcontents = EnumFlowerPotContents.WHITE_TULIP; ++ break; ++ ++ case 8: ++ enumflowerpotcontents = EnumFlowerPotContents.PINK_TULIP; ++ break; ++ ++ case 9: ++ enumflowerpotcontents = EnumFlowerPotContents.OXEYE_DAISY; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.RED_MUSHROOM) { ++ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_RED; ++ } else if (block == Blocks.BROWN_MUSHROOM) { ++ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_BROWN; ++ } else if (block == Blocks.DEADBUSH) { ++ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ } else if (block == Blocks.CACTUS) { ++ enumflowerpotcontents = EnumFlowerPotContents.CACTUS; ++ } ++ } ++ } ++ ++ return iblockdata.set(BlockFlowerPot.CONTENTS, enumflowerpotcontents); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/BlockHopper.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Predicate; ++import java.util.List; ++ ++public class BlockHopper extends BlockContainer { ++ ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) (new BlockHopperInnerClass1())); ++ public static final BlockStateBoolean ENABLED = BlockStateBoolean.of("enabled"); ++ ++ public BlockHopper() { ++ super(Material.ORE); ++ this.j(this.blockStateList.getBlockData().set(BlockHopper.FACING, EnumDirection.DOWN).set(BlockHopper.ENABLED, Boolean.valueOf(true))); ++ this.a(CreativeModeTab.d); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ float f = 0.125F; ++ ++ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { ++ EnumDirection enumdirection1 = enumdirection.opposite(); ++ ++ if (enumdirection1 == EnumDirection.UP) { ++ enumdirection1 = EnumDirection.DOWN; ++ } ++ ++ return this.getBlockData().set(BlockHopper.FACING, enumdirection1).set(BlockHopper.ENABLED, Boolean.valueOf(true)); ++ } ++ ++ public TileEntity a(World world, int i) { ++ return new TileEntityHopper(); ++ } ++ ++ public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) { ++ super.postPlace(world, blockposition, iblockdata, entityliving, itemstack); ++ if (itemstack.hasName()) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ ((TileEntityHopper) tileentity).a(itemstack.getName()); ++ } ++ } ++ ++ } ++ ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ this.e(world, blockposition, iblockdata); ++ } ++ ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (world.isStatic) { ++ return true; ++ } else { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ entityhuman.openContainer((TileEntityHopper) tileentity); ++ } ++ ++ return true; ++ } ++ } ++ ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ this.e(world, blockposition, iblockdata); ++ } ++ ++ private void e(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ boolean flag = !world.isBlockIndirectlyPowered(blockposition); ++ ++ if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { ++ world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4); ++ } ++ ++ } ++ ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ InventoryUtils.dropInventory(world, blockposition, (TileEntityHopper) tileentity); ++ world.updateAdjacentComparators(blockposition, this); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public int b() { ++ return 3; ++ } ++ ++ public boolean d() { ++ return false; ++ } ++ ++ public boolean c() { ++ return false; ++ } ++ ++ public static EnumDirection b(int i) { ++ return EnumDirection.fromType1(i & 7); ++ } ++ ++ public static boolean f(int i) { ++ return (i & 8) != 8; ++ } ++ ++ public boolean isComplexRedstone() { ++ return true; ++ } ++ ++ public int l(World world, BlockPosition blockposition) { ++ return Container.a(world.getTileEntity(blockposition)); ++ } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockHopper.FACING, b(i)).set(BlockHopper.ENABLED, Boolean.valueOf(f(i))); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ byte b0 = 0; ++ int i = b0 | ((EnumDirection) iblockdata.get(BlockHopper.FACING)).a(); ++ ++ if (!((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { ++ i |= 8; ++ } ++ ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); + } +} diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java @@ -833,83 +1154,106 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.util.Random; -+ +public class BlockTNT extends Block { + ++ public static final BlockStateBoolean EXPLODE = BlockStateBoolean.of("explode"); ++ + public BlockTNT() { + super(Material.TNT); ++ this.j(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false))); + this.a(CreativeModeTab.d); + } + -+ public void onPlace(World world, int i, int j, int k) { -+ super.onPlace(world, i, j, k); -+ if (world.isBlockIndirectlyPowered(i, j, k)) { -+ this.postBreak(world, i, j, k, 1); -+ world.setAir(i, j, k); ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ super.onPlace(world, blockposition, iblockdata); ++ if (world.isBlockIndirectlyPowered(blockposition)) { ++ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); ++ world.setAir(blockposition); + } ++ + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ if (world.isBlockIndirectlyPowered(i, j, k)) { -+ this.postBreak(world, i, j, k, 1); -+ world.setAir(i, j, k); ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ if (world.isBlockIndirectlyPowered(blockposition)) { ++ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); ++ world.setAir(blockposition); + } ++ + } + -+ public int a(Random random) { -+ return 1; -+ } -+ -+ public void wasExploded(World world, int i, int j, int k, Explosion explosion) { ++ public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { + if (!world.isStatic) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), explosion.c()); ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.c()); + + entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; + world.addEntity(entitytntprimed); + } + } + -+ public void postBreak(World world, int i, int j, int k, int l) { -+ this.a(world, i, j, k, l, (EntityLiving) null); ++ public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ this.a(world, blockposition, iblockdata, (EntityLiving) null); + } + -+ public void a(World world, int i, int j, int k, int l, EntityLiving entityliving) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { + if (!world.isStatic) { -+ if ((l & 1) == 1) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), entityliving); ++ if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); + + world.addEntity(entitytntprimed); + world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); + } ++ + } + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { -+ if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) { -+ this.a(world, i, j, k, 1, entityhuman); -+ world.setAir(i, j, k); -+ entityhuman.bF().damage(1, entityhuman); -+ return true; -+ } else { -+ return super.interact(world, i, j, k, entityhuman, l, f, f1, f2); ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (entityhuman.bY() != null) { ++ Item item = entityhuman.bY().getItem(); ++ ++ if (item == Items.FLINT_AND_STEEL || item == Items.FIRE_CHARGE) { ++ this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman); ++ world.setAir(blockposition); ++ if (item == Items.FLINT_AND_STEEL) { ++ entityhuman.bY().damage(1, entityhuman); ++ } else if (!entityhuman.abilities.canInstantlyBuild) { ++ --entityhuman.bY().count; ++ } ++ ++ return true; ++ } + } ++ ++ return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2); + } + -+ public void a(World world, int i, int j, int k, Entity entity) { -+ if (entity instanceof EntityArrow && !world.isStatic) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { ++ if (!world.isStatic && entity instanceof EntityArrow) { + EntityArrow entityarrow = (EntityArrow) entity; + + if (entityarrow.isBurning()) { -+ this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); -+ world.setAir(i, j, k); ++ this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); ++ world.setAir(blockposition); + } + } ++ + } + + public boolean a(Explosion explosion) { + return false; + } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf((i & 1) > 0)); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ return ((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue() ? 1 : 0; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockTNT.EXPLODE}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java new file mode 100644 @@ -924,56 +1268,67 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class CommandDispatcher extends CommandHandler implements ICommandDispatcher { + + public CommandDispatcher() { -+ this.a(new CommandTime()); -+ this.a(new CommandGamemode()); -+ this.a(new CommandDifficulty()); -+ this.a(new CommandGamemodeDefault()); -+ this.a(new CommandKill()); -+ this.a(new CommandToggleDownfall()); -+ this.a(new CommandWeather()); -+ this.a(new CommandXp()); -+ this.a(new CommandTp()); -+ this.a(new CommandGive()); -+ this.a(new CommandEffect()); -+ this.a(new CommandEnchant()); -+ this.a(new CommandMe()); -+ this.a(new CommandSeed()); -+ this.a(new CommandHelp()); -+ this.a(new CommandDebug()); -+ this.a(new CommandTell()); -+ this.a(new CommandSay()); -+ this.a(new CommandSpawnpoint()); -+ this.a(new CommandSetWorldSpawn()); -+ this.a(new CommandGamerule()); -+ this.a(new CommandClear()); -+ this.a(new CommandTestFor()); -+ this.a(new CommandSpreadPlayers()); -+ this.a(new CommandPlaySound()); -+ this.a(new CommandScoreboard()); -+ this.a(new CommandAchievement()); -+ this.a(new CommandSummon()); -+ this.a(new CommandSetBlock()); -+ this.a(new CommandTestForBlock()); -+ this.a(new CommandTellRaw()); -+ if (MinecraftServer.getServer().X()) { -+ this.a(new CommandOp()); -+ this.a(new CommandDeop()); -+ this.a(new CommandStop()); -+ this.a(new CommandSaveAll()); -+ this.a(new CommandSaveOff()); -+ this.a(new CommandSaveOn()); -+ this.a(new CommandBanIp()); -+ this.a(new CommandPardonIP()); -+ this.a(new CommandBan()); -+ this.a(new CommandBanList()); -+ this.a(new CommandPardon()); -+ this.a(new CommandKick()); -+ this.a(new CommandList()); -+ this.a(new CommandWhitelist()); -+ this.a(new CommandIdleTimeout()); -+ this.a(new CommandNetstat()); ++ this.a((ICommand) (new CommandTime())); ++ this.a((ICommand) (new CommandGamemode())); ++ this.a((ICommand) (new CommandDifficulty())); ++ this.a((ICommand) (new CommandGamemodeDefault())); ++ this.a((ICommand) (new CommandKill())); ++ this.a((ICommand) (new CommandToggleDownfall())); ++ this.a((ICommand) (new CommandWeather())); ++ this.a((ICommand) (new CommandXp())); ++ this.a((ICommand) (new CommandTp())); ++ this.a((ICommand) (new CommandGive())); ++ this.a((ICommand) (new CommandReplaceItem())); ++ this.a((ICommand) (new CommandStats())); ++ this.a((ICommand) (new CommandEffect())); ++ this.a((ICommand) (new CommandEnchant())); ++ this.a((ICommand) (new CommandParticle())); ++ this.a((ICommand) (new CommandMe())); ++ this.a((ICommand) (new CommandSeed())); ++ this.a((ICommand) (new CommandHelp())); ++ this.a((ICommand) (new CommandDebug())); ++ this.a((ICommand) (new CommandTell())); ++ this.a((ICommand) (new CommandSay())); ++ this.a((ICommand) (new CommandSpawnpoint())); ++ this.a((ICommand) (new CommandSetWorldSpawn())); ++ this.a((ICommand) (new CommandGamerule())); ++ this.a((ICommand) (new CommandClear())); ++ this.a((ICommand) (new CommandTestFor())); ++ this.a((ICommand) (new CommandSpreadPlayers())); ++ this.a((ICommand) (new CommandPlaySound())); ++ this.a((ICommand) (new CommandScoreboard())); ++ this.a((ICommand) (new CommandExecute())); ++ this.a((ICommand) (new CommandTrigger())); ++ this.a((ICommand) (new CommandAchievement())); ++ this.a((ICommand) (new CommandSummon())); ++ this.a((ICommand) (new CommandSetBlock())); ++ this.a((ICommand) (new CommandFill())); ++ this.a((ICommand) (new CommandClone())); ++ this.a((ICommand) (new CommandTestForBlocks())); ++ this.a((ICommand) (new CommandBlockData())); ++ this.a((ICommand) (new CommandTestForBlock())); ++ this.a((ICommand) (new CommandTellRaw())); ++ this.a((ICommand) (new CommandWorldBorder())); ++ this.a((ICommand) (new CommandTitle())); ++ this.a((ICommand) (new CommandEntityData())); ++ if (MinecraftServer.getServer().ad()) { ++ this.a((ICommand) (new CommandOp())); ++ this.a((ICommand) (new CommandDeop())); ++ this.a((ICommand) (new CommandStop())); ++ this.a((ICommand) (new CommandSaveAll())); ++ this.a((ICommand) (new CommandSaveOff())); ++ this.a((ICommand) (new CommandSaveOn())); ++ this.a((ICommand) (new CommandBanIp())); ++ this.a((ICommand) (new CommandPardonIP())); ++ this.a((ICommand) (new CommandBan())); ++ this.a((ICommand) (new CommandBanList())); ++ this.a((ICommand) (new CommandPardon())); ++ this.a((ICommand) (new CommandKick())); ++ this.a((ICommand) (new CommandList())); ++ this.a((ICommand) (new CommandWhitelist())); ++ this.a((ICommand) (new CommandIdleTimeout())); + } else { -+ this.a(new CommandPublish()); ++ this.a((ICommand) (new CommandPublish())); + } + + CommandAbstract.a((ICommandDispatcher) this); @@ -981,8 +1336,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) { + boolean flag = true; ++ MinecraftServer minecraftserver = MinecraftServer.getServer(); + -+ if (icommandlistener instanceof CommandBlockListenerAbstract && !MinecraftServer.getServer().worldServer[0].getGameRules().getBoolean("commandBlockOutput")) { ++ if (!icommandlistener.getSendCommandFeedback()) { + flag = false; + } + @@ -991,24 +1347,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY); + chatmessage.getChatModifier().setItalic(Boolean.valueOf(true)); + if (flag) { -+ Iterator iterator = MinecraftServer.getServer().getPlayerList().players.iterator(); ++ Iterator iterator = minecraftserver.getPlayerList().players.iterator(); + + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + -+ if (entityhuman != icommandlistener && MinecraftServer.getServer().getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(entityhuman) && (!(icommandlistener instanceof RemoteControlCommandListener) || MinecraftServer.getServer().m())) { ++ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(icommandlistener)) { + entityhuman.sendMessage(chatmessage); + } + } + } + -+ if (icommandlistener != MinecraftServer.getServer()) { -+ MinecraftServer.getServer().sendMessage(chatmessage); ++ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { ++ minecraftserver.sendMessage(chatmessage); + } + -+ if ((i & 1) != 1) { ++ boolean flag1 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback"); ++ ++ if (icommandlistener instanceof CommandBlockListenerAbstract) { ++ flag1 = ((CommandBlockListenerAbstract) icommandlistener).m(); ++ } ++ ++ if ((i & 1) != 1 && flag1) { + icommandlistener.sendMessage(new ChatMessage(s, aobject)); + } ++ + } +} diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java @@ -1019,22 +1382,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; +import java.util.ArrayList; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; -+ -+import net.minecraft.util.org.apache.commons.lang3.ObjectUtils; ++import org.apache.commons.lang3.ObjectUtils; + +public class DataWatcher { + + private final Entity a; + private boolean b = true; -+ private static final HashMap c = new HashMap(); -+ private final Map d = new HashMap(); ++ private static final Map c = Maps.newHashMap(); ++ private final Map d = Maps.newHashMap(); + private boolean e; + private ReadWriteLock f = new ReentrantReadWriteLock(); + @@ -1043,7 +1406,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(int i, Object object) { -+ Integer integer = (Integer) c.get(object.getClass()); ++ Integer integer = (Integer) DataWatcher.c.get(object.getClass()); + + if (integer == null) { + throw new IllegalArgumentException("Unknown data type: " + object.getClass()); @@ -1062,7 +1425,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void add(int i, int j) { -+ WatchableObject watchableobject = new WatchableObject(j, i, null); ++ WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); + + this.f.writeLock().lock(); + this.d.put(Integer.valueOf(i), watchableobject); @@ -1071,30 +1434,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public byte getByte(int i) { -+ return ((Byte) this.i(i).b()).byteValue(); ++ return ((Byte) this.j(i).b()).byteValue(); + } + + public short getShort(int i) { -+ return ((Short) this.i(i).b()).shortValue(); ++ return ((Short) this.j(i).b()).shortValue(); + } + + public int getInt(int i) { -+ return ((Integer) this.i(i).b()).intValue(); ++ return ((Integer) this.j(i).b()).intValue(); + } + + public float getFloat(int i) { -+ return ((Float) this.i(i).b()).floatValue(); ++ return ((Float) this.j(i).b()).floatValue(); + } + + public String getString(int i) { -+ return (String) this.i(i).b(); ++ return (String) this.j(i).b(); + } + + public ItemStack getItemStack(int i) { -+ return (ItemStack) this.i(i).b(); ++ return (ItemStack) this.j(i).b(); + } + -+ private WatchableObject i(int i) { ++ private WatchableObject j(int i) { + this.f.readLock().lock(); + + WatchableObject watchableobject; @@ -1105,7 +1468,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data"); + -+ crashreportsystemdetails.a("Data ID", Integer.valueOf(i)); ++ crashreportsystemdetails.a("Data ID", (Object) Integer.valueOf(i)); + throw new ReportedException(crashreport); + } + @@ -1113,8 +1476,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return watchableobject; + } + ++ public Vector3f h(int i) { ++ return (Vector3f) this.j(i).b(); ++ } ++ + public void watch(int i, Object object) { -+ WatchableObject watchableobject = this.i(i); ++ WatchableObject watchableobject = this.j(i); + + if (ObjectUtils.notEqual(object, watchableobject.b())) { + watchableobject.a(object); @@ -1122,10 +1489,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + watchableobject.a(true); + this.e = true; + } ++ + } + + public void update(int i) { -+ WatchableObject.a(this.i(i), true); ++ WatchableObject.a(this.j(i), true); + this.e = true; + } + @@ -1160,7 +1528,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (watchableobject.d()) { + watchableobject.a(false); + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + + arraylist.add(watchableobject); @@ -1198,7 +1566,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { + watchableobject = (WatchableObject) iterator.next(); + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + } + @@ -1228,11 +1596,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + + case 4: -+ try { -+ packetdataserializer.a((String) watchableobject.b()); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } ++ packetdataserializer.a((String) watchableobject.b()); + break; + + case 5: @@ -1242,12 +1606,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + + case 6: -+ ChunkCoordinates chunkcoordinates = (ChunkCoordinates) watchableobject.b(); ++ BlockPosition blockposition = (BlockPosition) watchableobject.b(); + -+ packetdataserializer.writeInt(chunkcoordinates.x); -+ packetdataserializer.writeInt(chunkcoordinates.y); -+ packetdataserializer.writeInt(chunkcoordinates.z); ++ packetdataserializer.writeInt(blockposition.getX()); ++ packetdataserializer.writeInt(blockposition.getY()); ++ packetdataserializer.writeInt(blockposition.getZ()); ++ break; ++ ++ case 7: ++ Vector3f vector3f = (Vector3f) watchableobject.b(); ++ ++ packetdataserializer.writeFloat(vector3f.getX()); ++ packetdataserializer.writeFloat(vector3f.getY()); ++ packetdataserializer.writeFloat(vector3f.getZ()); + } ++ + } + + public static List b(PacketDataSerializer packetdataserializer) { @@ -1255,7 +1628,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + for (byte b0 = packetdataserializer.readByte(); b0 != 127; b0 = packetdataserializer.readByte()) { + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + + int i = (b0 & 224) >> 5; @@ -1280,15 +1653,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + + case 4: -+ try { -+ watchableobject = new WatchableObject(i, j, packetdataserializer.c(32767)); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } ++ watchableobject = new WatchableObject(i, j, packetdataserializer.c(32767)); + break; + + case 5: -+ watchableobject = new WatchableObject(i, j, packetdataserializer.c()); ++ watchableobject = new WatchableObject(i, j, packetdataserializer.i()); + break; + + case 6: @@ -1296,7 +1665,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int l = packetdataserializer.readInt(); + int i1 = packetdataserializer.readInt(); + -+ watchableobject = new WatchableObject(i, j, new ChunkCoordinates(k, l, i1)); ++ watchableobject = new WatchableObject(i, j, new BlockPosition(k, l, i1)); ++ break; ++ ++ case 7: ++ float f = packetdataserializer.readFloat(); ++ float f1 = packetdataserializer.readFloat(); ++ float f2 = packetdataserializer.readFloat(); ++ ++ watchableobject = new WatchableObject(i, j, new Vector3f(f, f1, f2)); + } + + arraylist.add(watchableobject); @@ -1314,15 +1691,864 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + static { -+ c.put(Byte.class, Integer.valueOf(0)); -+ c.put(Short.class, Integer.valueOf(1)); -+ c.put(Integer.class, Integer.valueOf(2)); -+ c.put(Float.class, Integer.valueOf(3)); -+ c.put(String.class, Integer.valueOf(4)); -+ c.put(ItemStack.class, Integer.valueOf(5)); -+ c.put(ChunkCoordinates.class, Integer.valueOf(6)); ++ DataWatcher.c.put(Byte.class, Integer.valueOf(0)); ++ DataWatcher.c.put(Short.class, Integer.valueOf(1)); ++ DataWatcher.c.put(Integer.class, Integer.valueOf(2)); ++ DataWatcher.c.put(Float.class, Integer.valueOf(3)); ++ DataWatcher.c.put(String.class, Integer.valueOf(4)); ++ DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); ++ DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); ++ DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); + } +} +diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentManager.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.Iterator; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.Random; ++ ++public class EnchantmentManager { ++ ++ private static final Random a = new Random(); ++ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null); ++ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null); ++ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null); ++ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null); ++ ++ public static int getEnchantmentLevel(int i, ItemStack itemstack) { ++ if (itemstack == null) { ++ return 0; ++ } else { ++ NBTTagList nbttaglist = itemstack.getEnchantments(); ++ ++ if (nbttaglist == null) { ++ return 0; ++ } else { ++ for (int j = 0; j < nbttaglist.size(); ++j) { ++ short short0 = nbttaglist.get(j).getShort("id"); ++ short short1 = nbttaglist.get(j).getShort("lvl"); ++ ++ if (short0 == i) { ++ return short1; ++ } ++ } ++ ++ return 0; ++ } ++ } ++ } ++ ++ public static Map a(ItemStack itemstack) { ++ LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(); ++ NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.h(itemstack) : itemstack.getEnchantments(); ++ ++ if (nbttaglist != null) { ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ short short0 = nbttaglist.get(i).getShort("id"); ++ short short1 = nbttaglist.get(i).getShort("lvl"); ++ ++ linkedhashmap.put(Integer.valueOf(short0), Integer.valueOf(short1)); ++ } ++ } ++ ++ return linkedhashmap; ++ } ++ ++ public static void a(Map map, ItemStack itemstack) { ++ NBTTagList nbttaglist = new NBTTagList(); ++ Iterator iterator = map.keySet().iterator(); ++ ++ while (iterator.hasNext()) { ++ int i = ((Integer) iterator.next()).intValue(); ++ Enchantment enchantment = Enchantment.getById(i); ++ ++ if (enchantment != null) { ++ NBTTagCompound nbttagcompound = new NBTTagCompound(); ++ ++ nbttagcompound.setShort("id", (short) i); ++ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue()); ++ nbttaglist.add(nbttagcompound); ++ if (itemstack.getItem() == Items.ENCHANTED_BOOK) { ++ Items.ENCHANTED_BOOK.a(itemstack, new WeightedRandomEnchant(enchantment, ((Integer) map.get(Integer.valueOf(i))).intValue())); ++ } ++ } ++ } ++ ++ if (nbttaglist.size() > 0) { ++ if (itemstack.getItem() != Items.ENCHANTED_BOOK) { ++ itemstack.a("ench", (NBTBase) nbttaglist); ++ } ++ } else if (itemstack.hasTag()) { ++ itemstack.getTag().remove("ench"); ++ } ++ ++ } ++ ++ public static int a(int i, ItemStack[] aitemstack) { ++ if (aitemstack == null) { ++ return 0; ++ } else { ++ int j = 0; ++ ItemStack[] aitemstack1 = aitemstack; ++ int k = aitemstack.length; ++ ++ for (int l = 0; l < k; ++l) { ++ ItemStack itemstack = aitemstack1[l]; ++ int i1 = getEnchantmentLevel(i, itemstack); ++ ++ if (i1 > j) { ++ j = i1; ++ } ++ } ++ ++ return j; ++ } ++ } ++ ++ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { ++ if (itemstack != null) { ++ NBTTagList nbttaglist = itemstack.getEnchantments(); ++ ++ if (nbttaglist != null) { ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ short short0 = nbttaglist.get(i).getShort("id"); ++ short short1 = nbttaglist.get(i).getShort("lvl"); ++ ++ if (Enchantment.getById(short0) != null) { ++ enchantmentmodifier.a(Enchantment.getById(short0), short1); ++ } ++ } ++ ++ } ++ } ++ } ++ ++ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) { ++ ItemStack[] aitemstack1 = aitemstack; ++ int i = aitemstack.length; ++ ++ for (int j = 0; j < i; ++j) { ++ ItemStack itemstack = aitemstack1[j]; ++ ++ a(enchantmentmodifier, itemstack); ++ } ++ ++ } ++ ++ public static int a(ItemStack[] aitemstack, DamageSource damagesource) { ++ EnchantmentManager.b.a = 0; ++ EnchantmentManager.b.b = damagesource; ++ a((EnchantmentModifier) EnchantmentManager.b, aitemstack); ++ if (EnchantmentManager.b.a > 25) { ++ EnchantmentManager.b.a = 25; ++ } ++ ++ return (EnchantmentManager.b.a + 1 >> 1) + EnchantmentManager.a.nextInt((EnchantmentManager.b.a >> 1) + 1); ++ } ++ ++ public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { ++ EnchantmentManager.c.a = 0.0F; ++ EnchantmentManager.c.b = enummonstertype; ++ a((EnchantmentModifier) EnchantmentManager.c, itemstack); ++ return EnchantmentManager.c.a; ++ } ++ ++ public static void a(EntityLiving entityliving, Entity entity) { ++ EnchantmentManager.d.b = entity; ++ EnchantmentManager.d.a = entityliving; ++ if (entityliving != null) { ++ a((EnchantmentModifier) EnchantmentManager.d, entityliving.getEquipment()); ++ } ++ ++ if (entity instanceof EntityHuman) { ++ a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); ++ } ++ ++ } ++ ++ public static void b(EntityLiving entityliving, Entity entity) { ++ EnchantmentManager.e.a = entityliving; ++ EnchantmentManager.e.b = entity; ++ if (entityliving != null) { ++ a((EnchantmentModifier) EnchantmentManager.e, entityliving.getEquipment()); ++ } ++ ++ if (entityliving instanceof EntityHuman) { ++ a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); ++ } ++ ++ } ++ ++ public static int a(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.bz()); ++ } ++ ++ public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.bz()); ++ } ++ ++ public static int getOxygenEnchantmentLevel(Entity entity) { ++ return a(Enchantment.OXYGEN.id, entity.getEquipment()); ++ } ++ ++ public static int b(Entity entity) { ++ return a(Enchantment.DEPTH_STRIDER.id, entity.getEquipment()); ++ } ++ ++ public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.bz()); ++ } ++ ++ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.bz()) > 0; ++ } ++ ++ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.bz()); ++ } ++ ++ public static int g(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.bz()); ++ } ++ ++ public static int h(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.bz()); ++ } ++ ++ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.bz()); ++ } ++ ++ public static boolean j(EntityLiving entityliving) { ++ return a(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0; ++ } ++ ++ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) { ++ ItemStack[] aitemstack = entityliving.getEquipment(); ++ int i = aitemstack.length; ++ ++ for (int j = 0; j < i; ++j) { ++ ItemStack itemstack = aitemstack[j]; ++ ++ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) { ++ return itemstack; ++ } ++ } ++ ++ return null; ++ } ++ ++ public static int a(Random random, int i, int j, ItemStack itemstack) { ++ Item item = itemstack.getItem(); ++ int k = item.b(); ++ ++ if (k <= 0) { ++ return 0; ++ } else { ++ if (j > 15) { ++ j = 15; ++ } ++ ++ int l = random.nextInt(8) + 1 + (j >> 1) + random.nextInt(j + 1); ++ ++ return i == 0 ? Math.max(l / 3, 1) : (i == 1 ? l * 2 / 3 + 1 : Math.max(l, j * 2)); ++ } ++ } ++ ++ public static ItemStack a(Random random, ItemStack itemstack, int i) { ++ List list = b(random, itemstack, i); ++ boolean flag = itemstack.getItem() == Items.BOOK; ++ ++ if (flag) { ++ itemstack.setItem(Items.ENCHANTED_BOOK); ++ } ++ ++ if (list != null) { ++ Iterator iterator = list.iterator(); ++ ++ while (iterator.hasNext()) { ++ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) iterator.next(); ++ ++ if (flag) { ++ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); ++ } else { ++ itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); ++ } ++ } ++ } ++ ++ return itemstack; ++ } ++ ++ public static List b(Random random, ItemStack itemstack, int i) { ++ Item item = itemstack.getItem(); ++ int j = item.b(); ++ ++ if (j <= 0) { ++ return null; ++ } else { ++ j /= 2; ++ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1); ++ int k = j + i; ++ float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; ++ int l = (int) ((float) k * (1.0F + f) + 0.5F); ++ ++ if (l < 1) { ++ l = 1; ++ } ++ ++ ArrayList arraylist = null; ++ Map map = b(l, itemstack); ++ ++ if (map != null && !map.isEmpty()) { ++ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); ++ ++ if (weightedrandomenchant != null) { ++ arraylist = Lists.newArrayList(); ++ arraylist.add(weightedrandomenchant); ++ ++ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) { ++ Iterator iterator = map.keySet().iterator(); ++ ++ while (iterator.hasNext()) { ++ Integer integer = (Integer) iterator.next(); ++ boolean flag = true; ++ Iterator iterator1 = arraylist.iterator(); ++ ++ while (true) { ++ if (iterator1.hasNext()) { ++ WeightedRandomEnchant weightedrandomenchant1 = (WeightedRandomEnchant) iterator1.next(); ++ ++ if (weightedrandomenchant1.enchantment.a(Enchantment.getById(integer.intValue()))) { ++ continue; ++ } ++ ++ flag = false; ++ } ++ ++ if (!flag) { ++ iterator.remove(); ++ } ++ break; ++ } ++ } ++ ++ if (!map.isEmpty()) { ++ WeightedRandomEnchant weightedrandomenchant2 = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); ++ ++ arraylist.add(weightedrandomenchant2); ++ } ++ } ++ } ++ } ++ ++ return arraylist; ++ } ++ } ++ ++ public static Map b(int i, ItemStack itemstack) { ++ Item item = itemstack.getItem(); ++ HashMap hashmap = null; ++ boolean flag = itemstack.getItem() == Items.BOOK; ++ Enchantment[] aenchantment = Enchantment.b; ++ int j = aenchantment.length; ++ ++ for (int k = 0; k < j; ++k) { ++ Enchantment enchantment = aenchantment[k]; ++ ++ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) { ++ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { ++ if (i >= enchantment.a(l) && i <= enchantment.b(l)) { ++ if (hashmap == null) { ++ hashmap = Maps.newHashMap(); ++ } ++ ++ hashmap.put(Integer.valueOf(enchantment.id), new WeightedRandomEnchant(enchantment, l)); ++ } ++ } ++ } ++ } ++ ++ return hashmap; ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierArthropods implements EnchantmentModifier { ++ ++ public EntityLiving a; ++ public Entity b; ++ ++ private EnchantmentModifierArthropods() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ enchantment.a(this.a, this.b, i); ++ } ++ ++ EnchantmentModifierArthropods(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierDamage implements EnchantmentModifier { ++ ++ public float a; ++ public EnumMonsterType b; ++ ++ private EnchantmentModifierDamage() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); ++ } ++ ++ EnchantmentModifierDamage(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierProtection implements EnchantmentModifier { ++ ++ public int a; ++ public DamageSource b; ++ ++ private EnchantmentModifierProtection() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); ++ } ++ ++ EnchantmentModifierProtection(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierThorns implements EnchantmentModifier { ++ ++ public EntityLiving a; ++ public Entity b; ++ ++ private EnchantmentModifierThorns() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ enchantment.b(this.a, this.b, i); ++ } ++ ++ EnchantmentModifierThorns(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityFireworks.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++public class EntityFireworks extends Entity { ++ ++ private int ticksFlown; ++ public int expectedLifespan; ++ ++ public EntityFireworks(World world) { ++ super(world); ++ this.a(0.25F, 0.25F); ++ } ++ ++ protected void h() { ++ this.datawatcher.add(8, 5); ++ } ++ ++ public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) { ++ super(world); ++ this.ticksFlown = 0; ++ this.a(0.25F, 0.25F); ++ this.setPosition(d0, d1, d2); ++ int i = 1; ++ ++ if (itemstack != null && itemstack.hasTag()) { ++ this.datawatcher.watch(8, itemstack); ++ NBTTagCompound nbttagcompound = itemstack.getTag(); ++ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Fireworks"); ++ ++ if (nbttagcompound1 != null) { ++ i += nbttagcompound1.getByte("Flight"); ++ } ++ } ++ ++ this.motX = this.random.nextGaussian() * 0.001D; ++ this.motZ = this.random.nextGaussian() * 0.001D; ++ this.motY = 0.05D; ++ this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7); ++ } ++ ++ public void s_() { ++ this.P = this.locX; ++ this.Q = this.locY; ++ this.R = this.locZ; ++ super.s_(); ++ this.motX *= 1.15D; ++ this.motZ *= 1.15D; ++ this.motY += 0.04D; ++ this.move(this.motX, this.motY, this.motZ); ++ float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); ++ ++ this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); ++ ++ for (this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { ++ ; ++ } ++ ++ while (this.pitch - this.lastPitch >= 180.0F) { ++ this.lastPitch += 360.0F; ++ } ++ ++ while (this.yaw - this.lastYaw < -180.0F) { ++ this.lastYaw -= 360.0F; ++ } ++ ++ while (this.yaw - this.lastYaw >= 180.0F) { ++ this.lastYaw += 360.0F; ++ } ++ ++ this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; ++ this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; ++ if (this.ticksFlown == 0 && !this.R()) { ++ this.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F); ++ } ++ ++ ++this.ticksFlown; ++ if (this.world.isStatic && this.ticksFlown % 2 < 2) { ++ this.world.addParticle(EnumParticle.FIREWORKS_SPARK, this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D, new int[0]); ++ } ++ ++ if (!this.world.isStatic && this.ticksFlown > this.expectedLifespan) { ++ this.world.broadcastEntityEffect(this, (byte) 17); ++ this.die(); ++ } ++ ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) { ++ nbttagcompound.setInt("Life", this.ticksFlown); ++ nbttagcompound.setInt("LifeTime", this.expectedLifespan); ++ ItemStack itemstack = this.datawatcher.getItemStack(8); ++ ++ if (itemstack != null) { ++ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); ++ ++ itemstack.save(nbttagcompound1); ++ nbttagcompound.set("FireworksItem", nbttagcompound1); ++ } ++ ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ this.ticksFlown = nbttagcompound.getInt("Life"); ++ this.expectedLifespan = nbttagcompound.getInt("LifeTime"); ++ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem"); ++ ++ if (nbttagcompound1 != null) { ++ ItemStack itemstack = ItemStack.createStack(nbttagcompound1); ++ ++ if (itemstack != null) { ++ this.datawatcher.watch(8, itemstack); ++ } ++ } ++ ++ } ++ ++ public float c(float f) { ++ return super.c(f); ++ } ++ ++ public boolean aE() { ++ return false; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityTracker.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import com.google.common.collect.Sets; ++import java.util.ArrayList; ++import java.util.Iterator; ++import java.util.Set; ++import java.util.concurrent.Callable; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class EntityTracker { ++ ++ private static final Logger a = LogManager.getLogger(); ++ private final WorldServer world; ++ private Set c = Sets.newHashSet(); ++ public IntHashMap trackedEntities = new IntHashMap(); ++ private int e; ++ ++ public EntityTracker(WorldServer worldserver) { ++ this.world = worldserver; ++ this.e = worldserver.getMinecraftServer().getPlayerList().d(); ++ } ++ ++ public void track(Entity entity) { ++ if (entity instanceof EntityPlayer) { ++ this.addEntity(entity, 512, 2); ++ EntityPlayer entityplayer = (EntityPlayer) entity; ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker != entityplayer) { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ } else if (entity instanceof EntityFishingHook) { ++ this.addEntity(entity, 64, 5, true); ++ } else if (entity instanceof EntityArrow) { ++ this.addEntity(entity, 64, 20, false); ++ } else if (entity instanceof EntitySmallFireball) { ++ this.addEntity(entity, 64, 10, false); ++ } else if (entity instanceof EntityFireball) { ++ this.addEntity(entity, 64, 10, false); ++ } else if (entity instanceof EntitySnowball) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityEnderPearl) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityEnderSignal) { ++ this.addEntity(entity, 64, 4, true); ++ } else if (entity instanceof EntityEgg) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityPotion) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityThrownExpBottle) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityFireworks) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityItem) { ++ this.addEntity(entity, 64, 20, true); ++ } else if (entity instanceof EntityMinecartAbstract) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntityBoat) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntitySquid) { ++ this.addEntity(entity, 64, 3, true); ++ } else if (entity instanceof EntityWither) { ++ this.addEntity(entity, 80, 3, false); ++ } else if (entity instanceof EntityBat) { ++ this.addEntity(entity, 80, 3, false); ++ } else if (entity instanceof EntityEnderDragon) { ++ this.addEntity(entity, 160, 3, true); ++ } else if (entity instanceof IAnimal) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntityTNTPrimed) { ++ this.addEntity(entity, 160, 10, true); ++ } else if (entity instanceof EntityFallingBlock) { ++ this.addEntity(entity, 160, 20, true); ++ } else if (entity instanceof EntityHanging) { ++ this.addEntity(entity, 160, Integer.MAX_VALUE, false); ++ } else if (entity instanceof EntityArmorStand) { ++ this.addEntity(entity, 160, 3, true); ++ } else if (entity instanceof EntityExperienceOrb) { ++ this.addEntity(entity, 160, 20, true); ++ } else if (entity instanceof EntityEnderCrystal) { ++ this.addEntity(entity, 256, Integer.MAX_VALUE, false); ++ } ++ ++ } ++ ++ public void addEntity(Entity entity, int i, int j) { ++ this.addEntity(entity, i, j, false); ++ } ++ ++ public void addEntity(Entity entity, int i, int j, boolean flag) { ++ if (i > this.e) { ++ i = this.e; ++ } ++ ++ try { ++ if (this.trackedEntities.b(entity.getId())) { ++ throw new IllegalStateException("Entity is already tracked!"); ++ } ++ ++ EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag); ++ ++ this.c.add(entitytrackerentry); ++ this.trackedEntities.a(entity.getId(), entitytrackerentry); ++ entitytrackerentry.scanPlayers(this.world.players); ++ } catch (Throwable throwable) { ++ CrashReport crashreport = CrashReport.a(throwable, "Adding entity to track"); ++ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track"); ++ ++ crashreportsystemdetails.a("Tracking range", (Object) (i + " blocks")); ++ crashreportsystemdetails.a("Update interval", (Callable) (new CrashReportEntityTrackerUpdateInterval(this, j))); ++ entity.appendEntityCrashDetails(crashreportsystemdetails); ++ CrashReportSystemDetails crashreportsystemdetails1 = crashreport.a("Entity That Is Already Tracked"); ++ ++ ((EntityTrackerEntry) this.trackedEntities.get(entity.getId())).tracker.appendEntityCrashDetails(crashreportsystemdetails1); ++ ++ try { ++ throw new ReportedException(crashreport); ++ } catch (ReportedException reportedexception) { ++ EntityTracker.a.error("\"Silently\" catching entity tracking error.", reportedexception); ++ } ++ } ++ ++ } ++ ++ public void untrackEntity(Entity entity) { ++ if (entity instanceof EntityPlayer) { ++ EntityPlayer entityplayer = (EntityPlayer) entity; ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.a(entityplayer); ++ } ++ } ++ ++ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.getId()); ++ ++ if (entitytrackerentry1 != null) { ++ this.c.remove(entitytrackerentry1); ++ entitytrackerentry1.a(); ++ } ++ ++ } ++ ++ public void updatePlayers() { ++ ArrayList arraylist = Lists.newArrayList(); ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.track(this.world.players); ++ if (entitytrackerentry.n && entitytrackerentry.tracker instanceof EntityPlayer) { ++ arraylist.add((EntityPlayer) entitytrackerentry.tracker); ++ } ++ } ++ ++ for (int i = 0; i < arraylist.size(); ++i) { ++ EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i); ++ Iterator iterator1 = this.c.iterator(); ++ ++ while (iterator1.hasNext()) { ++ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next(); ++ ++ if (entitytrackerentry1.tracker != entityplayer) { ++ entitytrackerentry1.updatePlayer(entityplayer); ++ } ++ } ++ } ++ ++ } ++ ++ public void a(EntityPlayer entityplayer) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker == entityplayer) { ++ entitytrackerentry.scanPlayers(this.world.players); ++ } else { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ ++ } ++ ++ public void a(Entity entity, Packet packet) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); ++ ++ if (entitytrackerentry != null) { ++ entitytrackerentry.broadcast(packet); ++ } ++ ++ } ++ ++ public void sendPacketToEntity(Entity entity, Packet packet) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); ++ ++ if (entitytrackerentry != null) { ++ entitytrackerentry.broadcastIncludingSelf(packet); ++ } ++ ++ } ++ ++ public void untrackPlayer(EntityPlayer entityplayer) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.clear(entityplayer); ++ } ++ ++ } ++ ++ public void a(EntityPlayer entityplayer, Chunk chunk) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ae == chunk.locX && entitytrackerentry.tracker.ag == chunk.locZ) { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ ++ } ++ ++} diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -1331,12 +2557,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.gson.JsonObject; ++import com.mojang.authlib.GameProfile; +import java.util.Date; +import java.util.UUID; + -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +public class GameProfileBanEntry extends ExpirableListEntry { + + public GameProfileBanEntry(GameProfile gameprofile) { @@ -1388,18 +2613,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Collection; +import java.util.Iterator; +import java.util.UUID; -+ +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GenericAttributes { + + private static final Logger f = LogManager.getLogger(); -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); -+ public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); -+ public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -+ public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); -+ public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); ++ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); ++ public static final IAttribute b = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); ++ public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); ++ public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); ++ public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); + + public static NBTTagList a(AttributeMapBase attributemapbase) { + NBTTagList nbttaglist = new NBTTagList(); @@ -1459,9 +2683,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (attributeinstance != null) { + a(attributeinstance, nbttagcompound); + } else { -+ f.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); ++ GenericAttributes.f.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); + } + } ++ + } + + private static void a(AttributeInstance attributeinstance, NBTTagCompound nbttagcompound) { @@ -1471,22 +2696,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + for (int i = 0; i < nbttaglist.size(); ++i) { + AttributeModifier attributemodifier = a(nbttaglist.get(i)); -+ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a()); + -+ if (attributemodifier1 != null) { -+ attributeinstance.b(attributemodifier1); ++ if (attributemodifier != null) { ++ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a()); ++ ++ if (attributemodifier1 != null) { ++ attributeinstance.c(attributemodifier1); ++ } ++ ++ attributeinstance.b(attributemodifier); + } -+ -+ attributeinstance.a(attributemodifier); + } + } ++ + } + + public static AttributeModifier a(NBTTagCompound nbttagcompound) { + UUID uuid = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast")); + -+ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); ++ try { ++ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); ++ } catch (Exception exception) { ++ GenericAttributes.f.warn("Unable to create attribute: " + exception.getMessage()); ++ return null; ++ } + } ++ +} diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java new file mode 100644 @@ -1496,65 +2731,128 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.util.ArrayList; ++import com.google.common.collect.Lists; +import java.util.List; + +public class IntCache { + + private static int a = 256; -+ private static List b = new ArrayList(); -+ private static List c = new ArrayList(); -+ private static List d = new ArrayList(); -+ private static List e = new ArrayList(); ++ private static List b = Lists.newArrayList(); ++ private static List c = Lists.newArrayList(); ++ private static List d = Lists.newArrayList(); ++ private static List e = Lists.newArrayList(); + + public static synchronized int[] a(int i) { + int[] aint; + + if (i <= 256) { -+ if (b.isEmpty()) { ++ if (IntCache.b.isEmpty()) { + aint = new int[256]; -+ c.add(aint); ++ IntCache.c.add(aint); + return aint; + } else { -+ aint = (int[]) b.remove(b.size() - 1); -+ c.add(aint); ++ aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); ++ IntCache.c.add(aint); + return aint; + } -+ } else if (i > a) { -+ a = i; -+ d.clear(); -+ e.clear(); -+ aint = new int[a]; -+ e.add(aint); ++ } else if (i > IntCache.a) { ++ IntCache.a = i; ++ IntCache.d.clear(); ++ IntCache.e.clear(); ++ aint = new int[IntCache.a]; ++ IntCache.e.add(aint); + return aint; -+ } else if (d.isEmpty()) { -+ aint = new int[a]; -+ e.add(aint); ++ } else if (IntCache.d.isEmpty()) { ++ aint = new int[IntCache.a]; ++ IntCache.e.add(aint); + return aint; + } else { -+ aint = (int[]) d.remove(d.size() - 1); -+ e.add(aint); ++ aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); ++ IntCache.e.add(aint); + return aint; + } + } + + public static synchronized void a() { -+ if (!d.isEmpty()) { -+ d.remove(d.size() - 1); ++ if (!IntCache.d.isEmpty()) { ++ IntCache.d.remove(IntCache.d.size() - 1); + } + -+ if (!b.isEmpty()) { -+ b.remove(b.size() - 1); ++ if (!IntCache.b.isEmpty()) { ++ IntCache.b.remove(IntCache.b.size() - 1); + } + -+ d.addAll(e); -+ b.addAll(c); -+ e.clear(); -+ c.clear(); ++ IntCache.d.addAll(IntCache.e); ++ IntCache.b.addAll(IntCache.c); ++ IntCache.e.clear(); ++ IntCache.c.clear(); + } + + public static synchronized String b() { -+ return "cache: " + d.size() + ", tcache: " + b.size() + ", allocated: " + e.size() + ", tallocated: " + c.size(); ++ return "cache: " + IntCache.d.size() + ", tcache: " + IntCache.b.size() + ", allocated: " + IntCache.e.size() + ", tallocated: " + IntCache.c.size(); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/ItemDoor.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++public class ItemDoor extends Item { ++ ++ private Block a; ++ ++ public ItemDoor(Block block) { ++ this.a = block; ++ this.a(CreativeModeTab.d); ++ } ++ ++ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (enumdirection != EnumDirection.UP) { ++ return false; ++ } else { ++ IBlockData iblockdata = world.getType(blockposition); ++ Block block = iblockdata.getBlock(); ++ ++ if (!block.f(world, blockposition)) { ++ blockposition = blockposition.shift(enumdirection); ++ } ++ ++ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { ++ return false; ++ } else if (!this.a.canPlace(world, blockposition)) { ++ return false; ++ } else { ++ a(world, blockposition, EnumDirection.fromAngle((double) entityhuman.yaw), this.a); ++ --itemstack.count; ++ return true; ++ } ++ } ++ } ++ ++ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block) { ++ BlockPosition blockposition1 = blockposition.shift(enumdirection.e()); ++ BlockPosition blockposition2 = blockposition.shift(enumdirection.f()); ++ int i = (world.getType(blockposition2).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition2.up()).getBlock().isOccluding() ? 1 : 0); ++ int j = (world.getType(blockposition1).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition1.up()).getBlock().isOccluding() ? 1 : 0); ++ boolean flag = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block; ++ boolean flag1 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block; ++ boolean flag2 = false; ++ ++ if (flag && !flag1 || j > i) { ++ flag2 = true; ++ } ++ ++ BlockPosition blockposition3 = blockposition.up(); ++ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); ++ ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); ++ world.applyPhysics(blockposition, block); ++ world.applyPhysics(blockposition3, block); + } +} diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java @@ -1565,14 +2863,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.mojang.authlib.GameProfile; +import java.util.UUID; + -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +public class ItemSkull extends Item { + -+ private static final String[] b = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; -+ public static final String[] a = new String[] { "skeleton", "wither", "zombie", "steve", "creeper"}; ++ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; + + public ItemSkull() { + this.a(CreativeModeTab.c); @@ -1580,69 +2876,67 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(true); + } + -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) { -+ if (l == 0) { -+ return false; -+ } else if (!world.getType(i, j, k).getMaterial().isBuildable()) { ++ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (enumdirection == EnumDirection.DOWN) { + return false; + } else { -+ if (l == 1) { -+ ++j; -+ } ++ IBlockData iblockdata = world.getType(blockposition); ++ Block block = iblockdata.getBlock(); ++ boolean flag = block.f(world, blockposition); + -+ if (l == 2) { -+ --k; -+ } -+ -+ if (l == 3) { -+ ++k; -+ } -+ -+ if (l == 4) { -+ --i; -+ } -+ -+ if (l == 5) { -+ ++i; -+ } -+ -+ if (!world.isStatic) { -+ world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2); -+ int i1 = 0; -+ -+ if (l == 1) { -+ i1 = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; ++ if (!flag) { ++ if (!world.getType(blockposition).getBlock().getMaterial().isBuildable()) { ++ return false; + } + -+ TileEntity tileentity = world.getTileEntity(i, j, k); ++ blockposition = blockposition.shift(enumdirection); ++ } + -+ if (tileentity != null && tileentity instanceof TileEntitySkull) { -+ if (itemstack.getData() == 3) { -+ GameProfile gameprofile = null; ++ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { ++ return false; ++ } else if (!Blocks.SKULL.canPlace(world, blockposition)) { ++ return false; ++ } else { ++ if (!world.isStatic) { ++ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); ++ int i = 0; + -+ if (itemstack.hasTag()) { -+ NBTTagCompound nbttagcompound = itemstack.getTag(); -+ -+ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { -+ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); -+ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { -+ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); -+ } -+ } -+ -+ ((TileEntitySkull) tileentity).setGameProfile(gameprofile); -+ } else { -+ ((TileEntitySkull) tileentity).setSkullType(itemstack.getData()); ++ if (enumdirection == EnumDirection.UP) { ++ i = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; + } + -+ ((TileEntitySkull) tileentity).setRotation(i1); -+ ((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity); ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntitySkull) { ++ TileEntitySkull tileentityskull = (TileEntitySkull) tileentity; ++ ++ if (itemstack.getData() == 3) { ++ GameProfile gameprofile = null; ++ ++ if (itemstack.hasTag()) { ++ NBTTagCompound nbttagcompound = itemstack.getTag(); ++ ++ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { ++ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); ++ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); ++ } ++ } ++ ++ tileentityskull.setGameProfile(gameprofile); ++ } else { ++ tileentityskull.setSkullType(itemstack.getData()); ++ } ++ ++ tileentityskull.setRotation(i); ++ Blocks.SKULL.a(world, blockposition, tileentityskull); ++ } ++ ++ --itemstack.count; + } + -+ --itemstack.count; ++ return true; + } -+ -+ return true; + } + } + @@ -1650,29 +2944,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i; + } + -+ public String a(ItemStack itemstack) { ++ public String e_(ItemStack itemstack) { + int i = itemstack.getData(); + -+ if (i < 0 || i >= b.length) { ++ if (i < 0 || i >= ItemSkull.a.length) { + i = 0; + } + -+ return super.getName() + "." + b[i]; ++ return super.getName() + "." + ItemSkull.a[i]; + } + -+ public String n(ItemStack itemstack) { ++ public String a(ItemStack itemstack) { + if (itemstack.getData() == 3 && itemstack.hasTag()) { -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { -+ return LocaleI18n.get("item.skull.player.name", new Object[] { GameProfileSerializer.deserialize(itemstack.getTag().getCompound("SkullOwner")).getName()}); ++ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { ++ return LocaleI18n.a("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); + } + -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { -+ return LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); ++ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { ++ NBTTagCompound nbttagcompound = itemstack.getTag().getCompound("SkullOwner"); ++ ++ if (nbttagcompound.hasKeyOfType("Name", 8)) { ++ return LocaleI18n.a("item.skull.player.name", new Object[] { nbttagcompound.getString("Name")}); ++ } + } + } + -+ return super.n(itemstack); ++ return super.a(itemstack); + } ++ ++ public boolean a(NBTTagCompound nbttagcompound) { ++ super.a(nbttagcompound); ++ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); ++ ++ gameprofile = TileEntitySkull.b(gameprofile); ++ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ return true; ++ } else { ++ return false; ++ } ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java new file mode 100644 @@ -1684,15 +2996,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; + +public abstract class NBTBase { + + public static final String[] a = new String[] { "END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; + -+ abstract void write(DataOutput dataoutput) throws IOException; ++ abstract void write(DataOutput dataoutput) throws java.io.IOException; + -+ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException; ++ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException; + + public abstract String toString(); + @@ -1745,6 +3056,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public abstract NBTBase clone(); + ++ public boolean isEmpty() { ++ return false; ++ } ++ + public boolean equals(Object object) { + if (!(object instanceof NBTBase)) { + return false; @@ -1762,6 +3077,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected String a_() { + return this.toString(); + } ++ +} diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java new file mode 100644 @@ -1773,8 +3089,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; -+import java.io.ByteArrayInputStream; -+import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; @@ -1812,38 +3126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } finally { + dataoutputstream.close(); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } -+ } -+ -+ public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) { -+ try { -+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte)))); -+ -+ NBTTagCompound nbttagcompound; -+ -+ try { -+ nbttagcompound = a((DataInput) datainputstream, nbtreadlimiter); -+ } finally { -+ datainputstream.close(); -+ } -+ -+ return nbttagcompound; -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; -+ } -+ -+ public static byte[] a(NBTTagCompound nbttagcompound) { -+ try { -+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); -+ DataOutputStream dataoutputstream = new DataOutputStream(new GZIPOutputStream(bytearrayoutputstream)); -+ -+ try { -+ a(nbttagcompound, (DataOutput) dataoutputstream); -+ } finally { -+ dataoutputstream.close(); -+ } -+ -+ return bytearrayoutputstream.toByteArray(); -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; ++ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } + } + + public static NBTTagCompound a(DataInputStream datainputstream) { @@ -1873,7 +3156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + dataoutput.writeUTF(""); + nbtbase.write(dataoutput); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } ++ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } + } + + private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) { @@ -1893,8 +3176,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CrashReport crashreport = CrashReport.a(ioexception, "Loading NBT data"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("NBT Tag"); + -+ crashreportsystemdetails.a("Tag name", "[UNNAMED TAG]"); -+ crashreportsystemdetails.a("Tag type", Byte.valueOf(b0)); ++ crashreportsystemdetails.a("Tag name", (Object) "[UNNAMED TAG]"); ++ crashreportsystemdetails.a("Tag type", (Object) Byte.valueOf(b0)); + throw new ReportedException(crashreport); + } + } @@ -1911,7 +3194,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; +import java.util.Arrays; + +public class NBTTagByteArray extends NBTBase { @@ -1924,12 +3206,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.data = abyte; + } + -+ void write(DataOutput dataoutput) throws IOException { ++ void write(DataOutput dataoutput) throws java.io.IOException { + dataoutput.writeInt(this.data.length); + dataoutput.write(this.data); + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (8 * j)); @@ -1974,7 +3256,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; +import java.util.Arrays; + +public class NBTTagIntArray extends NBTBase { @@ -1987,15 +3268,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.data = aint; + } + -+ void write(DataOutput dataoutput) throws IOException { ++ void write(DataOutput dataoutput) throws java.io.IOException { + dataoutput.writeInt(this.data.length); + + for (int i = 0; i < this.data.length; ++i) { + dataoutput.writeInt(this.data[i]); + } ++ + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (32 * j)); @@ -2004,6 +3286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (int k = 0; k < j; ++k) { + this.data[k] = datainput.readInt(); + } ++ + } + + public byte getTypeId() { @@ -2053,21 +3336,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class NextTickListEntry implements Comparable { + -+ private static long f; -+ private final Block g; -+ public int a; -+ public int b; ++ private static long d; ++ private final Block e; ++ public final BlockPosition a; ++ public long b; + public int c; -+ public long d; -+ public int e; -+ private long h; ++ private long f; + -+ public NextTickListEntry(int i, int j, int k, Block block) { -+ this.h = (long) (f++); -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.g = block; ++ public NextTickListEntry(BlockPosition blockposition, Block block) { ++ this.f = (long) (NextTickListEntry.d++); ++ this.a = blockposition; ++ this.e = block; + } + + public boolean equals(Object object) { @@ -2076,37 +3355,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + NextTickListEntry nextticklistentry = (NextTickListEntry) object; + -+ return this.a == nextticklistentry.a && this.b == nextticklistentry.b && this.c == nextticklistentry.c && Block.a(this.g, nextticklistentry.g); ++ return this.a.equals(nextticklistentry.a) && Block.a(this.e, nextticklistentry.e); + } + } + + public int hashCode() { -+ return (this.a * 1024 * 1024 + this.c * 1024 + this.b) * 256; ++ return this.a.hashCode(); + } + + public NextTickListEntry a(long i) { -+ this.d = i; ++ this.b = i; + return this; + } + + public void a(int i) { -+ this.e = i; ++ this.c = i; + } + -+ public int compareTo(NextTickListEntry nextticklistentry) { -+ return this.d < nextticklistentry.d ? -1 : (this.d > nextticklistentry.d ? 1 : (this.e != nextticklistentry.e ? this.e - nextticklistentry.e : (this.h < nextticklistentry.h ? -1 : (this.h > nextticklistentry.h ? 1 : 0)))); ++ public int a(NextTickListEntry nextticklistentry) { ++ return this.b < nextticklistentry.b ? -1 : (this.b > nextticklistentry.b ? 1 : (this.c != nextticklistentry.c ? this.c - nextticklistentry.c : (this.f < nextticklistentry.f ? -1 : (this.f > nextticklistentry.f ? 1 : 0)))); + } + + public String toString() { -+ return Block.getId(this.g) + ": (" + this.a + ", " + this.b + ", " + this.c + "), " + this.d + ", " + this.e + ", " + this.h; ++ return Block.getId(this.e) + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; + } + + public Block a() { -+ return this.g; ++ return this.e; + } + + public int compareTo(Object object) { -+ return this.compareTo((NextTickListEntry) object); ++ return this.a((NextTickListEntry) object); + } +} diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java @@ -2119,40 +3398,58 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class NibbleArray { + -+ public final byte[] a; -+ private final int b; -+ private final int c; ++ private final byte[] a; + -+ public NibbleArray(int i, int j) { -+ this.a = new byte[i >> 1]; -+ this.b = j; -+ this.c = j + 4; ++ public NibbleArray() { ++ this.a = new byte[2048]; + } + -+ public NibbleArray(byte[] abyte, int i) { ++ public NibbleArray(byte[] abyte) { + this.a = abyte; -+ this.b = i; -+ this.c = i + 4; ++ if (abyte.length != 2048) { ++ throw new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + abyte.length); ++ } + } + + public int a(int i, int j, int k) { -+ int l = j << this.c | k << this.b | i; -+ int i1 = l >> 1; -+ int j1 = l & 1; -+ -+ return j1 == 0 ? this.a[i1] & 15 : this.a[i1] >> 4 & 15; ++ return this.a(this.b(i, j, k)); + } + + public void a(int i, int j, int k, int l) { -+ int i1 = j << this.c | k << this.b | i; -+ int j1 = i1 >> 1; -+ int k1 = i1 & 1; ++ this.a(this.b(i, j, k), l); ++ } + -+ if (k1 == 0) { -+ this.a[j1] = (byte) (this.a[j1] & 240 | l & 15); ++ private int b(int i, int j, int k) { ++ return j << 8 | k << 4 | i; ++ } ++ ++ public int a(int i) { ++ int j = this.c(i); ++ ++ return this.b(i) ? this.a[j] & 15 : this.a[j] >> 4 & 15; ++ } ++ ++ public void a(int i, int j) { ++ int k = this.c(i); ++ ++ if (this.b(i)) { ++ this.a[k] = (byte) (this.a[k] & 240 | j & 15); + } else { -+ this.a[j1] = (byte) (this.a[j1] & 15 | (l & 15) << 4); ++ this.a[k] = (byte) (this.a[k] & 15 | (j & 15) << 4); + } ++ ++ } ++ ++ private boolean b(int i) { ++ return (i & 1) == 0; ++ } ++ ++ private int c(int i) { ++ return i >> 1; ++ } ++ ++ public byte[] a() { ++ return this.a; + } +} diff --git a/src/main/java/net/minecraft/server/OldChunkLoader.java b/src/main/java/net/minecraft/server/OldChunkLoader.java @@ -2235,9 +3532,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (!flag) { + byte[] abyte = new byte[4096]; -+ NibbleArray nibblearray = new NibbleArray(abyte.length, 4); -+ NibbleArray nibblearray1 = new NibbleArray(abyte.length, 4); -+ NibbleArray nibblearray2 = new NibbleArray(abyte.length, 4); ++ NibbleArray nibblearray = new NibbleArray(); ++ NibbleArray nibblearray1 = new NibbleArray(); ++ NibbleArray nibblearray2 = new NibbleArray(); + + for (int k1 = 0; k1 < 16; ++k1) { + for (int l1 = 0; l1 < 16; ++l1) { @@ -2257,9 +3554,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + nbttagcompound1.setByte("Y", (byte) (k & 255)); + nbttagcompound1.setByteArray("Blocks", abyte); -+ nbttagcompound1.setByteArray("Data", nibblearray.a); -+ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a); -+ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a); ++ nbttagcompound1.setByteArray("Data", nibblearray.a()); ++ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a()); ++ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a()); + nbttaglist.add(nbttagcompound1); + } + } @@ -2269,7 +3566,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + for (int k2 = 0; k2 < 16; ++k2) { + for (j = 0; j < 16; ++j) { -+ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(oldchunk.k << 4 | k2, oldchunk.l << 4 | j).id & 255); ++ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(new BlockPosition(oldchunk.k << 4 | k2, 0, oldchunk.l << 4 | j), BiomeBase.ad).id & 255); + } + } + @@ -2279,6 +3576,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (oldchunk.j != null) { + nbttagcompound.set("TileTicks", oldchunk.j); + } ++ ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++public class PacketHandshakingInSetProtocol implements Packet { ++ ++ private int a; ++ public String b; ++ public int c; ++ private EnumProtocol d; ++ ++ public PacketHandshakingInSetProtocol() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.c(255); ++ this.c = packetdataserializer.readUnsignedShort(); ++ this.d = EnumProtocol.a(packetdataserializer.e()); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.b(this.d.a()); ++ } ++ ++ public void a(PacketHandshakingInListener packethandshakinginlistener) { ++ packethandshakinginlistener.a(this); ++ } ++ ++ public EnumProtocol a() { ++ return this.d; ++ } ++ ++ public int b() { ++ return this.a; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketHandshakingInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInChat implements Packet { ++ ++ private String a; ++ ++ public PacketPlayInChat() {} ++ ++ public PacketPlayInChat(String s) { ++ if (s.length() > 100) { ++ s = s.substring(0, 100); ++ } ++ ++ this.a = s; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.c(100); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.a(this.a); ++ } ++ ++ public void a(PacketListenerPlayIn packetlistenerplayin) { ++ packetlistenerplayin.a(this); ++ } ++ ++ public String a() { ++ return this.a; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayIn) packetlistener); + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -2289,191 +3676,204 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.io.IOException; -+import java.util.zip.DataFormatException; -+import java.util.zip.Deflater; -+import java.util.zip.Inflater; ++import com.google.common.collect.Lists; ++import java.util.ArrayList; ++import java.util.Iterator; + -+public class PacketPlayOutMapChunk extends Packet { ++public class PacketPlayOutMapChunk implements Packet { + + private int a; + private int b; -+ private int c; -+ private int d; -+ private byte[] e; -+ private byte[] f; -+ private boolean g; -+ private int h; -+ private static byte[] i = new byte[196864]; ++ private ChunkMap c; ++ private boolean d; + + public PacketPlayOutMapChunk() {} + + public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { + this.a = chunk.locX; + this.b = chunk.locZ; -+ this.g = flag; -+ ChunkMap chunkmap = a(chunk, flag, i); -+ Deflater deflater = new Deflater(-1); -+ -+ this.d = chunkmap.c; -+ this.c = chunkmap.b; -+ -+ 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.d = flag; ++ this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); + } + -+ public static int c() { -+ return 196864; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.readInt(); + this.b = packetdataserializer.readInt(); -+ this.g = packetdataserializer.readBoolean(); -+ this.c = packetdataserializer.readShort(); -+ this.d = packetdataserializer.readShort(); -+ this.h = packetdataserializer.readInt(); -+ if (i.length < this.h) { -+ i = new byte[this.h]; -+ } -+ -+ packetdataserializer.readBytes(i, 0, this.h); -+ int i = 0; -+ -+ int j; -+ -+ for (j = 0; j < 16; ++j) { -+ i += this.c >> j & 1; -+ } -+ -+ j = 12288 * i; -+ if (this.g) { -+ j += 256; -+ } -+ -+ this.f = new byte[j]; -+ Inflater inflater = new Inflater(); -+ -+ inflater.setInput(PacketPlayOutMapChunk.i, 0, this.h); -+ -+ try { -+ inflater.inflate(this.f); -+ } catch (DataFormatException dataformatexception) { -+ throw new IOException("Bad compressed data format"); -+ } finally { -+ inflater.end(); -+ } ++ this.d = packetdataserializer.readBoolean(); ++ this.c = new ChunkMap(); ++ this.c.b = packetdataserializer.readShort(); ++ this.c.a = packetdataserializer.a(); + } + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeInt(this.a); + 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); ++ packetdataserializer.writeBoolean(this.d); ++ packetdataserializer.writeShort((short) (this.c.b & '\uffff')); ++ packetdataserializer.a(this.c.a); + } + -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); + } + -+ public String b() { -+ 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)}); ++ protected static int a(int i, boolean flag, boolean flag1) { ++ int j = i * 2 * 16 * 16 * 16; ++ int k = i * 16 * 16 * 16 / 2; ++ int l = flag ? i * 16 * 16 * 16 / 2 : 0; ++ int i1 = flag1 ? 256 : 0; ++ ++ return j + k + l + i1; + } + -+ public static ChunkMap a(Chunk chunk, boolean flag, int i) { -+ int j = 0; ++ public static ChunkMap a(Chunk chunk, boolean flag, boolean flag1, int i) { + ChunkSection[] achunksection = chunk.getSections(); -+ int k = 0; + ChunkMap chunkmap = new ChunkMap(); -+ byte[] abyte = PacketPlayOutMapChunk.i; ++ ArrayList arraylist = Lists.newArrayList(); + -+ if (flag) { -+ chunk.q = true; -+ } ++ int j; + -+ int l; ++ for (j = 0; j < achunksection.length; ++j) { ++ ChunkSection chunksection = achunksection[j]; + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ chunkmap.b |= 1 << l; -+ if (achunksection[l].getExtendedIdArray() != null) { -+ chunkmap.c |= 1 << l; -+ ++k; -+ } ++ if (chunksection != null && (!flag || !chunksection.a()) && (i & 1 << j) != 0) { ++ chunkmap.b |= 1 << j; ++ arraylist.add(chunksection); + } + } + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ byte[] abyte1 = achunksection[l].getIdArray(); ++ chunkmap.a = new byte[a(Integer.bitCount(chunkmap.b), flag1, flag)]; ++ j = 0; ++ Iterator iterator = arraylist.iterator(); + -+ System.arraycopy(abyte1, 0, abyte, j, abyte1.length); -+ j += abyte1.length; ++ ChunkSection chunksection1; ++ ++ while (iterator.hasNext()) { ++ chunksection1 = (ChunkSection) iterator.next(); ++ char[] achar = chunksection1.getIdArray(); ++ char[] achar1 = achar; ++ int k = achar.length; ++ ++ for (int l = 0; l < k; ++l) { ++ char c0 = achar1[l]; ++ ++ chunkmap.a[j++] = (byte) (c0 & 255); ++ chunkmap.a[j++] = (byte) (c0 >> 8 & 255); + } + } + -+ 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; -+ } ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getEmittedLightArray().a(), chunkmap.a, j)) { ++ chunksection1 = (ChunkSection) iterator.next(); + } + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getEmittedLightArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } -+ } -+ -+ if (!chunk.world.worldProvider.g) { -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getSkyLightArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } -+ } -+ } -+ -+ if (k > 0) { -+ 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(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } ++ if (flag1) { ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getSkyLightArray().a(), chunkmap.a, j)) { ++ chunksection1 = (ChunkSection) iterator.next(); + } + } + + if (flag) { -+ byte[] abyte2 = chunk.m(); -+ -+ System.arraycopy(abyte2, 0, abyte, j, abyte2.length); -+ j += abyte2.length; ++ a(chunk.getBiomeIndex(), chunkmap.a, j); + } + -+ chunkmap.a = new byte[j]; -+ System.arraycopy(abyte, 0, chunkmap.a, 0, j); + return chunkmap; + } + -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); ++ private static int a(byte[] abyte, byte[] abyte1, int i) { ++ System.arraycopy(abyte, 0, abyte1, i, abyte.length); ++ return i + abyte.length; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import java.util.List; ++ ++public class PacketPlayOutMapChunkBulk implements Packet { ++ ++ private int[] a; ++ private int[] b; ++ private ChunkMap[] c; ++ private boolean d; ++ ++ public PacketPlayOutMapChunkBulk() {} ++ ++ public PacketPlayOutMapChunkBulk(List list) { ++ int i = list.size(); ++ ++ this.a = new int[i]; ++ this.b = new int[i]; ++ this.c = new ChunkMap[i]; ++ this.d = !((Chunk) list.get(0)).getWorld().worldProvider.o(); ++ ++ for (int j = 0; j < i; ++j) { ++ Chunk chunk = (Chunk) list.get(j); ++ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); ++ ++ this.a[j] = chunk.locX; ++ this.b[j] = chunk.locZ; ++ this.c[j] = chunkmap; ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.d = packetdataserializer.readBoolean(); ++ int i = packetdataserializer.e(); ++ ++ this.a = new int[i]; ++ this.b = new int[i]; ++ this.c = new ChunkMap[i]; ++ ++ int j; ++ ++ for (j = 0; j < i; ++j) { ++ this.a[j] = packetdataserializer.readInt(); ++ this.b[j] = packetdataserializer.readInt(); ++ this.c[j] = new ChunkMap(); ++ this.c[j].b = packetdataserializer.readShort() & '\uffff'; ++ this.c[j].a = new byte[PacketPlayOutMapChunk.a(Integer.bitCount(this.c[j].b), this.d, true)]; ++ } ++ ++ for (j = 0; j < i; ++j) { ++ packetdataserializer.readBytes(this.c[j].a); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeBoolean(this.d); ++ packetdataserializer.b(this.c.length); ++ ++ int i; ++ ++ for (i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeInt(this.a[i]); ++ packetdataserializer.writeInt(this.b[i]); ++ packetdataserializer.writeShort((short) (this.c[i].b & '\uffff')); ++ } ++ ++ for (i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeBytes(this.c[i].a); ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java @@ -2484,60 +3884,105 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.io.IOException; -+ -+public class PacketPlayOutOpenWindow extends Packet { ++public class PacketPlayOutOpenWindow implements Packet { + + private int a; -+ private int b; -+ private String c; ++ private String b; ++ private IChatBaseComponent c; + private int d; -+ private boolean e; -+ private int f; ++ private int e; + + public PacketPlayOutOpenWindow() {} + -+ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent) { ++ this(i, s, ichatbasecomponent, 0); ++ } ++ ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j) { + this.a = i; -+ this.b = j; -+ this.c = s; -+ this.d = k; -+ this.e = flag; ++ this.b = s; ++ this.c = ichatbasecomponent; ++ this.d = j; + } + -+ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag, int l) { -+ this(i, j, s, k, flag); -+ this.f = l; ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j, int k) { ++ this(i, s, ichatbasecomponent, j); ++ this.e = k; + } + -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); + } + -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.readUnsignedByte(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.c(32); ++ this.b = packetdataserializer.c(32); ++ this.c = packetdataserializer.d(); + this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.readBoolean(); -+ if (this.b == 11) { -+ this.f = packetdataserializer.readInt(); ++ if (this.b.equals("EntityHorse")) { ++ this.e = packetdataserializer.readInt(); + } ++ + } + -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeByte(this.b); ++ packetdataserializer.a(this.b); + packetdataserializer.a(this.c); + packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeBoolean(this.e); -+ if (this.b == 11) { -+ packetdataserializer.writeInt(this.f); ++ if (this.b.equals("EntityHorse")) { ++ packetdataserializer.writeInt(this.e); + } ++ + } + -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++public class PathfinderGoalSwell extends PathfinderGoal { ++ ++ EntityCreeper a; ++ EntityLiving b; ++ ++ public PathfinderGoalSwell(EntityCreeper entitycreeper) { ++ this.a = entitycreeper; ++ this.a(1); ++ } ++ ++ public boolean a() { ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ ++ return this.a.ck() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; ++ } ++ ++ public void c() { ++ this.a.getNavigation().n(); ++ this.b = this.a.getGoalTarget(); ++ } ++ ++ public void d() { ++ this.b = null; ++ } ++ ++ public void e() { ++ if (this.b == null) { ++ this.a.a(-1); ++ } else if (this.a.h(this.b) > 49.0D) { ++ this.a.a(-1); ++ } else if (!this.a.getEntitySenses().a(this.b)) { ++ this.a.a(-1); ++ } else { ++ this.a.a(1); ++ } + } +} diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -2548,6 +3993,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; @@ -2556,42 +4003,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; -+import java.util.ArrayList; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class PersistentCollection { + -+ private IDataManager a; -+ private Map b = new HashMap(); -+ private List c = new ArrayList(); -+ private Map d = new HashMap(); ++ private IDataManager b; ++ protected Map a = Maps.newHashMap(); ++ private List c = Lists.newArrayList(); ++ private Map d = Maps.newHashMap(); + + public PersistentCollection(IDataManager idatamanager) { -+ this.a = idatamanager; ++ this.b = idatamanager; + this.b(); + } + + public PersistentBase get(Class oclass, String s) { -+ PersistentBase persistentbase = (PersistentBase) this.b.get(s); ++ PersistentBase persistentbase = (PersistentBase) this.a.get(s); + + if (persistentbase != null) { + return persistentbase; + } else { -+ if (this.a != null) { ++ if (this.b != null) { + try { -+ File file1 = this.a.getDataFile(s); ++ File file = this.b.getDataFile(s); + -+ if (file1 != null && file1.exists()) { ++ if (file != null && file.exists()) { + try { + persistentbase = (PersistentBase) oclass.getConstructor(new Class[] { String.class}).newInstance(new Object[] { s}); + } catch (Exception exception) { + throw new RuntimeException("Failed to instantiate " + oclass.toString(), exception); + } + -+ FileInputStream fileinputstream = new FileInputStream(file1); ++ FileInputStream fileinputstream = new FileInputStream(file); + NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream); + + fileinputstream.close(); @@ -2603,7 +4048,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (persistentbase != null) { -+ this.b.put(s, persistentbase); ++ this.a.put(s, persistentbase); + this.c.add(persistentbase); + } + @@ -2612,16 +4057,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void a(String s, PersistentBase persistentbase) { -+ if (persistentbase == null) { -+ throw new RuntimeException("Can\'t set null data"); -+ } else { -+ if (this.b.containsKey(s)) { -+ this.c.remove(this.b.remove(s)); -+ } -+ -+ this.b.put(s, persistentbase); -+ this.c.add(persistentbase); ++ if (this.a.containsKey(s)) { ++ this.c.remove(this.a.remove(s)); + } ++ ++ this.a.put(s, persistentbase); ++ this.c.add(persistentbase); + } + + public void a() { @@ -2633,21 +4074,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + persistentbase.a(false); + } + } ++ + } + + private void a(PersistentBase persistentbase) { -+ if (this.a != null) { ++ if (this.b != null) { + try { -+ File file1 = this.a.getDataFile(persistentbase.id); ++ File file = this.b.getDataFile(persistentbase.id); + -+ if (file1 != null) { ++ if (file != null) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + persistentbase.b(nbttagcompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + + nbttagcompound1.set("data", nbttagcompound); -+ FileOutputStream fileoutputstream = new FileOutputStream(file1); ++ FileOutputStream fileoutputstream = new FileOutputStream(file); + + NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) fileoutputstream); + fileoutputstream.close(); @@ -2655,20 +4097,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } catch (Exception exception) { + exception.printStackTrace(); + } ++ + } + } + + private void b() { + try { + this.d.clear(); -+ if (this.a == null) { ++ if (this.b == null) { + return; + } + -+ File file1 = this.a.getDataFile("idcounts"); ++ File file = this.b.getDataFile("idcounts"); + -+ if (file1 != null && file1.exists()) { -+ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); ++ if (file != null && file.exists()) { ++ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file)); + NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream); + + datainputstream.close(); @@ -2680,15 +4123,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (nbtbase instanceof NBTTagShort) { + NBTTagShort nbttagshort = (NBTTagShort) nbtbase; -+ short short1 = nbttagshort.e(); ++ short short0 = nbttagshort.e(); + -+ this.d.put(s, Short.valueOf(short1)); ++ this.d.put(s, Short.valueOf(short0)); + } + } + } + } catch (Exception exception) { + exception.printStackTrace(); + } ++ + } + + public int a(String s) { @@ -2701,24 +4145,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + this.d.put(s, oshort); -+ if (this.a == null) { ++ if (this.b == null) { + return oshort.shortValue(); + } else { + try { -+ File file1 = this.a.getDataFile("idcounts"); ++ File file = this.b.getDataFile("idcounts"); + -+ if (file1 != null) { ++ if (file != null) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + Iterator iterator = this.d.keySet().iterator(); + + while (iterator.hasNext()) { + String s1 = (String) iterator.next(); -+ short short1 = ((Short) this.d.get(s1)).shortValue(); ++ short short0 = ((Short) this.d.get(s1)).shortValue(); + -+ nbttagcompound.setShort(s1, short1); ++ nbttagcompound.setShort(s1, short0); + } + -+ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); ++ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file)); + + NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); + dataoutputstream.close(); @@ -2739,43 +4183,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class RegionFileCache { + -+ private static final Map a = new HashMap(); ++ private static final Map a = Maps.newHashMap(); + -+ public static synchronized RegionFile a(File file1, int i, int j) { -+ File file2 = new File(file1, "region"); -+ File file3 = new File(file2, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); -+ RegionFile regionfile = (RegionFile) a.get(file3); ++ public static synchronized RegionFile a(File file, int i, int j) { ++ File file1 = new File(file, "region"); ++ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); ++ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2); + + if (regionfile != null) { + return regionfile; + } else { -+ if (!file2.exists()) { -+ file2.mkdirs(); ++ if (!file1.exists()) { ++ file1.mkdirs(); + } + -+ if (a.size() >= 256) { ++ if (RegionFileCache.a.size() >= 256) { + a(); + } + -+ RegionFile regionfile1 = new RegionFile(file3); ++ RegionFile regionfile1 = new RegionFile(file2); + -+ a.put(file3, regionfile1); ++ RegionFileCache.a.put(file2, regionfile1); + return regionfile1; + } + } + + public static synchronized void a() { -+ Iterator iterator = a.values().iterator(); ++ Iterator iterator = RegionFileCache.a.values().iterator(); + + while (iterator.hasNext()) { + RegionFile regionfile = (RegionFile) iterator.next(); @@ -2789,20 +4233,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ a.clear(); ++ RegionFileCache.a.clear(); + } + -+ public static DataInputStream c(File file1, int i, int j) { -+ RegionFile regionfile = a(file1, i, j); ++ public static DataInputStream c(File file, int i, int j) { ++ RegionFile regionfile = a(file, i, j); + + return regionfile.a(i & 31, j & 31); + } + -+ public static DataOutputStream d(File file1, int i, int j) { -+ RegionFile regionfile = a(file1, i, j); ++ public static DataOutputStream d(File file, int i, int j) { ++ RegionFile regionfile = a(file, i, j); + + return regionfile.b(i & 31, j & 31); + } ++ +} diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java new file mode 100644 @@ -2812,105 +4257,109 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import io.netty.bootstrap.ServerBootstrap; ++import io.netty.channel.ChannelFuture; ++import io.netty.channel.EventLoopGroup; ++import io.netty.channel.socket.nio.NioServerSocketChannel; ++import io.netty.util.concurrent.GenericFutureListener; +import java.net.InetAddress; -+import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; -+ -+import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.io.netty.bootstrap.ServerBootstrap; -+import net.minecraft.util.io.netty.channel.ChannelFuture; -+import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup; -+import net.minecraft.util.io.netty.channel.socket.nio.NioServerSocketChannel; -+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ServerConnection { + -+ private static final Logger b = LogManager.getLogger(); -+ private static final NioEventLoopGroup c = new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty IO #%d").setDaemon(true).build()); -+ private final MinecraftServer d; -+ public volatile boolean a; -+ private final List e = Collections.synchronizedList(new ArrayList()); -+ private final List f = Collections.synchronizedList(new ArrayList()); ++ private static final Logger d = LogManager.getLogger(); ++ public static final LazyInitVar a = new LazyInitNioEventLoopGroup(); ++ public static final LazyInitVar b = new LazyInitLocalEventLoopGroup(); ++ private final MinecraftServer e; ++ public volatile boolean c; ++ private final List f = Collections.synchronizedList(Lists.newArrayList()); ++ private final List g = Collections.synchronizedList(Lists.newArrayList()); + + public ServerConnection(MinecraftServer minecraftserver) { -+ this.d = minecraftserver; -+ this.a = true; ++ this.e = minecraftserver; ++ this.c = true; + } + + public void a(InetAddress inetaddress, int i) { -+ List list = this.e; ++ List list = this.f; + -+ synchronized (this.e) { -+ this.e.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group(c).localAddress(inetaddress, i)).bind().syncUninterruptibly()); ++ synchronized (this.f) { ++ this.f.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group((EventLoopGroup) ServerConnection.a.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); + } + } + + public void b() { -+ this.a = false; -+ Iterator iterator = this.e.iterator(); ++ this.c = false; ++ Iterator iterator = this.f.iterator(); + + while (iterator.hasNext()) { + ChannelFuture channelfuture = (ChannelFuture) iterator.next(); + -+ channelfuture.channel().close().syncUninterruptibly(); ++ try { ++ channelfuture.channel().close().sync(); ++ } catch (InterruptedException interruptedexception) { ++ ServerConnection.d.error("Interrupted whilst closing channel"); ++ } + } ++ + } + + public void c() { -+ List list = this.f; ++ List list = this.g; + -+ synchronized (this.f) { -+ Iterator iterator = this.f.iterator(); ++ synchronized (this.g) { ++ Iterator iterator = this.g.iterator(); + + while (iterator.hasNext()) { + NetworkManager networkmanager = (NetworkManager) iterator.next(); + -+ if (!networkmanager.isConnected()) { -+ iterator.remove(); -+ if (networkmanager.f() != null) { -+ networkmanager.getPacketListener().a(networkmanager.f()); -+ } else if (networkmanager.getPacketListener() != null) { -+ networkmanager.getPacketListener().a(new ChatComponentText("Disconnected")); -+ } -+ } else { -+ try { -+ networkmanager.a(); -+ } catch (Exception exception) { -+ if (networkmanager.c()) { -+ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); -+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); ++ if (!networkmanager.h()) { ++ if (!networkmanager.g()) { ++ iterator.remove(); ++ networkmanager.l(); ++ } else { ++ try { ++ networkmanager.a(); ++ } catch (Exception exception) { ++ if (networkmanager.c()) { ++ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); ++ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); + -+ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportServerConnection(this, networkmanager))); -+ throw new ReportedException(crashreport); ++ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportNetworkManager(this, networkmanager))); ++ throw new ReportedException(crashreport); ++ } ++ ++ ServerConnection.d.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); ++ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); ++ ++ networkmanager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new NetworkManagerCloseFuture(this, networkmanager, chatcomponenttext), new GenericFutureListener[0]); ++ networkmanager.k(); + } -+ -+ b.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); -+ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); -+ -+ networkmanager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new ServerConnectionFuture(this, networkmanager, chatcomponenttext)}); -+ networkmanager.g(); + } + } + } ++ + } + } + + public MinecraftServer d() { -+ return this.d; ++ return this.e; + } + + static List a(ServerConnection serverconnection) { -+ return serverconnection.f; ++ return serverconnection.g; + } + + static MinecraftServer b(ServerConnection serverconnection) { -+ return serverconnection.d; ++ return serverconnection.e; + } ++ +} diff --git a/src/main/java/net/minecraft/server/ServerConnectionChannel.java b/src/main/java/net/minecraft/server/ServerConnectionChannel.java new file mode 100644 @@ -2920,11 +4369,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import net.minecraft.util.io.netty.channel.Channel; -+import net.minecraft.util.io.netty.channel.ChannelException; -+import net.minecraft.util.io.netty.channel.ChannelInitializer; -+import net.minecraft.util.io.netty.channel.ChannelOption; -+import net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler; ++import io.netty.channel.Channel; ++import io.netty.channel.ChannelException; ++import io.netty.channel.ChannelInitializer; ++import io.netty.channel.ChannelOption; ++import io.netty.handler.timeout.ReadTimeoutHandler; + +class ServerConnectionChannel extends ChannelInitializer { + @@ -2947,8 +4396,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ; + } + -+ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(this.a)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(NetworkManager.h)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(NetworkManager.h)); -+ NetworkManager networkmanager = new NetworkManager(false); ++ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(this.a)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); ++ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); + + ServerConnection.a(this.a).add(networkmanager); + channel.pipeline().addLast("packet_handler", networkmanager); @@ -2963,6 +4412,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.collect.Maps; ++import com.google.common.collect.Sets; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonParseException; ++import com.google.gson.JsonParser; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; @@ -2972,14 +4427,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; -+ -+import net.minecraft.util.com.google.common.collect.Maps; -+import net.minecraft.util.com.google.common.collect.Sets; -+import net.minecraft.util.com.google.gson.JsonElement; -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.google.gson.JsonParseException; -+import net.minecraft.util.com.google.gson.JsonParser; -+import net.minecraft.util.org.apache.commons.io.FileUtils; ++import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + @@ -2992,9 +4440,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private int f = -300; + private boolean g = false; + -+ public ServerStatisticManager(MinecraftServer minecraftserver, File file1) { ++ public ServerStatisticManager(MinecraftServer minecraftserver, File file) { + this.c = minecraftserver; -+ this.d = file1; ++ this.d = file; + } + + public void a() { @@ -3003,19 +4451,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a.clear(); + this.a.putAll(this.a(FileUtils.readFileToString(this.d))); + } catch (IOException ioexception) { -+ b.error("Couldn\'t read statistics file " + this.d, ioexception); ++ ServerStatisticManager.b.error("Couldn\'t read statistics file " + this.d, ioexception); + } catch (JsonParseException jsonparseexception) { -+ b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception); ++ ServerStatisticManager.b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception); + } + } ++ + } + + public void b() { + try { + FileUtils.writeStringToFile(this.d, a(this.a)); + } catch (IOException ioexception) { -+ b.error("Couldn\'t save stats", ioexception); ++ ServerStatisticManager.b.error("Couldn\'t save stats", ioexception); + } ++ + } + + public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) { @@ -3025,10 +4475,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.e.add(statistic); + if (statistic.d() && j == 0 && i > 0) { + this.g = true; -+ if (this.c.at()) { ++ if (this.c.az()) { + this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); + } + } ++ ++ if (statistic.d() && j > 0 && i == 0) { ++ this.g = true; ++ if (this.c.az()) { ++ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); ++ } ++ } ++ + } + + public Set c() { @@ -3073,14 +4531,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ijsonstatistic.a(jsonobject1.get("progress")); + statisticwrapper.a(ijsonstatistic); + } catch (Throwable throwable) { -+ b.warn("Invalid statistic progress in " + this.d, throwable); ++ ServerStatisticManager.b.warn("Invalid statistic progress in " + this.d, throwable); + } + } + } + + hashmap.put(statistic, statisticwrapper); + } else { -+ b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); ++ ServerStatisticManager.b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); + } + } + @@ -3103,7 +4561,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + jsonobject1.add("progress", ((StatisticWrapper) entry.getValue()).b().a()); + } catch (Throwable throwable) { -+ b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable); ++ ServerStatisticManager.b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable); + } + + jsonobject.add(((Statistic) entry.getKey()).name, jsonobject1); @@ -3123,10 +4581,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + this.e.add(statistic); + } ++ + } + + public void a(EntityPlayer entityplayer) { -+ int i = this.c.al(); ++ int i = this.c.ar(); + HashMap hashmap = Maps.newHashMap(); + + if (this.g || i - this.f > 300) { @@ -3162,6 +4621,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean e() { + return this.g; + } ++ +} diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java new file mode 100644 @@ -3171,7 +4631,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.util.HashMap; ++import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; @@ -3180,31 +4640,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public abstract class StructureGenerator extends WorldGenBase { + -+ private PersistentStructure e; -+ protected Map d = new HashMap(); ++ private PersistentStructure d; ++ protected Map e = Maps.newHashMap(); + + public StructureGenerator() {} + + public abstract String a(); + -+ protected final void a(World world, int i, int j, int k, int l, Block[] ablock) { ++ protected final void a(World world, int i, int j, int k, int l, ChunkSnapshot chunksnapshot) { + this.a(world); -+ if (!this.d.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { ++ if (!this.e.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { + this.b.nextInt(); + + try { + if (this.a(i, j)) { + StructureStart structurestart = this.b(i, j); + -+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); + this.a(i, j, structurestart); + } ++ + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared"); + + crashreportsystemdetails.a("Is feature chunk", (Callable) (new CrashReportIsFeatureChunk(this, i, j))); -+ crashreportsystemdetails.a("Chunk location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); ++ crashreportsystemdetails.a("Chunk location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); + crashreportsystemdetails.a("Chunk pos hash", (Callable) (new CrashReportChunkPosHash(this, i, j))); + crashreportsystemdetails.a("Structure type", (Callable) (new CrashReportStructureType(this))); + throw new ReportedException(crashreport); @@ -3212,18 +4673,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public boolean a(World world, Random random, int i, int j) { ++ public boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { + this.a(world); -+ int k = (i << 4) + 8; -+ int l = (j << 4) + 8; ++ int i = (chunkcoordintpair.x << 4) + 8; ++ int j = (chunkcoordintpair.z << 4) + 8; + boolean flag = false; -+ Iterator iterator = this.d.values().iterator(); ++ Iterator iterator = this.e.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a().a(k, l, k + 15, l + 15)) { -+ structurestart.a(world, random, new StructureBoundingBox(k, l, k + 15, l + 15)); ++ if (structurestart.d() && structurestart.a(chunkcoordintpair) && structurestart.a().a(i, j, i + 15, j + 15)) { ++ structurestart.a(world, random, new StructureBoundingBox(i, j, i + 15, j + 15)); ++ structurestart.b(chunkcoordintpair); + flag = true; + this.a(structurestart.e(), structurestart.f(), structurestart); + } @@ -3232,24 +4694,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return flag; + } + -+ public boolean b(int i, int j, int k) { ++ public boolean b(BlockPosition blockposition) { + this.a(this.c); -+ return this.c(i, j, k) != null; ++ return this.c(blockposition) != null; + } + -+ protected StructureStart c(int i, int j, int k) { -+ Iterator iterator = this.d.values().iterator(); ++ protected StructureStart c(BlockPosition blockposition) { ++ Iterator iterator = this.e.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a().a(i, k, i, k)) { ++ if (structurestart.d() && structurestart.a().b((BaseBlockPosition) blockposition)) { + Iterator iterator1 = structurestart.b().iterator(); + + while (iterator1.hasNext()) { + StructurePiece structurepiece = (StructurePiece) iterator1.next(); + -+ if (structurepiece.c().b(i, j, k)) { ++ if (structurepiece.c().b((BaseBlockPosition) blockposition)) { + return structurestart; + } + } @@ -3259,9 +4721,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + -+ public boolean d(int i, int j, int k) { -+ this.a(this.c); -+ Iterator iterator = this.d.values().iterator(); ++ public boolean a(World world, BlockPosition blockposition) { ++ this.a(world); ++ Iterator iterator = this.e.values().iterator(); + + StructureStart structurestart; + @@ -3271,31 +4733,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + structurestart = (StructureStart) iterator.next(); -+ } while (!structurestart.d()); ++ } while (!structurestart.d() || !structurestart.a().b((BaseBlockPosition) blockposition)); + -+ return structurestart.a().a(i, k, i, k); ++ return true; + } + -+ public ChunkPosition getNearestGeneratedFeature(World world, int i, int j, int k) { ++ public BlockPosition getNearestGeneratedFeature(World world, BlockPosition blockposition) { + this.c = world; + this.a(world); + this.b.setSeed(world.getSeed()); -+ long l = this.b.nextLong(); -+ long i1 = this.b.nextLong(); -+ long j1 = (long) (i >> 4) * l; -+ long k1 = (long) (k >> 4) * i1; ++ long i = this.b.nextLong(); ++ long j = this.b.nextLong(); ++ long k = (long) (blockposition.getX() >> 4) * i; ++ long l = (long) (blockposition.getZ() >> 4) * j; + -+ this.b.setSeed(j1 ^ k1 ^ world.getSeed()); -+ this.a(world, i >> 4, k >> 4, 0, 0, (Block[]) null); ++ this.b.setSeed(k ^ l ^ world.getSeed()); ++ this.a(world, blockposition.getX() >> 4, blockposition.getZ() >> 4, 0, 0, (ChunkSnapshot) null); + double d0 = Double.MAX_VALUE; -+ ChunkPosition chunkposition = null; -+ Iterator iterator = this.d.values().iterator(); ++ BlockPosition blockposition1 = null; ++ Iterator iterator = this.e.values().iterator(); + -+ ChunkPosition chunkposition1; -+ int l1; -+ int i2; ++ BlockPosition blockposition2; + double d1; -+ int j2; + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); @@ -3303,58 +4762,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (structurestart.d()) { + StructurePiece structurepiece = (StructurePiece) structurestart.b().get(0); + -+ chunkposition1 = structurepiece.a(); -+ i2 = chunkposition1.x - i; -+ l1 = chunkposition1.y - j; -+ j2 = chunkposition1.z - k; -+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2); ++ blockposition2 = structurepiece.a(); ++ d1 = blockposition2.i(blockposition); + if (d1 < d0) { + d0 = d1; -+ chunkposition = chunkposition1; ++ blockposition1 = blockposition2; + } + } + } + -+ if (chunkposition != null) { -+ return chunkposition; ++ if (blockposition1 != null) { ++ return blockposition1; + } else { -+ List list = this.o_(); ++ List list = this.y_(); + + if (list != null) { -+ ChunkPosition chunkposition2 = null; ++ BlockPosition blockposition3 = null; + Iterator iterator1 = list.iterator(); + + while (iterator1.hasNext()) { -+ chunkposition1 = (ChunkPosition) iterator1.next(); -+ i2 = chunkposition1.x - i; -+ l1 = chunkposition1.y - j; -+ j2 = chunkposition1.z - k; -+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2); ++ blockposition2 = (BlockPosition) iterator1.next(); ++ d1 = blockposition2.i(blockposition); + if (d1 < d0) { + d0 = d1; -+ chunkposition2 = chunkposition1; ++ blockposition3 = blockposition2; + } + } + -+ return chunkposition2; ++ return blockposition3; + } else { + return null; + } + } + } + -+ protected List o_() { ++ protected List y_() { + return null; + } + + private void a(World world) { -+ if (this.e == null) { -+ this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ if (this.e == null) { -+ this.e = new PersistentStructure(this.a()); -+ world.a(this.a(), (PersistentBase) this.e); ++ if (this.d == null) { ++ this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); ++ if (this.d == null) { ++ this.d = new PersistentStructure(this.a()); ++ world.a(this.a(), (PersistentBase) this.d); + } else { -+ NBTTagCompound nbttagcompound = this.e.a(); ++ NBTTagCompound nbttagcompound = this.d.a(); + Iterator iterator = nbttagcompound.c().iterator(); + + while (iterator.hasNext()) { @@ -3370,24 +4823,133 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world); + + if (structurestart != null) { -+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); + } + } + } + } + } + } ++ + } + + private void a(int i, int j, StructureStart structurestart) { -+ this.e.a(structurestart.a(i, j), i, j); -+ this.e.c(); ++ this.d.a(structurestart.a(i, j), i, j); ++ this.d.c(); + } + + protected abstract boolean a(int i, int j); + + protected abstract StructureStart b(int i, int j); +} +diff --git a/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++class SwitchHelperBlockFlowerPot { ++ ++ static final int[] a; ++ static final int[] b = new int[EnumFlowerVarient.values().length]; ++ ++ static { ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.POPPY.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.BLUE_ORCHID.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror1) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ALLIUM.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror2) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.HOUSTONIA.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror3) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.RED_TULIP.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror4) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ORANGE_TULIP.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror5) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.WHITE_TULIP.ordinal()] = 7; ++ } catch (NoSuchFieldError nosuchfielderror6) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.PINK_TULIP.ordinal()] = 8; ++ } catch (NoSuchFieldError nosuchfielderror7) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.OXEYE_DAISY.ordinal()] = 9; ++ } catch (NoSuchFieldError nosuchfielderror8) { ++ ; ++ } ++ ++ a = new int[EnumLogVariant.values().length]; ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.OAK.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror9) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.SPRUCE.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror10) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.BIRCH.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror11) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.JUNGLE.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror12) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.ACACIA.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror13) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.DARK_OAK.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror14) { ++ ; ++ } ++ ++ } ++} diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -3396,6 +4958,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.google.common.base.Charsets; ++import com.google.common.collect.Iterators; ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import com.google.common.io.Files; ++import com.google.gson.Gson; ++import com.google.gson.GsonBuilder; ++import com.mojang.authlib.Agent; ++import com.mojang.authlib.GameProfile; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; @@ -3412,17 +4983,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Locale; +import java.util.Map; +import java.util.UUID; -+ -+import net.minecraft.util.com.google.common.base.Charsets; -+import net.minecraft.util.com.google.common.collect.Iterators; -+import net.minecraft.util.com.google.common.collect.Lists; -+import net.minecraft.util.com.google.common.collect.Maps; -+import net.minecraft.util.com.google.common.io.Files; -+import net.minecraft.util.com.google.gson.Gson; -+import net.minecraft.util.com.google.gson.GsonBuilder; -+import net.minecraft.util.com.mojang.authlib.Agent; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+import net.minecraft.util.org.apache.commons.io.IOUtils; ++import org.apache.commons.io.IOUtils; + +public class UserCache { + @@ -3435,9 +4996,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final File g; + private static final ParameterizedType h = new UserCacheEntryType(); + -+ public UserCache(MinecraftServer minecraftserver, File file1) { ++ public UserCache(MinecraftServer minecraftserver, File file) { + this.f = minecraftserver; -+ this.g = file1; ++ this.g = file; + GsonBuilder gsonbuilder = new GsonBuilder(); + + gsonbuilder.registerTypeHierarchyAdapter(UserCacheEntry.class, new BanEntrySerializer(this, (GameProfileLookup) null)); @@ -3477,22 +5038,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + String s = gameprofile.getName().toLowerCase(Locale.ROOT); + UserCacheEntry usercacheentry = new UserCacheEntry(this, gameprofile, date, (GameProfileLookup) null); -+ LinkedList linkedlist = this.e; + -+ synchronized (this.e) { -+ if (this.d.containsKey(uuid)) { -+ UserCacheEntry usercacheentry1 = (UserCacheEntry) this.d.get(uuid); ++ if (this.d.containsKey(uuid)) { ++ UserCacheEntry usercacheentry1 = (UserCacheEntry) this.d.get(uuid); + -+ this.c.remove(usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); -+ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercacheentry); -+ this.e.remove(gameprofile); -+ } else { -+ this.d.put(uuid, usercacheentry); -+ this.c.put(s, usercacheentry); -+ } -+ -+ this.e.addFirst(gameprofile); ++ this.c.remove(usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); ++ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercacheentry); ++ this.e.remove(gameprofile); ++ } else { ++ this.d.put(uuid, usercacheentry); ++ this.c.put(s, usercacheentry); + } ++ ++ this.e.addFirst(gameprofile); + } + + public GameProfile getProfile(String s) { @@ -3502,12 +5060,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (usercacheentry != null && (new Date()).getTime() >= UserCacheEntry.a(usercacheentry).getTime()) { + this.d.remove(usercacheentry.a().getId()); + this.c.remove(usercacheentry.a().getName().toLowerCase(Locale.ROOT)); -+ LinkedList linkedlist = this.e; -+ -+ synchronized (this.e) { -+ this.e.remove(usercacheentry.a()); -+ } -+ ++ this.e.remove(usercacheentry.a()); + usercacheentry = null; + } + @@ -3515,12 +5068,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (usercacheentry != null) { + gameprofile = usercacheentry.a(); -+ LinkedList linkedlist1 = this.e; -+ -+ synchronized (this.e) { -+ this.e.remove(gameprofile); -+ this.e.addFirst(gameprofile); -+ } ++ this.e.remove(gameprofile); ++ this.e.addFirst(gameprofile); + } else { + gameprofile = a(this.f, s1); + if (gameprofile != null) { @@ -3550,12 +5099,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (usercacheentry != null) { + GameProfile gameprofile = usercacheentry.a(); -+ LinkedList linkedlist = this.e; + -+ synchronized (this.e) { -+ this.e.remove(gameprofile); -+ this.e.addFirst(gameprofile); -+ } ++ this.e.remove(gameprofile); ++ this.e.addFirst(gameprofile); + } + + return usercacheentry; @@ -3565,11 +5111,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + List list = null; + BufferedReader bufferedreader = null; + -+ label81: { ++ label64: { + try { + bufferedreader = Files.newReader(this.g, Charsets.UTF_8); -+ list = (List) this.b.fromJson(bufferedreader, h); -+ break label81; ++ list = (List) this.b.fromJson(bufferedreader, UserCache.h); ++ break label64; + } catch (FileNotFoundException filenotfoundexception) { + ; + } finally { @@ -3582,12 +5128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (list != null) { + this.c.clear(); + this.d.clear(); -+ LinkedList linkedlist = this.e; -+ -+ synchronized (this.e) { -+ this.e.clear(); -+ } -+ ++ this.e.clear(); + list = Lists.reverse(list); + Iterator iterator = list.iterator(); + @@ -3599,6 +5140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } ++ + } + + public void c() { @@ -3616,17 +5158,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } finally { + IOUtils.closeQuietly(bufferedwriter); + } ++ + } + + private List a(int i) { + ArrayList arraylist = Lists.newArrayList(); -+ LinkedList linkedlist = this.e; -+ ArrayList arraylist1; -+ -+ synchronized (this.e) { -+ arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i)); -+ } -+ ++ ArrayList arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i)); + Iterator iterator = arraylist1.iterator(); + + while (iterator.hasNext()) { @@ -3640,6 +5177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + return arraylist; + } ++ +} diff --git a/src/main/java/net/minecraft/server/UserCacheEntry.java b/src/main/java/net/minecraft/server/UserCacheEntry.java new file mode 100644 @@ -3649,10 +5187,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + ++import com.mojang.authlib.GameProfile; +import java.util.Date; + -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +class UserCacheEntry { + + private final GameProfile b; @@ -3747,31 +5284,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + super(flag); + } + -+ public boolean generate(World world, Random random, int i, int j, int k) { -+ int l = random.nextInt(3) + random.nextInt(2) + 6; ++ public boolean generate(World world, Random random, BlockPosition blockposition) { ++ int i = random.nextInt(3) + random.nextInt(2) + 6; + boolean flag = true; + -+ if (j >= 1 && j + l + 1 <= 256) { -+ int i1; -+ int j1; ++ if (blockposition.getY() >= 1 && blockposition.getY() + i + 1 <= 256) { ++ int j; ++ int k; + -+ for (int k1 = j; k1 <= j + 1 + l; ++k1) { ++ for (int l = blockposition.getY(); l <= blockposition.getY() + 1 + i; ++l) { + byte b0 = 1; + -+ if (k1 == j) { ++ if (l == blockposition.getY()) { + b0 = 0; + } + -+ if (k1 >= j + 1 + l - 2) { ++ if (l >= blockposition.getY() + 1 + i - 2) { + b0 = 2; + } + -+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) { -+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) { -+ if (k1 >= 0 && k1 < 256) { -+ Block block = world.getType(i1, k1, j1); -+ -+ if (!this.a(block)) { ++ for (j = blockposition.getX() - b0; j <= blockposition.getX() + b0 && flag; ++j) { ++ for (k = blockposition.getZ() - b0; k <= blockposition.getZ() + b0 && flag; ++k) { ++ if (l >= 0 && l < 256) { ++ if (!this.a(world.getType(new BlockPosition(j, l, k)).getBlock())) { + flag = false; + } + } else { @@ -3784,100 +5319,101 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!flag) { + return false; + } else { -+ Block block1 = world.getType(i, j - 1, k); ++ Block block = world.getType(blockposition.down()).getBlock(); + -+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) { -+ this.setType(world, i, j - 1, k, Blocks.DIRT); -+ this.setType(world, i + 1, j - 1, k, Blocks.DIRT); -+ this.setType(world, i + 1, j - 1, k + 1, Blocks.DIRT); -+ this.setType(world, i, j - 1, k + 1, Blocks.DIRT); -+ int l1 = random.nextInt(4); ++ if ((block == Blocks.GRASS || block == Blocks.DIRT) && blockposition.getY() < 256 - i - 1) { ++ this.a(world, blockposition.down()); ++ this.a(world, blockposition.a(1, -1, 0)); ++ this.a(world, blockposition.a(1, -1, 1)); ++ this.a(world, blockposition.a(0, -1, 1)); ++ EnumDirection enumdirection = EnumDirectionLimit.HORIZONTAL.a(random); + -+ i1 = l - random.nextInt(4); -+ j1 = 2 - random.nextInt(3); -+ int i2 = i; -+ int j2 = k; -+ int k2 = 0; ++ j = i - random.nextInt(4); ++ k = 2 - random.nextInt(3); ++ int i1 = blockposition.getX(); ++ int j1 = blockposition.getZ(); ++ int k1 = 0; + -+ int l2; -+ int i3; ++ int l1; ++ int i2; + -+ for (l2 = 0; l2 < l; ++l2) { -+ i3 = j + l2; -+ if (l2 >= i1 && j1 > 0) { -+ i2 += Direction.a[l1]; -+ j2 += Direction.b[l1]; -+ --j1; ++ for (l1 = 0; l1 < i; ++l1) { ++ i2 = blockposition.getY() + l1; ++ if (l1 >= j && k > 0) { ++ i1 += enumdirection.getAdjacentX(); ++ j1 += enumdirection.getAdjacentZ(); ++ --k; + } + -+ Block block2 = world.getType(i2, i3, j2); ++ BlockPosition blockposition1 = new BlockPosition(i1, i2, j1); ++ Material material = world.getType(blockposition1).getBlock().getMaterial(); + -+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) { -+ this.setTypeAndData(world, i2, i3, j2, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2 + 1, i3, j2, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2, i3, j2 + 1, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2 + 1, i3, j2 + 1, Blocks.LOG2, 1); -+ k2 = i3; ++ if (material == Material.AIR || material == Material.LEAVES) { ++ this.a(world, blockposition1, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.east(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.east().south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ k1 = i2; + } + } + -+ for (l2 = -2; l2 <= 0; ++l2) { -+ for (i3 = -2; i3 <= 0; ++i3) { ++ for (l1 = -2; l1 <= 0; ++l1) { ++ for (i2 = -2; i2 <= 0; ++i2) { + byte b1 = -1; + -+ this.a(world, i2 + l2, k2 + b1, j2 + i3); -+ this.a(world, 1 + i2 - l2, k2 + b1, j2 + i3); -+ this.a(world, i2 + l2, k2 + b1, 1 + j2 - i3); -+ this.a(world, 1 + i2 - l2, k2 + b1, 1 + j2 - i3); -+ if ((l2 > -2 || i3 > -1) && (l2 != -1 || i3 != -2)) { ++ this.a(world, i1 + l1, k1 + b1, j1 + i2); ++ this.a(world, 1 + i1 - l1, k1 + b1, j1 + i2); ++ this.a(world, i1 + l1, k1 + b1, 1 + j1 - i2); ++ this.a(world, 1 + i1 - l1, k1 + b1, 1 + j1 - i2); ++ if ((l1 > -2 || i2 > -1) && (l1 != -1 || i2 != -2)) { + byte b2 = 1; + -+ this.a(world, i2 + l2, k2 + b2, j2 + i3); -+ this.a(world, 1 + i2 - l2, k2 + b2, j2 + i3); -+ this.a(world, i2 + l2, k2 + b2, 1 + j2 - i3); -+ this.a(world, 1 + i2 - l2, k2 + b2, 1 + j2 - i3); ++ this.a(world, i1 + l1, k1 + b2, j1 + i2); ++ this.a(world, 1 + i1 - l1, k1 + b2, j1 + i2); ++ this.a(world, i1 + l1, k1 + b2, 1 + j1 - i2); ++ this.a(world, 1 + i1 - l1, k1 + b2, 1 + j1 - i2); + } + } + } + + if (random.nextBoolean()) { -+ this.a(world, i2, k2 + 2, j2); -+ this.a(world, i2 + 1, k2 + 2, j2); -+ this.a(world, i2 + 1, k2 + 2, j2 + 1); -+ this.a(world, i2, k2 + 2, j2 + 1); ++ this.a(world, i1, k1 + 2, j1); ++ this.a(world, i1 + 1, k1 + 2, j1); ++ this.a(world, i1 + 1, k1 + 2, j1 + 1); ++ this.a(world, i1, k1 + 2, j1 + 1); + } + -+ for (l2 = -3; l2 <= 4; ++l2) { -+ for (i3 = -3; i3 <= 4; ++i3) { -+ if ((l2 != -3 || i3 != -3) && (l2 != -3 || i3 != 4) && (l2 != 4 || i3 != -3) && (l2 != 4 || i3 != 4) && (Math.abs(l2) < 3 || Math.abs(i3) < 3)) { -+ this.a(world, i2 + l2, k2, j2 + i3); ++ for (l1 = -3; l1 <= 4; ++l1) { ++ for (i2 = -3; i2 <= 4; ++i2) { ++ if ((l1 != -3 || i2 != -3) && (l1 != -3 || i2 != 4) && (l1 != 4 || i2 != -3) && (l1 != 4 || i2 != 4) && (Math.abs(l1) < 3 || Math.abs(i2) < 3)) { ++ this.a(world, i1 + l1, k1, j1 + i2); + } + } + } + -+ for (l2 = -1; l2 <= 2; ++l2) { -+ for (i3 = -1; i3 <= 2; ++i3) { -+ if ((l2 < 0 || l2 > 1 || i3 < 0 || i3 > 1) && random.nextInt(3) <= 0) { -+ int j3 = random.nextInt(3) + 2; ++ for (l1 = -1; l1 <= 2; ++l1) { ++ for (i2 = -1; i2 <= 2; ++i2) { ++ if ((l1 < 0 || l1 > 1 || i2 < 0 || i2 > 1) && random.nextInt(3) <= 0) { ++ int j2 = random.nextInt(3) + 2; + -+ int k3; ++ int k2; + -+ for (k3 = 0; k3 < j3; ++k3) { -+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); ++ for (k2 = 0; k2 < j2; ++k2) { ++ this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); + } + -+ int l3; ++ int l2; + -+ for (k3 = -1; k3 <= 1; ++k3) { -+ for (l3 = -1; l3 <= 1; ++l3) { -+ this.a(world, i2 + l2 + k3, k2 - 0, j2 + i3 + l3); ++ for (k2 = -1; k2 <= 1; ++k2) { ++ for (l2 = -1; l2 <= 1; ++l2) { ++ this.a(world, i1 + l1 + k2, k1 - 0, j1 + i2 + l2); + } + } + -+ for (k3 = -2; k3 <= 2; ++k3) { -+ for (l3 = -2; l3 <= 2; ++l3) { -+ if (Math.abs(k3) != 2 || Math.abs(l3) != 2) { -+ this.a(world, i2 + l2 + k3, k2 - 1, j2 + i3 + l3); ++ for (k2 = -2; k2 <= 2; ++k2) { ++ for (l2 = -2; l2 <= 2; ++l2) { ++ if (Math.abs(k2) != 2 || Math.abs(l2) != 2) { ++ this.a(world, i1 + l1 + k2, k1 - 1, j1 + i2 + l2); + } + } + } @@ -3896,11 +5432,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private void a(World world, int i, int j, int k) { -+ Block block = world.getType(i, j, k); ++ Block block = world.getType(new BlockPosition(i, j, k)).getBlock(); + + if (block.getMaterial() == Material.AIR) { -+ this.setTypeAndData(world, i, j, k, Blocks.LEAVES2, 1); ++ this.a(world, new BlockPosition(i, j, k), Blocks.LEAVES2, 1); + } ++ + } +} diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java @@ -3911,7 +5448,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.util.ArrayList; ++import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; @@ -3921,13 +5458,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenLargeFeature extends StructureGenerator { + -+ private static List e = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); ++ private static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); + private List f; + private int g; + private int h; + + public WorldGenLargeFeature() { -+ this.f = new ArrayList(); ++ this.f = Lists.newArrayList(); + this.g = 32; + this.h = 8; + this.f.add(new BiomeMeta(EntityWitch.class, 1, 1, 1)); @@ -3944,6 +5481,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); + } + } ++ + } + + public String a() { @@ -3964,15 +5502,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + int i1 = i / this.g; + int j1 = j / this.g; -+ Random random = this.c.A(i1, j1, 14357617); ++ Random random = this.c.a(i1, j1, 14357617); + + i1 *= this.g; + j1 *= this.g; + i1 += random.nextInt(this.g - this.h); + j1 += random.nextInt(this.g - this.h); + if (k == i1 && l == j1) { -+ BiomeBase biomebase = this.c.getWorldChunkManager().getBiome(k * 16 + 8, l * 16 + 8); -+ Iterator iterator = e.iterator(); ++ BiomeBase biomebase = this.c.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8)); ++ ++ if (biomebase == null) { ++ return false; ++ } ++ ++ Iterator iterator = WorldGenLargeFeature.d.iterator(); + + while (iterator.hasNext()) { + BiomeBase biomebase1 = (BiomeBase) iterator.next(); @@ -3990,8 +5533,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new WorldGenLargeFeatureStart(this.c, this.b, i, j); + } + -+ public boolean a(int i, int j, int k) { -+ StructureStart structurestart = this.c(i, j, k); ++ public boolean a(BlockPosition blockposition) { ++ StructureStart structurestart = this.c(blockposition); + + if (structurestart != null && structurestart instanceof WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { + StructurePiece structurepiece = (StructurePiece) structurestart.a.getFirst(); @@ -4005,6 +5548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public List b() { + return this.f; + } ++ +} diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java new file mode 100644 @@ -4020,48 +5564,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public WorldGenPackedIce2() {} + -+ public boolean generate(World world, Random random, int i, int j, int k) { -+ while (world.isEmpty(i, j, k) && j > 2) { -+ --j; ++ public boolean generate(World world, Random random, BlockPosition blockposition) { ++ while (world.isEmpty(blockposition) && blockposition.getY() > 2) { ++ blockposition = blockposition.down(); + } + -+ if (world.getType(i, j, k) != Blocks.SNOW_BLOCK) { ++ if (world.getType(blockposition).getBlock() != Blocks.SNOW) { + return false; + } else { -+ j += random.nextInt(4); -+ int l = random.nextInt(4) + 7; -+ int i1 = l / 4 + random.nextInt(2); ++ blockposition = blockposition.up(random.nextInt(4)); ++ int i = random.nextInt(4) + 7; ++ int j = i / 4 + random.nextInt(2); + -+ if (i1 > 1 && random.nextInt(60) == 0) { -+ j += 10 + random.nextInt(30); ++ if (j > 1 && random.nextInt(60) == 0) { ++ blockposition = blockposition.up(10 + random.nextInt(30)); + } + -+ int j1; -+ int k1; -+ int l1; ++ int k; ++ int l; + -+ for (j1 = 0; j1 < l; ++j1) { -+ float f = (1.0F - (float) j1 / (float) l) * (float) i1; ++ for (k = 0; k < i; ++k) { ++ float f = (1.0F - (float) k / (float) i) * (float) j; + -+ k1 = MathHelper.f(f); ++ l = MathHelper.f(f); + -+ for (l1 = -k1; l1 <= k1; ++l1) { -+ float f1 = (float) MathHelper.a(l1) - 0.25F; ++ for (int i1 = -l; i1 <= l; ++i1) { ++ float f1 = (float) MathHelper.a(i1) - 0.25F; + -+ for (int i2 = -k1; i2 <= k1; ++i2) { -+ float f2 = (float) MathHelper.a(i2) - 0.25F; ++ for (int j1 = -l; j1 <= l; ++j1) { ++ float f2 = (float) MathHelper.a(j1) - 0.25F; + -+ if ((l1 == 0 && i2 == 0 || f1 * f1 + f2 * f2 <= f * f) && (l1 != -k1 && l1 != k1 && i2 != -k1 && i2 != k1 || random.nextFloat() <= 0.75F)) { -+ Block block = world.getType(i + l1, j + j1, k + i2); ++ if ((i1 == 0 && j1 == 0 || f1 * f1 + f2 * f2 <= f * f) && (i1 != -l && i1 != l && j1 != -l && j1 != l || random.nextFloat() <= 0.75F)) { ++ Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); + -+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -+ this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE); ++ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { ++ this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); + } + -+ if (j1 != 0 && k1 > 1) { -+ block = world.getType(i + l1, j - j1, k + i2); -+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -+ this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE); ++ if (k != 0 && l > 1) { ++ block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); ++ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { ++ this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); + } + } + } @@ -4069,41 +5612,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ j1 = i1 - 1; -+ if (j1 < 0) { -+ j1 = 0; -+ } else if (j1 > 1) { -+ j1 = 1; ++ k = j - 1; ++ if (k < 0) { ++ k = 0; ++ } else if (k > 1) { ++ k = 1; + } + -+ for (int j2 = -j1; j2 <= j1; ++j2) { -+ k1 = -j1; ++ for (int k1 = -k; k1 <= k; ++k1) { ++ l = -k; + -+ while (k1 <= j1) { -+ l1 = j - 1; -+ int k2 = 50; ++ while (l <= k) { ++ BlockPosition blockposition1 = blockposition.a(k1, -1, l); ++ int l1 = 50; + -+ if (Math.abs(j2) == 1 && Math.abs(k1) == 1) { -+ k2 = random.nextInt(5); ++ if (Math.abs(k1) == 1 && Math.abs(l) == 1) { ++ l1 = random.nextInt(5); + } + + while (true) { -+ if (l1 > 50) { -+ Block block1 = world.getType(i + j2, l1, k + k1); ++ if (blockposition1.getY() > 50) { ++ Block block1 = world.getType(blockposition1).getBlock(); + -+ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -+ this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE); ++ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { ++ this.a(world, blockposition1, Blocks.PACKED_ICE); ++ blockposition1 = blockposition1.down(); + --l1; -+ --k2; -+ if (k2 <= 0) { -+ l1 -= random.nextInt(5) + 1; -+ k2 = random.nextInt(5); ++ if (l1 <= 0) { ++ blockposition1 = blockposition1.down(random.nextInt(5) + 1); ++ l1 = random.nextInt(5); + } + continue; + } + } + -+ ++k1; ++ ++l; + break; + } + } @@ -4130,7 +5673,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldGenVillage extends StructureGenerator { + -+ public static final List e = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); ++ public static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); + private int f; + private int g; + private int h; @@ -4153,6 +5696,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); + } + } ++ + } + + public String a() { @@ -4173,14 +5717,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + int i1 = i / this.g; + int j1 = j / this.g; -+ Random random = this.c.A(i1, j1, 10387312); ++ Random random = this.c.a(i1, j1, 10387312); + + i1 *= this.g; + j1 *= this.g; + i1 += random.nextInt(this.g - this.h); + j1 += random.nextInt(this.g - this.h); + if (k == i1 && l == j1) { -+ boolean flag = this.c.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, e); ++ boolean flag = this.c.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.d); + + if (flag) { + return true; @@ -4193,6 +5737,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected StructureStart b(int i, int j) { + return new WorldGenVillageStart(this.c, this.b, i, j, this.f); + } ++ +} diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java new file mode 100644 diff --git a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch index 332d8405d7..2cf264dd71 100644 --- a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch +++ b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch @@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - - return getHandle().vehicle.getBukkitEntity(); + public boolean isCustomNameVisible() { + return getHandle().getCustomNameVisible(); } + + // Spigot start @@ -81,6 +81,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + return spigot; + } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +@@ -0,0 +0,0 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike + public EntityType getType() { + return EntityType.LIGHTNING; + } ++ ++ // Spigot start ++ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { ++ ++ }; ++ ++ @Override ++ public LightningStrike.Spigot spigot() { ++ return spigot; ++ } + // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -89,7 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } - collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); } + + // Spigot start @@ -122,6 +142,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + return spigot; + } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +@@ -0,0 +0,0 @@ final class CraftScore implements Score { + public CraftScoreboard getScoreboard() { + return objective.getScoreboard(); + } ++ ++ // Spigot start ++ @Override ++ public boolean isScoreSet() throws IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { + scoreboard.teams.remove(team.getName()); + setUnregistered(); + } ++ ++ // Spigot start ++ @Override ++ public Set getEntries() throws IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } + // Spigot end } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch index ebf3ce53de..494564a503 100644 --- a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch +++ b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch @@ -9,17 +9,17 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - } +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + } + // Spigot Start + public ServerConnection getServerConnection() + { -+ return this.p; ++ return this.q; + } + // Spigot End - public ServerConnection ai() { - return this.p; + public ServerConnection ao() { + return this.q; } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0005-Spigot-Configuration.patch b/CraftBukkit-Patches/0005-Spigot-Configuration.patch index 9961d50ca2..08a68675b2 100644 --- a/CraftBukkit-Patches/0005-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0005-Spigot-Configuration.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (this.L() < 0) { + if (this.Q() < 0) { this.setPort(this.propertyManager.getInt("server-port", 25565)); } + // Spigot start @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end - i.info("Generating keypair"); + DedicatedServer.LOGGER.info("Generating keypair"); this.a(MinecraftEncryption.b()); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return false; @@ -33,24 +33,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End if (!this.getOnlineMode()) { - i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public boolean pvpMode; - public boolean keepSpawnInMemory = true; - public ChunkGenerator generator; + public long ticksPerMonsterSpawns; + public boolean populating; + private int tickPosition; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public CraftWorld getWorld() { return this.world; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + } - // Changed signature - added gen and env - public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { -+ this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { ++ this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -59,8 +59,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); - updater.check(serverVersion); + chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold"); + loadIcon(); - loadPlugins(); - enablePlugins(PluginLoadOrder.STARTUP); @@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.SpigotConfig.init(); // Spigot for (WorldServer world : console.worlds) { - world.difficulty = difficulty; + world.worldData.setDifficulty(difficulty); world.setSpawnFlags(monsters, animals); @@ -0,0 +0,0 @@ public final class CraftServer implements Server { } else { @@ -158,8 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + commands = new HashMap(); + -+ version = getInt( "config-version", 7 ); -+ set( "config-version", 7 ); ++ version = getInt( "config-version", 8 ); ++ set( "config-version", 8 ); + readConfig( SpigotConfig.class, null ); + } + diff --git a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch index a4853a59c3..39e234543d 100644 --- a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch +++ b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch @@ -10,20 +10,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public - public boolean isStatic; - // CraftBukkit start - public, longhashset + public Scoreboard scoreboard = new Scoreboard(); + public final boolean isStatic; + // CraftBukkit - longhashset - protected LongHashSet chunkTickList = new LongHashSet(); + // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot private int K; public boolean allowMonsters; public boolean allowAnimals; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - private boolean M; - int[] I; - + public long ticksPerMonsterSpawns; + public boolean populating; + private int tickPosition; ++ + // Spigot start -+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList; ++ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected float growthOdds = 100; + protected float modifiedOdds = 100; + private final byte chunkTickRadius; @@ -31,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static long chunkToKey(int x, int z) + { + long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 ); -+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); ++ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); + return k; + } + @@ -46,16 +47,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end + - public BiomeBase getBiome(int i, int j) { - if (this.isLoaded(i, 0, j)) { - Chunk chunk = this.getChunkAtWorldCoords(i, j); + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + + public CraftWorld getWorld() { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit // CraftBukkit end + // Spigot start + this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); -+ this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); ++ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList.setAutoCompactionFactor( 0 ); + // Spigot end @@ -84,15 +85,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityhuman = (EntityHuman) this.players.get(i); j = MathHelper.floor(entityhuman.locX / 16.0D); k = MathHelper.floor(entityhuman.locZ / 16.0D); - l = this.p(); + l = this.q(); - for (int i1 = -l; i1 <= l; ++i1) { - for (int j1 = -l; j1 <= l; ++j1) { -- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); // CraftBukkit +- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); + // Spigot start - Always update the chunk the player is on + long key = chunkToKey( j, k ); + int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1 -+ chunkTickList.put(key, (short) (existingPlayers + 1)); ++ chunkTickList.put( key, (short) ( existingPlayers + 1 ) ); + + // Check and see if we update the chunks surrounding the player this tick + for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ ) @@ -100,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + long hash = chunkToKey( dx + j, dz + k ); -+ if ( !chunkTickList.contains( hash ) && this.isChunkLoaded( dx + j, dz + k ) ) ++ if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) ) + { + chunkTickList.put( hash, (short) -1 ); // no players } @@ -113,41 +114,53 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { - // CraftBukkit start - // Iterator iterator = this.chunkTickList.iterator(); +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + protected void h() { + super.h(); + if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { +- Iterator iterator = this.chunkTickList.iterator(); ++ // Spigot start ++ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator(); -- for (long chunkCoord : this.chunkTickList.popAll()) { -+ // Spigot start -+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) { -+ iter.advance(); -+ long chunkCoord = iter.key(); -+ int chunkX = World.keyToX(chunkCoord); -+ int chunkZ = World.keyToZ(chunkCoord); -+ // If unloaded, or in procedd of being unloaded, drop it -+ if ( ( !this.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) + while (iterator.hasNext()) { +- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); ++ iterator.advance(); ++ long chunkCoord = iterator.key(); + +- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false); ++ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false); ++ // Spigot end + } + + } else { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + // ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next(); + // int k = chunkcoordintpair1.x * 16; + // int l = chunkcoordintpair1.z * 16; +- for (long chunkCoord : chunkTickList.popAll()) { +- int chunkX = LongHash.msw(chunkCoord); +- int chunkZ = LongHash.lsw(chunkCoord); ++ // Spigot start ++ for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext(); ) + { -+ iter.remove(); -+ continue; -+ } -+ // Spigot end - // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); -- int chunkX = LongHash.msw(chunkCoord); -- int chunkZ = LongHash.lsw(chunkCoord); - int k = chunkX * 16; - int l = chunkZ * 16; ++ iter.advance(); ++ long chunkCoord = iter.key(); ++ int chunkX = World.keyToX( chunkCoord ); ++ int chunkZ = World.keyToZ( chunkCoord ); ++ // If unloaded, or in procedd of being unloaded, drop it ++ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) ++ { ++ iter.remove(); ++ continue; ++ } ++ // Spigot end ++ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); + int k = chunkX * 16; + int l = chunkZ * 16; + +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } -@@ -0,0 +0,0 @@ public class WorldServer extends World { - - if (block.isTicking()) { - ++i; -+ this.growthOdds = (iter.value() < 1) ? this.modifiedOdds : 100; // Spigot - grow fast if no players are in this chunk (value = player count) - block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random); - } - } -@@ -0,0 +0,0 @@ public class WorldServer extends World { - - this.methodProfiler.b(); } + // Spigot Start + if ( spigotConfig.clearChunksOnTick ) @@ -157,7 +170,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End } - public boolean a(int i, int j, int k, Block block) { + protected BlockPosition a(BlockPosition blockposition) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch index 612e6a6f55..a468c751ea 100644 --- a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch @@ -31,91 +31,90 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -0,0 +0,0 @@ public class BlockCactus extends Block { - if (l < 3) { - int i1 = world.getData(i, j, k); + if (i < 3) { + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); + +- if (j == 15) { ++ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + world.setTypeUpdate(blockposition1, this.getBlockData()); + IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0)); -- if (i1 == 15) { -+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot - CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit - world.setData(i, j, k, 0, 4); - this.doPhysics(world, i, j + 1, k, this); diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java @@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement - if (l < 7) { - float f = this.n(world, i, j, k); + if (i < 7) { + float f = a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot - ++l; - CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit - } +- // CraftBukkit start ++ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start + IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1)); + CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); + // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockGrass.java +++ b/src/main/java/net/minecraft/server/BlockGrass.java @@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { - } // CraftBukkit end - } else if (world.getLightLevel(i, j + 1, k) >= 9) { -- for (int l = 0; l < 4; ++l) { -+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot -+ for (int l = 0; l < numGrowth; ++l) { // Spigot - int i1 = i + random.nextInt(3) - 1; - int j1 = j + random.nextInt(5) - 3; - int k1 = k + random.nextInt(3) - 1; + } else { + if (world.getLightLevel(blockposition.up()) >= 9) { +- for (int i = 0; i < 4; ++i) { ++ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot + BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + Block block = world.getType(blockposition1.up()).getBlock(); + IBlockData iblockdata1 = world.getType(blockposition1); diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java @@ -0,0 +0,0 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme - public void a(World world, int i, int j, int k, Random random) { - final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit - if (random.nextInt(25) == 0) { -+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot - byte b0 = 4; - int l = 5; - ++ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5; + int i = 5; + boolean flag = true; + Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator(); diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockMycel.java +++ b/src/main/java/net/minecraft/server/BlockMycel.java @@ -0,0 +0,0 @@ public class BlockMycel extends Block { - } // CraftBukkit end - } else if (world.getLightLevel(i, j + 1, k) >= 9) { -- for (int l = 0; l < 4; ++l) { -+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot -+ for (int l = 0; l < numGrowth; ++l) { // Spigot - int i1 = i + random.nextInt(3) - 1; - int j1 = j + random.nextInt(5) - 3; - int k1 = k + random.nextInt(3) - 1; + } else { + if (world.getLightLevel(blockposition.up()) >= 9) { +- for (int i = 0; i < 4; ++i) { ++ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot + BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + IBlockData iblockdata1 = world.getType(blockposition1); + Block block = world.getType(blockposition1.up()).getBlock(); diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java @@ -0,0 +0,0 @@ public class BlockReed extends Block { - if (l < 3) { - int i1 = world.getData(i, j, k); + if (i < 3) { + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); -- if (i1 == 15) { -+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit - world.setData(i, j, k, 0, 4); - } else { +- if (j == 15) { ++ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot + // CraftBukkit start + // world.setTypeUpdate(blockposition.up(), this.getBlockData()); + // world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(0)), 4); diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen - public void a(World world, int i, int j, int k, Random random) { + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { if (!world.isStatic) { - super.a(world, i, j, k, random); -- if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) { -+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot + super.b(world, blockposition, iblockdata, random); +- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { ++ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) { // CraftBukkit start world.captureTreeGeneration = true; // CraftBukkit end @@ -124,14 +123,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java @@ -0,0 +0,0 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { - if (world.getLightLevel(i, j + 1, k) >= 9) { - float f = this.n(world, i, j, k); + if (world.getLightLevel(blockposition.up()) >= 9) { + float f = BlockCrops.a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { + if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot - int l = world.getData(i, j, k); + int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue(); - if (l < 7) { + if (i < 7) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch index 726e4c609e..4117ca95ad 100644 --- a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch +++ b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch @@ -10,13 +10,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { -+ private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); // Spigot private static final Logger a = LogManager.getLogger(); - private List b = new ArrayList(); - private Set c = new HashSet(); +- private List b = Lists.newArrayList(); +- private Set c = Sets.newHashSet(); ++ // Spigot start ++ private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); ++ // private List b = Lists.newArrayList(); ++ // private Set c = Sets.newHashSet(); ++ // Spigot end + private Object d = new Object(); + private final File e; + @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); @@ -71,11 +77,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) { + return; } -- + - this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - this.c.add(chunkcoordintpair); ++ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); ++ // this.c.add(chunkcoordintpair); + // Spigot end - FileIOThread.a.a(this); + FileIOThread.a().a(this); } } @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { diff --git a/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch index 409d18efc8..e0a72c3ebf 100644 --- a/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch +++ b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch @@ -12,34 +12,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityItem extends Entity { } - private void k() { -- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator(); + private void w() { +- Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator(); + // Spigot start + double radius = world.spigotConfig.itemMerge; -+ Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(radius, radius, radius)).iterator(); ++ Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator(); + // Spigot end while (iterator.hasNext()) { EntityItem entityitem = (EntityItem) iterator.next(); @@ -0,0 +0,0 @@ public class EntityItem extends Entity { - } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { - return false; - } else { -- itemstack1.count += itemstack.count; -- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -- entityitem.age = Math.min(entityitem.age, this.age); -- entityitem.setItemStack(itemstack1); -- this.die(); -+ // Spigot start -+ itemstack.count += itemstack1.count; -+ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -+ this.age = Math.min(entityitem.age, this.age); -+ this.setItemStack(itemstack); -+ entityitem.die(); -+ // Spigot end - return true; - } - } else { + } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { + return false; + } else { +- itemstack1.count += itemstack.count; +- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); +- entityitem.age = Math.min(entityitem.age, this.age); +- entityitem.setItemStack(itemstack1); +- this.die(); ++ // Spigot start ++ itemstack.count += itemstack1.count; ++ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); ++ this.age = Math.min(entityitem.age, this.age); ++ this.setItemStack(itemstack); ++ entityitem.die(); ++ // Spigot end + return true; + } + } else { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + EntityExperienceOrb xp = (EntityExperienceOrb) entity; + double radius = spigotConfig.expMerge; + if (radius > 0) { -+ List entities = this.getEntities(entity, entity.boundingBox.grow(radius, radius, radius)); ++ List entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius)); + for (Entity e : entities) { + if (e instanceof EntityExperienceOrb) { + EntityExperienceOrb loopItem = (EntityExperienceOrb) e; diff --git a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch similarity index 90% rename from CraftBukkit-Patches/0011-Async-Operation-Catching.patch rename to CraftBukkit-Patches/0010-Async-Operation-Catching.patch index 75c6efbbc6..56234e2efe 100644 --- a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch @@ -13,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return 10; } -- public void onPlace(World world, int i, int j, int k) {} -+ public void onPlace(World world, int i, int j, int k) { +- public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {} ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot + } -- public void remove(World world, int i, int j, int k, Block block, int l) {} -+ public void remove(World world, int i, int j, int k, Block block, int l) { +- public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {} ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { + org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot + } @@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void updatePlayer(EntityPlayer entityplayer) { + org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot if (entityplayer != this.tracker) { - double d0 = entityplayer.locX - (double) (this.xLoc / 32); - double d1 = entityplayer.locZ - (double) (this.zLoc / 32); + if (this.c(entityplayer)) { + if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { @@ -0,0 +0,0 @@ public class EntityTrackerEntry { } @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot if (entity == null) return false; // CraftBukkit end - + int i = MathHelper.floor(entity.locX / 16.0D); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } @@ -88,11 +88,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } - public void a(List list) { + public void b(Collection collection) { + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot // CraftBukkit start - // this.entityList.addAll(list); - Entity entity = null; + // this.entityList.addAll(collection); + Iterator iterator = collection.iterator(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch deleted file mode 100644 index 75487b6803..0000000000 --- a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 17:13:47 +1000 -Subject: [PATCH] LongHash Tweaks - -Tweaks the LongHash algorithm and provides a large array based map to look up values centered around the origin, ie the access normally seen on a Minecraft server. - -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -@@ -0,0 +0,0 @@ public class LongHash { - } - - public static int lsw(long l) { -- return (int) (l & 0xFFFFFFFF) + Integer.MIN_VALUE; -+ return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant & - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -@@ -0,0 +0,0 @@ public class LongHashSet { - private int elements; - private long[] values; - private int modCount; -+ private org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongHashSet() { - this(INITIAL_SIZE); -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public boolean contains(int msw, int lsw) { -+ // Spigot start -+ if ( elements == 0 ) -+ { -+ return false; -+ } -+ if ( flat.contains( msw, lsw ) ) -+ { -+ return true; -+ } -+ // Spigot end - return contains(LongHash.toLong(msw, lsw)); - } - - public boolean contains(long value) { -+ // Spigot start -+ if ( elements == 0 ) -+ { -+ return false; -+ } -+ if ( flat.contains( value ) ) -+ { -+ return true; -+ } -+ // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public boolean add(long value) { -+ flat.put( value, Boolean.TRUE ); // Spigot - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public void remove(int msw, int lsw) { -- remove(LongHash.toLong(msw, lsw)); -+ // Spigot start -+ flat.remove(msw, lsw); -+ remove0(LongHash.toLong(msw, lsw)); - } - - public boolean remove(long value) { -+ flat.remove(value); -+ return remove0(value); -+ } -+ -+ private boolean remove0(long value) { -+ // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - - freeEntries = values.length; - modCount++; -+ flat = new org.spigotmc.FlatMap(); - } - - public long[] toArray() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - private transient V[][] values; - private transient int modCount; - private transient int size; -+ private transient org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongObjectHashMap() { - initialize(); -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V get(long key) { -+ // Spigot start -+ if ( size == 0 ) -+ { -+ return null; -+ } -+ V val = flat.get( key ); -+ if ( val != null ) -+ { -+ return val; -+ } -+ // Spigot end - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) return null; -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V put(long key, V value) { -+ flat.put(key, value); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] innerKeys = keys[index]; - V[] innerValues = values[index]; -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V remove(long key) { -+ flat.remove(key); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) { -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - size = 0; - Arrays.fill(keys, null); - Arrays.fill(values, null); -+ flat = new org.spigotmc.FlatMap(); - } - - public Set keySet() { -diff --git a/src/main/java/org/spigotmc/FlatMap.java b/src/main/java/org/spigotmc/FlatMap.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/FlatMap.java -@@ -0,0 +0,0 @@ -+package org.spigotmc; -+ -+import org.bukkit.craftbukkit.util.LongHash; -+ -+public class FlatMap -+{ -+ -+ private static final int FLAT_LOOKUP_SIZE = 512; -+ private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ]; -+ -+ public void put(long msw, long lsw, V value) -+ { -+ long acx = Math.abs( msw ); -+ long acz = Math.abs( lsw ); -+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -+ { -+ flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value; -+ } -+ } -+ -+ public void put(long key, V value) -+ { -+ put( LongHash.msw( key ), LongHash.lsw( key ), value ); -+ -+ } -+ -+ public void remove(long key) -+ { -+ put( key, null ); -+ } -+ -+ public void remove(long msw, long lsw) -+ { -+ put( msw, lsw, null ); -+ } -+ -+ public boolean contains(long msw, long lsw) -+ { -+ return get( msw, lsw ) != null; -+ } -+ -+ public boolean contains(long key) -+ { -+ return get( key ) != null; -+ } -+ -+ public V get(long msw, long lsw) -+ { -+ long acx = Math.abs( msw ); -+ long acz = Math.abs( lsw ); -+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -+ { -+ return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )]; -+ } else -+ { -+ return null; -+ } -+ } -+ -+ public V get(long key) -+ { -+ return get( LongHash.msw( key ), LongHash.lsw( key ) ); -+ } -+} --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0012-View-Distance.patch b/CraftBukkit-Patches/0011-View-Distance.patch similarity index 90% rename from CraftBukkit-Patches/0012-View-Distance.patch rename to CraftBukkit-Patches/0011-View-Distance.patch index 1eb8acd57f..7c53455f20 100644 --- a/CraftBukkit-Patches/0012-View-Distance.patch +++ b/CraftBukkit-Patches/0011-View-Distance.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public PlayerChunkMap(WorldServer worldserver) { + public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { this.world = worldserver; -- this.a(worldserver.getMinecraftServer().getPlayerList().s()); +- this.a(worldserver.getMinecraftServer().getPlayerList().t()); + this.a(viewDistance); // Spigot } @@ -25,15 +25,15 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { // CraftBukkit end this.server = minecraftserver; this.tracker = new EntityTracker(this); - this.manager = new PlayerChunkMap(this); + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot - if (this.entitiesById == null) { - this.entitiesById = new IntHashMap(); - } + this.worldProvider.a(this); + this.chunkProvider = this.k(); + this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0013-Spigot-Timings.patch b/CraftBukkit-Patches/0012-Spigot-Timings.patch similarity index 88% rename from CraftBukkit-Patches/0013-Spigot-Timings.patch rename to CraftBukkit-Patches/0012-Spigot-Timings.patch index 04f593699c..12d3de7e82 100644 --- a/CraftBukkit-Patches/0013-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0012-Spigot-Timings.patch @@ -14,23 +14,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { + world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot - if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { - ichunkprovider.getChunkAt(ichunkprovider1, i, j); - } + boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); + boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); + boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); @@ -0,0 +0,0 @@ public class Chunk { - if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) { - ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); + } } + + world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot } - public int d(int i, int j) { + public BlockPosition h(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - boolean newChunk = false; + // CraftBukkit end if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot @@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (chunk == null) { if (this.chunkProvider == null) { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - } // CraftBukkit end + chunk.loadNearby(this, this, i, j); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot } @@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return chunk; @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { if (chunk != null) { - chunk.lastSaved = this.world.getTime(); + chunk.setLastSaved(this.world.getTime()); if (this.chunkProvider != null) { + world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot - this.chunkProvider.recreateStructures(i, j); + this.chunkProvider.recreateStructures(chunk, i, j); + world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot } } @@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - Add async variant, provide compatibility public Chunk a(World world, int i, int j) { + world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot - Object[] data = this.loadChunk(world, i, j); + Object[] data = loadChunk(world, i, j); + world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot if (data != null) { Chunk chunk = (Chunk) data[0]; @@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot - // return chunk; // CraftBukkit + // return chunk; // CraftBukkit } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -119,19 +119,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - public void aB() { + public void aM() { + SpigotTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.j.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.j.remove(0); + while (!this.k.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.k.remove(0); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - this.server.dispatchServerCommand(this.console, servercommand); // CraftBukkit end } + + SpigotTimings.serverCommandTimer.stopTiming(); // Spigot } - public boolean X() { + public boolean ad() { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java @@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.painting.PaintingBreakByEntityEvent; -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only @@ -153,22 +153,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int getId() { return this.id; } -@@ -0,0 +0,0 @@ public abstract class Entity { - return; - } - // CraftBukkit end +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + } + + public void move(double d0, double d1, double d2) { + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.X) { - this.boundingBox.d(d0, d1, d2); - this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; -@@ -0,0 +0,0 @@ public abstract class Entity { ++ + if (this.T) { + this.a(this.getBoundingBox().c(d0, d1, d2)); + this.recalcPosition(); +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { this.world.methodProfiler.b(); } + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected String H() { + private void recalcPosition() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java @@ -181,21 +182,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public abstract class EntityLiving extends Entity { - private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); + private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - public void h() { + public void s_() { + SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.h(); + super.s_(); if (!this.world.isStatic) { - int i = this.aZ(); + int i = this.bu(); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.e(); + this.m(); + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; @@ -203,39 +204,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); - this.aX += f2; + this.aR += f2; + SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } - protected float f(float f, float f1) { + protected float h(float f, float f1) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); + SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bh()) { - this.bc = false; - this.bd = 0.0F; + if (this.bC()) { + this.aW = false; + this.aX = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.aO = this.yaw; - } + this.doTick(); + this.world.methodProfiler.b(); } + SpigotTimings.timerEntityAI.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.bd *= 0.98F; - this.be *= 0.98F; - this.bf *= 0.9F; + this.aX *= 0.98F; + this.aY *= 0.98F; + this.aZ *= 0.9F; + SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.e(this.bd, this.be); + this.g(this.aX, this.aY); + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); if (!this.world.isStatic) { + SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.bo(); + this.bK(); + SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot } @@ -244,36 +245,36 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ import jline.console.ConsoleReader; - import joptsimple.OptionSet; +@@ -0,0 +0,0 @@ import joptsimple.OptionSet; + import org.bukkit.craftbukkit.Main; import org.bukkit.World.Environment; +import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.world.WorldSaveEvent; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - protected void t() {} +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + protected void x() {} - protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws + protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws + SpigotTimings.serverTickTimer.startTiming(); // Spigot long i = System.nanoTime(); ++this.ticks; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } - if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit + if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit + SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.u.savePlayers(); + this.v.savePlayers(); this.saveChunks(true); this.methodProfiler.b(); + SpigotTimings.worldSaveTimer.stopTiming(); // Spigot } this.methodProfiler.a("tallying"); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.b(); @@ -281,8 +282,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.CustomTimingsHandler.tick(); // Spigot } - public void v() { - this.methodProfiler.a("levels"); + public void z() { +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + + this.methodProfiler.c("levels"); + SpigotTimings.schedulerTimer.startTiming(); // Spigot // CraftBukkit start @@ -304,7 +307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time } } @@ -312,27 +315,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs CrashReport crashreport; try { + worldserver.timings.doTick.startTiming(); // Spigot worldserver.doTick(); + worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { - crashreport = CrashReport.a(throwable, "Exception ticking world"); + } catch (Throwable throwable1) { + crashreport = CrashReport.a(throwable1, "Exception ticking world"); worldserver.a(crashreport); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } try { + worldserver.timings.tickEntities.startTiming(); // Spigot worldserver.tickEntities(); + worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); + } catch (Throwable throwable2) { + crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); worldserver.a(crashreport); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.a("tracker"); @@ -342,22 +345,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.b(); this.methodProfiler.b(); // } // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } this.methodProfiler.c("connection"); + SpigotTimings.connectionTimer.startTiming(); // Spigot - this.ai().c(); + this.ao().c(); + SpigotTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); + SpigotTimings.playerListTimer.startTiming(); // Spigot - this.u.tick(); + this.v.tick(); + SpigotTimings.playerListTimer.stopTiming(); // Spigot this.methodProfiler.c("tickables"); + SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.n.size(); ++i) { - ((IUpdatePlayerListBox) this.n.get(i)).a(); + for (i = 0; i < this.o.size(); ++i) { + ((IUpdatePlayerListBox) this.o.get(i)).c(); } + SpigotTimings.tickablesTimer.stopTiming(); // Spigot @@ -367,16 +370,16 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end private void handleCommand(String s) { + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot + - // CraftBukkit start - whole method + // CraftBukkit start - whole method this.c.info(this.player.getName() + " issued server command: " + s); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -396,7 +399,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - //this.minecraftServer.getCommandHandler().a(this.player, s); + // this.minecraftServer.getCommandHandler().a(this.player, s); // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java @@ -410,12 +413,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.spigotmc.CustomTimingsHandler; // Spigot import org.bukkit.inventory.InventoryHolder; // CraftBukkit - public class TileEntity { + public abstract class TileEntity { + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot private static final Logger a = LogManager.getLogger(); - private static Map i = new HashMap(); - private static Map j = new HashMap(); + private static Map f = Maps.newHashMap(); + private static Map g = Maps.newHashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java @@ -429,7 +432,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public ChunkGenerator generator; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + public final SpigotTimings.WorldTimingsHandler timings; // Spigot @@ -438,15 +441,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.world; } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.M = worldprovider.getWorldBorder(); - this.worldProvider.a(this); - this.chunkProvider = this.j(); + this.getServer().addWorld(this.world); // CraftBukkit + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - if (!this.worldData.isInitialized()) { - try { - this.a(worldsettings); + } + + public World b() { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.f.clear(); + this.g.clear(); this.methodProfiler.c("regular"); + timings.entityTick.startTiming(); // Spigot @@ -458,7 +461,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!entity.dead) { try { + SpigotTimings.tickEntityTimer.startTiming(); // Spigot - this.playerJoinedWorld(entity); + this.g(entity); + SpigotTimings.tickEntityTimer.stopTiming(); // Spigot } catch (Throwable throwable1) { crashreport = CrashReport.a(throwable1, "Ticking entity"); @@ -470,28 +473,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.entityTick.stopTiming(); // Spigot this.methodProfiler.c("blockEntities"); + timings.tileEntityTick.startTiming(); // Spigot - this.M = true; + this.L = true; // CraftBukkit start - From below, clean up tile entities before ticking them if (!this.b.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { - try { -+ tileentity.tickTimer.startTiming(); // Spigot - tileentity.h(); -+ tileentity.tickTimer.stopTiming(); // Spigot - } catch (Throwable throwable2) { -+ tileentity.tickTimer.stopTiming(); // Spigot - crashreport = CrashReport.a(throwable2, "Ticking block entity"); - crashreportsystemdetails = crashreport.a("Block entity being ticked"); - tileentity.a(crashreportsystemdetails); + if (this.isLoaded(blockposition) && this.M.a(blockposition)) { + try { ++ tileentity.tickTimer.startTiming(); // Spigot + ((IUpdatePlayerListBox) tileentity).c(); + } catch (Throwable throwable2) { + CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + tileentity.a(crashreportsystemdetails1); + throw new ReportedException(crashreport1); + } ++ // Spigot start ++ finally { ++ tileentity.tickTimer.stopTiming(); ++ } ++ // Spigot end + } + } + @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { } } + timings.tileEntityTick.stopTiming(); // Spigot + timings.tileEntityPending.startTiming(); // Spigot - this.M = false; + this.L = false; /* CraftBukkit start - Moved up if (!this.b.isEmpty()) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { @@ -505,15 +516,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { // CraftBukkit start - Use neighbor cache instead of looking up Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); - if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.S = entity.locX; - entity.T = entity.locY; + entity.P = entity.locX; + entity.Q = entity.locY; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - entity.passenger = null; } } + + entity.tickTimer.stopTiming(); // Spigot } } @@ -522,12 +533,12 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals long time = this.worldData.getTime(); - if (this.getGameRules().getBoolean("doMobSpawning") && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { + if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { + timings.mobSpawn.startTiming(); // Spigot - this.R.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + this.R.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + timings.mobSpawn.stopTiming(); // Spigot // CraftBukkit end } @@ -537,7 +548,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.c("chunkSource"); this.chunkProvider.unloadChunks(); int j = this.a(1.0F); -@@ -0,0 +0,0 @@ public class WorldServer extends World { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { this.worldData.setDayTime(this.worldData.getDayTime() + 1L); } @@ -548,7 +559,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.doTickPending.stopTiming(); // Spigot this.methodProfiler.c("tickBlocks"); + timings.doTickTiles.startTiming(); // Spigot - this.g(); + this.h(); + timings.doTickTiles.stopTiming(); // Spigot this.methodProfiler.c("chunkMap"); + timings.doChunkMap.startTiming(); // Spigot @@ -565,15 +576,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.doPortalForcer.stopTiming(); // Spigot this.methodProfiler.b(); + timings.doSounds.startTiming(); // Spigot - this.Z(); -+ timings.doSounds.stopTiming(); // Spigot - -+ timings.doChunkGC.startTiming(); // Spigot + this.ak(); + this.getWorld().processChunkGC(); // CraftBukkit + timings.doChunkGC.stopTiming(); // Spigot } - public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { + public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -791,7 +800,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (queuedChunk.provider.chunkProvider != null) { + queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot - queuedChunk.provider.chunkProvider.recreateStructures(queuedChunk.x, queuedChunk.z); + queuedChunk.provider.chunkProvider.recreateStructures(chunk, queuedChunk.x, queuedChunk.z); + queuedChunk.provider.world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot } diff --git a/CraftBukkit-Patches/0014-Fix-Mob-Spawning-Relative-to-View-Distance.patch b/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch similarity index 60% rename from CraftBukkit-Patches/0014-Fix-Mob-Spawning-Relative-to-View-Distance.patch rename to CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch index 49d6c3be6c..7fe8b2be81 100644 --- a/CraftBukkit-Patches/0014-Fix-Mob-Spawning-Relative-to-View-Distance.patch +++ b/CraftBukkit-Patches/0013-Fix-Mob-Spawning-Relative-to-View-Distance.patch @@ -12,16 +12,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - public int r; - public long s; - private int x; -+ protected net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap entityCount = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap(); // Spigot + private long u; + private int v; + private ConcurrentLinkedQueue w; ++ protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking private int neighbors = 0x1 << 12; @@ -0,0 +0,0 @@ public class Chunk { - entity.ai = k; - entity.aj = this.locZ; + entity.af = k; + entity.ag = this.locZ; this.entitySlices[k].add(entity); + // Spigot start - increment creature type count + // Keep this synced up with World.a(Class) @@ -64,24 +64,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end } - public boolean d(int i, int j, int k) { + public boolean d(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { - return new ChunkPosition(k, i1, l); - } + + public SpawnerCreature() {} + // Spigot start - get entity count only from chunks being processed in b + private int getEntityCount(WorldServer server, Class oClass) + { + int i = 0; -+ for ( Long coord : this.a.keySet() ) ++ Iterator it = this.b.iterator(); ++ while ( it.hasNext() ) + { ++ Long coord = it.next(); + int x = LongHash.msw( coord ); + int z = LongHash.lsw( coord ); -+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z ) ) ++ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) + { + i += server.getChunkAt( x, z ).entityCount.get( oClass ); + } @@ -90,53 +92,57 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end + - public int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { + public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { if (!flag && !flag1) { return 0; @@ -0,0 +0,0 @@ public final class SpawnerCreature { - j = MathHelper.floor(entityhuman.locZ / 16.0D); - byte b0 = 8; -+ // Spigot Start -+ b0 = worldserver.spigotConfig.mobSpawnRange; -+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; -+ b0 = ( b0 > 8 ) ? 8 : b0; -+ // Spigot End + j = MathHelper.floor(entityhuman.locZ / 16.0D); + byte b0 = 8; ++ // Spigot Start ++ b0 = worldserver.spigotConfig.mobSpawnRange; ++ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; ++ b0 = ( b0 > 8 ) ? 8 : b0; ++ // Spigot End - for (int l = -b0; l <= b0; ++l) { for (int i1 = -b0; i1 <= b0; ++i1) { + for (k = -b0; k <= b0; ++k) { @@ -0,0 +0,0 @@ public final class SpawnerCreature { if (limit == 0) { continue; } -+ int mobcnt = 0; ++ int mobcnt = 0; // Spigot // CraftBukkit end -- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * this.a.size() / 256) { // CraftBukkit - use per-world limits -+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * this.a.size() / 256) { // Spigot - use per-world limits and use all loaded chunks - Iterator iterator = this.a.keySet().iterator(); + if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) { + k = worldserver.a(enumcreaturetype.a()); + int l1 = limit * i / a; // CraftBukkit - use per-world limits -+ int moblimit = (limit * this.a.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit - label110: -- while (iterator.hasNext()) { -+ while (iterator.hasNext() && (moblimit > 0)) { // Spigot - while more allowed - // CraftBukkit start = use LongHash and LongObjectHashMap - long key = ((Long) iterator.next()).longValue(); +- if (k <= l1) { ++ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { + Iterator iterator1 = this.b.iterator(); ++ int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit + label115: +- while (iterator1.hasNext()) { ++ while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed + // CraftBukkit start = use LongHash and LongObjectHashMap + long key = ((Long) iterator1.next()).longValue(); + BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key)); @@ -0,0 +0,0 @@ public final class SpawnerCreature { - groupdataentity = entityinsentient.prepare(groupdataentity); - worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); - // CraftBukkit end -+ // Spigot start -+ if ( --moblimit <= 0 ) -+ { -+ // If we're past limit, stop spawn -+ continue label110; -+ } -+ // Spigot end - if (j2 >= entityinsentient.bB()) { - continue label110; - } + worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature + } + ++ // Spigot start ++ if ( --moblimit <= 0 ) ++ { ++ // If we're past limit, stop spawn ++ continue label115; ++ } ++ // Spigot end + if (l2 >= entityinsentient.bU()) { + continue label115; + } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch b/CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch similarity index 87% rename from CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch rename to CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch index 037cd11b0d..d29a7caba2 100644 --- a/CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch +++ b/CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch @@ -20,6 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end - if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { - try { + if (!tileentity.x() && tileentity.t()) { + BlockPosition blockposition = tileentity.getPosition(); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0016-Entity-Activation-Range.patch b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch similarity index 89% rename from CraftBukkit-Patches/0016-Entity-Activation-Range.patch rename to CraftBukkit-Patches/0015-Entity-Activation-Range.patch index 0797e06913..5b13c2d744 100644 --- a/CraftBukkit-Patches/0016-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch @@ -12,16 +12,16 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public int ticksLived; public int maxFireTicks; - public int fireTicks; // CraftBukkit - private -> public + public int fireTicks; - protected boolean inWater; + public boolean inWater; // Spigot - protected -> public public int noDamageTicks; - private boolean justCreated; + protected boolean justCreated; protected boolean fireProof; -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only @@ -35,10 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int getId() { return this.id; -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { this.setPosition(0.0D, 0.0D, 0.0D); if (world != null) { - this.dimension = world.worldProvider.dimension; + this.dimension = world.worldProvider.getDimension(); + // Spigot start + this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig); + } else { @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java @@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature { - private float bq; + private float bl; public boolean ageLocked = false; // CraftBukkit + // Spigot start @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Entity shooter; @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { private double damage = 2.0D; - public int knockbackStrength; // CraftBukkit - private -> public + public int knockbackStrength; + // Spigot Start + @Override @@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + if ( this.inGround ) + { -+ this.at += 19; // Despawn counter. First int after shooter ++ this.ap += 19; // Despawn counter. First int after shooter + } + super.inactiveTick(); + } @@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -0,0 +0,0 @@ public class EntityFireworks extends Entity { private int ticksFlown; - public int expectedLifespan; // CraftBukkit - private -> public + public int expectedLifespan; + // Spigot Start + @Override @@ -148,18 +148,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void inactiveTick() + { + super.inactiveTick(); -+ ++this.aU; // Above all the floats ++ ++this.aT; // Above all the floats + } + // Spigot end - public EntityLiving(World world) { - super(world); + public void G() { + this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.f.clear(); + this.g.clear(); this.methodProfiler.c("regular"); + org.spigotmc.ActivationRange.activateEntities(this); // Spigot @@ -172,7 +172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - // CraftBukkit start - Use neighbor cache instead of looking up - Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); -- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { +- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + // Spigot start + if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { + entity.ticksLived++; @@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.S = entity.locX; + entity.P = entity.locX; diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -205,6 +205,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.util.ArrayList; +import java.util.List; ++import java.util.Set; +import net.minecraft.server.AxisAlignedBB; +import net.minecraft.server.Chunk; +import net.minecraft.server.Entity; @@ -222,6 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.EntityMonster; +import net.minecraft.server.EntityProjectile; +import net.minecraft.server.EntitySheep; ++import net.minecraft.server.EntitySlice; +import net.minecraft.server.EntitySlime; +import net.minecraft.server.EntityTNTPrimed; +import net.minecraft.server.EntityVillager; @@ -291,26 +293,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + /** -+ * Utility method to grow an AABB without creating a new AABB or touching -+ * the pool, so we can re-use ones we have. -+ * -+ * @param target -+ * @param source -+ * @param x -+ * @param y -+ * @param z -+ */ -+ public static void growBB(AxisAlignedBB target, AxisAlignedBB source, int x, int y, int z) -+ { -+ target.a = source.a - x; -+ target.b = source.b - y; -+ target.c = source.c - z; -+ target.d = source.d + x; -+ target.e = source.e + y; -+ target.f = source.f + z; -+ } -+ -+ /** + * Find what entities are in range of the players in the world and set + * active if in range. + * @@ -331,10 +313,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + + player.activatedTick = MinecraftServer.currentTick; -+ growBB( maxBB, player.boundingBox, maxRange, 256, maxRange ); -+ growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange ); -+ growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange ); -+ growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange ); ++ maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange ); ++ miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange ); ++ animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); ++ monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); + + int i = MathHelper.floor( maxBB.a / 16.0D ); + int j = MathHelper.floor( maxBB.d / 16.0D ); @@ -362,9 +344,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + private static void activateChunkEntities(Chunk chunk) + { -+ for ( List slice : chunk.entitySlices ) ++ for ( EntitySlice slice : chunk.entitySlices ) + { -+ for ( Entity entity : slice ) ++ for ( Entity entity : (Set) slice ) + { + if ( MinecraftServer.currentTick > entity.activatedTick ) + { @@ -376,20 +358,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + switch ( entity.activationType ) + { + case 1: -+ if ( monsterBB.b( entity.boundingBox ) ) ++ if ( monsterBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } + break; + case 2: -+ if ( animalBB.b( entity.boundingBox ) ) ++ if ( animalBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } + break; + case 3: + default: -+ if ( miscBB.b( entity.boundingBox ) ) ++ if ( miscBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } @@ -428,15 +410,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( entity instanceof EntityLiving ) + { + EntityLiving living = (EntityLiving) entity; -+ if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) ++ if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 ) + { + return true; + } -+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null ) ++ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null ) + { + return true; + } -+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bY() /* Getter for first boolean */ ) ++ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ ) + { + return true; + } diff --git a/CraftBukkit-Patches/0017-Metrics.patch b/CraftBukkit-Patches/0016-Metrics.patch similarity index 100% rename from CraftBukkit-Patches/0017-Metrics.patch rename to CraftBukkit-Patches/0016-Metrics.patch diff --git a/CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch similarity index 87% rename from CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch rename to CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch index 553a2b7ffa..150cd640d7 100644 --- a/CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch +++ b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch @@ -9,17 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { - return this.item.getMaxDurability(); } -+ // Spigot start public boolean isDamaged(int i, Random random) { + return isDamaged(i, random, null); + } + + public boolean isDamaged(int i, Random random, EntityLiving entityliving) { + // Spigot end - if (!this.g()) { + if (!this.e()) { return false; } else { @@ -0,0 +0,0 @@ public final class ItemStack { @@ -43,10 +41,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class ItemStack { public void damage(int i, EntityLiving entityliving) { if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) { - if (this.g()) { -- if (this.isDamaged(i, entityliving.aI())) { -+ if (this.isDamaged(i, entityliving.aI(), entityliving)) { // Spigot - entityliving.a(this); + if (this.e()) { +- if (this.isDamaged(i, entityliving.bb())) { ++ if (this.isDamaged(i, entityliving.bb(), entityliving)) { // Spigot + entityliving.b(this); --this.count; if (entityliving instanceof EntityHuman) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch b/CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch similarity index 72% rename from CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch rename to CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch index 2224c7b054..4cab28f535 100644 --- a/CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch +++ b/CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch @@ -20,15 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end lines = new String[sign.lines.length]; - System.arraycopy(sign.lines, 0, lines, 0, lines.length); + System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length); } -@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockState implements Sign { - public boolean update(boolean force, boolean applyPhysics) { - boolean result = super.update(force, applyPhysics); - -- if (result) { -+ if (result && sign != null) { // Spigot, add null check - sign.lines = sanitizeLines(lines); - sign.update(); - } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0021-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch similarity index 100% rename from CraftBukkit-Patches/0021-Entity-Tracking-Ranges.patch rename to CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch diff --git a/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch b/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch deleted file mode 100644 index dd5fbdb643..0000000000 --- a/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 17 Mar 2013 19:02:50 +1100 -Subject: [PATCH] Faster UUID for entities - -It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { - this.random = new Random(); - this.maxFireTicks = 1; - this.justCreated = true; -- this.uniqueID = UUID.randomUUID(); -+ this.uniqueID = new UUID(random.nextLong(), random.nextLong()); // Spigot - this.as = EnumEntitySize.SIZE_2; - this.world = world; - this.setPosition(0.0D, 0.0D, 0.0D); --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0023-Thread-Naming-and-Tweaks.patch b/CraftBukkit-Patches/0020-Thread-Naming-and-Tweaks.patch similarity index 100% rename from CraftBukkit-Patches/0023-Thread-Naming-and-Tweaks.patch rename to CraftBukkit-Patches/0020-Thread-Naming-and-Tweaks.patch diff --git a/CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch similarity index 77% rename from CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch rename to CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch index 72f5fcff5b..1b1fe4e60e 100644 --- a/CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch +++ b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch @@ -12,28 +12,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class RegionFileCache { -- private static final Map a = new HashMap(); -+ public static final Map a = new HashMap(); // CraftBukkit - private -> public +- private static final Map a = Maps.newHashMap(); ++ public static final Map a = Maps.newHashMap(); // Spigot - private -> public - public static synchronized RegionFile a(File file1, int i, int j) { - File file2 = new File(file1, "region"); + public static synchronized RegionFile a(File file, int i, int j) { + File file1 = new File(file, "region"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MobEffectList; - import net.minecraft.server.PropertyManager; - import net.minecraft.server.ServerCommand; -+import net.minecraft.server.RegionFile; -+import net.minecraft.server.RegionFileCache; - import net.minecraft.server.ServerNBTManager; - import net.minecraft.server.WorldLoaderServer; - import net.minecraft.server.WorldManager; @@ -0,0 +0,0 @@ public final class CraftServer implements Server { + worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); - ++ + File parentFolder = world.getWorldFolder().getAbsoluteFile(); + + // Synchronized because access to RegionFileCache.a is guarded by this lock. diff --git a/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch b/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch deleted file mode 100644 index e3e034aeee..0000000000 --- a/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 23 Mar 2013 19:08:41 +1100 -Subject: [PATCH] Limit Custom Map Rendering - -The default CraftBukkit render sequence for maps is ridiculously slow. By only using it when a custom renderer has been added (rarely in most cases), we can fallback to the Vanilla renderer for general usage. This leads to a much higher effiency overall, especially if no plugins are rendering such maps. - -diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -@@ -0,0 +0,0 @@ public class WorldMapHumanTracker { - int i; - int j; - -- org.bukkit.craftbukkit.map.RenderData render = this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()); // CraftBukkit -+ // Spigot start -+ boolean custom = this.worldMap.mapView.renderers.size() > 1 || !(this.worldMap.mapView.renderers.get(0) instanceof org.bukkit.craftbukkit.map.CraftMapRenderer); -+ org.bukkit.craftbukkit.map.RenderData render = (custom) ? this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()) : null; // CraftBukkit - - if (--this.g < 0) { - this.g = 4; -- abyte = new byte[render.cursors.size() * 3 + 1]; // CraftBukkit -+ abyte = new byte[((custom) ? render.cursors.size() : this.worldMap.decorations.size()) * 3 + 1]; // CraftBukkit - abyte[0] = 1; - i = 0; - - // CraftBukkit start -- for (i = 0; i < render.cursors.size(); ++i) { -- org.bukkit.map.MapCursor cursor = render.cursors.get(i); -- if (!cursor.isVisible()) continue; - -- abyte[i * 3 + 1] = (byte) (cursor.getRawType() << 4 | cursor.getDirection() & 15); -- abyte[i * 3 + 2] = (byte) cursor.getX(); -- abyte[i * 3 + 3] = (byte) cursor.getY(); -+ // Spigot start -+ for (Iterator iterator = ((custom) ? render.cursors.iterator() : this.worldMap.decorations.values().iterator()); iterator.hasNext(); ++i) { -+ org.bukkit.map.MapCursor cursor = (custom) ? (org.bukkit.map.MapCursor) iterator.next() : null; -+ if (cursor != null && !cursor.isVisible()) continue; -+ WorldMapDecoration deco = (custom) ? null : (WorldMapDecoration) iterator.next(); -+ -+ abyte[i * 3 + 1] = (byte) (((custom) ? cursor.getRawType() : deco.type) << 4 | ((custom) ? cursor.getDirection() : deco.rotation) & 15); -+ abyte[i * 3 + 2] = (byte) ((custom) ? cursor.getX() : deco.locX); -+ abyte[i * 3 + 3] = (byte) ((custom) ? cursor.getY() : deco.locY); - } -+ // Spigot end - // CraftBukkit end - - boolean flag = !itemstack.A(); -@@ -0,0 +0,0 @@ public class WorldMapHumanTracker { - abyte1[2] = (byte) j; - - for (int i1 = 0; i1 < abyte1.length - 3; ++i1) { -- abyte1[i1 + 3] = render.buffer[(i1 + j) * 128 + i]; // CraftBukkit -+ abyte1[i1 + 3] = ((custom) ? render.buffer : this.worldMap.colors)[(i1 + j) * 128 + i]; - } - - this.c[i] = -1; -diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -@@ -0,0 +0,0 @@ import org.bukkit.map.MapView; - public final class CraftMapView implements MapView { - - private final Map renderCache = new HashMap(); -- private final List renderers = new ArrayList(); -+ public final List renderers = new ArrayList(); // Spigot - private final Map> canvases = new HashMap>(); - protected final WorldMap worldMap; - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0025-Remove-o-Option.patch b/CraftBukkit-Patches/0022-Remove-o-Option.patch similarity index 100% rename from CraftBukkit-Patches/0025-Remove-o-Option.patch rename to CraftBukkit-Patches/0022-Remove-o-Option.patch diff --git a/CraftBukkit-Patches/0026-Recipe-Deconstruction.patch b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch similarity index 92% rename from CraftBukkit-Patches/0026-Recipe-Deconstruction.patch rename to CraftBukkit-Patches/0023-Recipe-Deconstruction.patch index 27f11d4517..992d650dce 100644 --- a/CraftBukkit-Patches/0026-Recipe-Deconstruction.patch +++ b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/IRecipe.java +++ b/src/main/java/net/minecraft/server/IRecipe.java @@ -0,0 +0,0 @@ public interface IRecipe { - ItemStack b(); - + ItemStack[] b(InventoryCrafting inventorycrafting); + org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit + + java.util.List getIngredients(); // Spigot @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ShapedRecipes.java +++ b/src/main/java/net/minecraft/server/ShapedRecipes.java @@ -0,0 +0,0 @@ public class ShapedRecipes implements IRecipe { - private int width; - private int height; - private ItemStack[] items; -- private ItemStack result; + private final int width; + private final int height; + private final ItemStack[] items; +- private final ItemStack result; + public ItemStack result; // Spigot private boolean e; diff --git a/CraftBukkit-Patches/0027-Implement-Arrow-API.patch b/CraftBukkit-Patches/0024-Implement-Arrow-API.patch similarity index 96% rename from CraftBukkit-Patches/0027-Implement-Arrow-API.patch rename to CraftBukkit-Patches/0024-Implement-Arrow-API.patch index 338f1c8484..1b1f9ce81f 100644 --- a/CraftBukkit-Patches/0027-Implement-Arrow-API.patch +++ b/CraftBukkit-Patches/0024-Implement-Arrow-API.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public double getDamage() + { -+ return getHandle().e(); ++ return getHandle().j(); + } + + @Override diff --git a/CraftBukkit-Patches/0028-Hopper-Customisations.patch b/CraftBukkit-Patches/0025-Hopper-Customisations.patch similarity index 76% rename from CraftBukkit-Patches/0028-Hopper-Customisations.patch rename to CraftBukkit-Patches/0025-Hopper-Customisations.patch index c77306d9e6..61c114b028 100644 --- a/CraftBukkit-Patches/0028-Hopper-Customisations.patch +++ b/CraftBukkit-Patches/0025-Hopper-Customisations.patch @@ -9,73 +9,71 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } if (flag) { -- this.c(8); -+ this.c(world.spigotConfig.hopperTransfer); // Spigot +- this.d(8); ++ this.d(world.spigotConfig.hopperTransfer); // Spigot this.update(); return true; } } + // Spigot start -+ if ( !this.j() ) ++ if ( !this.n() ) + { -+ this.c( world.spigotConfig.hopperCheck ); ++ this.d( world.spigotConfig.hopperCheck ); + } + // Spigot end return false; } else { return false; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { - if (this.getItem(j) != null) { - ItemStack itemstack = this.getItem(j).cloneItemStack(); +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); + // CraftBukkit start - Call event when pushing items into other inventories -- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, 1)); -+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, world.spigotConfig.hopperAmount)); // Spigot +- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); ++ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot Inventory destinationInventory; // Have to special case large chests as they work oddly -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU this.getWorld().getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { - this.setItem(j, itemstack); -- this.c(8); // Delay hopper checks -+ this.c(world.spigotConfig.hopperTransfer); // Spigot + this.setItem(i, itemstack); +- this.d(8); // Delay hopper checks ++ this.d(world.spigotConfig.hopperTransfer); // Spigot return false; } + int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), i); -- + ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); + if (itemstack1 == null || itemstack1.count == 0) { - if (event.getItem().equals(oitemstack)) { - iinventory.update(); -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU // CraftBukkit end return true; } - + itemstack.count -= origCount - itemstack1.count; // Spigot - this.setItem(j, itemstack); + this.setItem(i, itemstack); } } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { - if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU ItemStack itemstack1 = itemstack.cloneItemStack(); + // ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); // CraftBukkit start - Call event on collection of items from inventories into the hopper - CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, ihopper.getWorld().spigotConfig.hopperAmount)); // Spigot Inventory sourceInventory; // Have to special case large chests as they work oddly -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU iinventory.setItem(i, itemstack1); if (ihopper instanceof TileEntityHopper) { -- ((TileEntityHopper) ihopper).c(8); // Delay hopper checks -+ ((TileEntityHopper) ihopper).c(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot +- ((TileEntityHopper) ihopper).d(8); // Delay hopper checks ++ ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot } else if (ihopper instanceof EntityMinecartHopper) { - ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks + ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot @@ -84,26 +82,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } + int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), -1); + ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null); if (itemstack2 == null || itemstack2.count == 0) { -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { - +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + // CraftBukkit end return true; } + itemstack1.count -= origCount - itemstack2.count; // Spigot iinventory.setItem(i, itemstack1); } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory; + + if (tileentityhopper.o()) { +- tileentityhopper.d(8); ++ tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot + } - if (flag) { - if (iinventory instanceof TileEntityHopper) { -- ((TileEntityHopper) iinventory).c(8); -+ ((TileEntityHopper) iinventory).c(((TileEntityHopper) iinventory).world.spigotConfig.hopperTransfer); // Spigot iinventory.update(); - } - diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch similarity index 84% rename from CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch rename to CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch index fd345fbc5e..3d35a1212e 100644 --- a/CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch +++ b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -0,0 +0,0 @@ import java.util.Collection; +@@ -0,0 +0,0 @@ import com.google.common.collect.Lists; import java.util.Iterator; import java.util.List; @@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { entity.f(nbttagcompound); - if (entity.world != null) { + if (entity.world != null && flag) { - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); + if (!event.isCancelled()) { + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } @@ -41,22 +41,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity2.f(nbttagcompound2); entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); + // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b().getX(), this.b().getY(), this.b().getZ()); + if (event.isCancelled()) { + continue; + } - if (entity.world != null) { + if (entity.world != null && flag) { entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { } - } else if (entity instanceof EntityLiving && entity.world != null) { - ((EntityInsentient) entity).prepare((GroupDataEntity) null); -- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } else if (entity instanceof EntityLiving && entity.world != null && flag) { + ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); +- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot start - call SpawnerSpawnEvent, abort if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); + if (!event.isCancelled()) { -+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit ++ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } + // Spigot end } @@ -96,5 +96,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** * Bucket methods */ - public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) { + public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemInHand) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0031-Firework-Meta-Crash-Fix.patch b/CraftBukkit-Patches/0027-Firework-Meta-Crash-Fix.patch similarity index 100% rename from CraftBukkit-Patches/0031-Firework-Meta-Crash-Fix.patch rename to CraftBukkit-Patches/0027-Firework-Meta-Crash-Fix.patch diff --git a/CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch similarity index 80% rename from CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch rename to CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch index 541cef94ef..a9fc486ace 100644 --- a/CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch @@ -8,15 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot - // CraftBukkit start - whole method -- this.c.info(this.player.getName() + " issued server command: " + s); -+ if ( org.spigotmc.SpigotConfig.logCommands ) this.c.info(this.player.getName() + " issued server command: " + s); + // CraftBukkit start - whole method ++ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.c.info(this.player.getName() + " issued server command: " + s); CraftPlayer player = this.getPlayer(); - diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch b/CraftBukkit-Patches/0029-Allow-Disabling-of-Command-TabComplete.patch similarity index 100% rename from CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch rename to CraftBukkit-Patches/0029-Allow-Disabling-of-Command-TabComplete.patch diff --git a/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch b/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch deleted file mode 100644 index 9c21a6d2f8..0000000000 --- a/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 11 Jun 2013 11:54:32 +1000 -Subject: [PATCH] Prevent Shutdown Hang - -Prevents server hanging if players disconnect during the shutdown sequence. - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - - public void u() { -- for (int i = 0; i < this.players.size(); ++i) { -- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message -+ while (!this.players.isEmpty()) { -+ // Spigot start -+ EntityPlayer p = (EntityPlayer) this.players.get( 0 ); -+ p.playerConnection.disconnect( this.server.server.getShutdownMessage() ); -+ if ( ( !this.players.isEmpty() ) && ( this.players.get( 0 ) == p ) ) -+ { -+ this.players.remove( 0 ); // Prevent shutdown hang if already disconnected -+ } -+ // Spigot end - } - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0034-Configurable-Messages.patch b/CraftBukkit-Patches/0030-Configurable-Messages.patch similarity index 86% rename from CraftBukkit-Patches/0034-Configurable-Messages.patch rename to CraftBukkit-Patches/0030-Configurable-Messages.patch index 66275bf179..68f077aa5f 100644 --- a/CraftBukkit-Patches/0034-Configurable-Messages.patch +++ b/CraftBukkit-Patches/0030-Configurable-Messages.patch @@ -11,15 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { // CraftBukkit end - if (packethandshakinginsetprotocol.d() > 5) { -- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.10"); -+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + if (packethandshakinginsetprotocol.b() > 47) { +- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); - } else if (packethandshakinginsetprotocol.d() < 5) { -- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.10"); -+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + } else if (packethandshakinginsetprotocol.b() < 47) { +- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8"); ++ chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); } else { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java @@ -32,14 +32,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // return "You are not white-listed on this server!"; - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!"); + event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot - } else if (this.k.isBanned(socketaddress) && !this.k.get(gameprofile).hasExpired()) { - IpBanEntry ipbanentry = this.k.get(socketaddress); + } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { + IpBanEntry ipbanentry = this.l.get(socketaddress); @@ -0,0 +0,0 @@ public abstract class PlayerList { } else { // return this.players.size() >= this.maxPlayers ? "The server is full!" : null; if (this.players.size() >= this.maxPlayers) { -- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); +- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full"); + event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot } } @@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static String whitelistMessage; + public static String unknownCommandMessage; + public static String serverFullMessage; -+ public static String outdatedClientMessage = "Outdated client! Please use {}"; ++ public static String outdatedClientMessage = "Outdated client! Please use {0}"; + public static String outdatedServerMessage = "Outdated server! I\'m still on {0}"; + private static String transform(String s) + { @@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + private static void messages() + { -+ if (version < 4) ++ if (version < 8) + { + set( "messages.outdated-client", outdatedClientMessage ); + set( "messages.outdated-server", outdatedServerMessage ); diff --git a/CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch similarity index 97% rename from CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch rename to CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch index 817ae805e5..4258f77e51 100644 --- a/CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch +++ b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch @@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Chunk { } - this.m = true; + this.p = true; - if (!this.lit && this.done) { + if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight - this.p(); + this.n(); } - } + diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java diff --git a/CraftBukkit-Patches/0036-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch similarity index 81% rename from CraftBukkit-Patches/0036-Properly-Close-Inventories.patch rename to CraftBukkit-Patches/0032-Properly-Close-Inventories.patch index 851682a64c..df246c139e 100644 --- a/CraftBukkit-Patches/0036-Properly-Close-Inventories.patch +++ b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot Start + if ( tileentity instanceof IInventory ) + { -+ for ( org.bukkit.entity.HumanEntity h : new ArrayList( (List) ( (IInventory) tileentity ).getViewers() ) ) ++ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList((List) ( (IInventory) tileentity ).getViewers() ) ) + { + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + { @@ -26,16 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End - this.world.a(tileentity); + this.world.b(tileentity); } @@ -0,0 +0,0 @@ public class Chunk { - java.util.Iterator iter = this.entitySlices[i].iterator(); + java.util.Iterator iter = newList.iterator(); while (iter.hasNext()) { - Entity entity = (Entity) iter.next(); + Entity entity = iter.next(); + // Spigot Start + if ( entity instanceof IInventory ) + { -+ for ( org.bukkit.entity.HumanEntity h : new ArrayList( (List) ( (IInventory) entity ).getViewers() ) ) ++ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList( (List) ( (IInventory) entity ).getViewers() ) ) + { + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + { @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } - public void b(int i) { + public void c(int i) { + // Spigot Start + for ( HumanEntity human : new java.util.ArrayList( transaction ) ) + { @@ -62,6 +62,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End this.b = false; - super.b(i); + super.c(i); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch similarity index 76% rename from CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch rename to CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch index cd1d40070d..1b2dc5c593 100644 --- a/CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch +++ b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch @@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - if (this.player.dead) return; // CraftBukkit +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); + // Spigot Start -+ if ( entity == player ) ++ if ( entity == player && !player.v() ) // RENAME + { + disconnect( "Cannot interact with self!" ); + return; + } + // Spigot End - this.player.v(); + this.player.z(); if (entity != null) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch similarity index 55% rename from CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch rename to CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch index 0ba8aa03d2..7dc7bfc9f7 100644 --- a/CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch +++ b/CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch @@ -8,20 +8,20 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { } } // CraftBukkit end + pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - - this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); + this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.vehicle.passenger = null; -@@ -0,0 +0,0 @@ public abstract class Entity { + } +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { } } // CraftBukkit end + // Spigot Start -+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4 ) ) ++ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) ) + { + org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ); + pluginManager.callEvent( event ); @@ -31,19 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // Spigot End - ++ if (this.vehicle != null) { this.vehicle.passenger = null; -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - public void setPassengerOf(Entity entity) { - // CraftBukkit end - if (this.vehicle != null && entity == null) { -+ world.getServer().getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - // CraftBukkit start - use parent method instead to correctly fire VehicleExitEvent - Entity originalVehicle = this.vehicle; - // First statement moved down, second statement handled in parent method. + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch b/CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch similarity index 87% rename from CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch rename to CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch index 9debd42f25..d6c27fd4a7 100644 --- a/CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch +++ b/CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch @@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - Player respawnPlayer = this.cserver.getPlayer(entityplayer1); + Player respawnPlayer = cserver.getPlayer(entityplayer1); PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); - this.cserver.getPluginManager().callEvent(respawnEvent); + cserver.getPluginManager().callEvent(respawnEvent); + // Spigot Start + if (entityplayer.playerConnection.isDisconnected()) { + return entityplayer; diff --git a/CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch similarity index 80% rename from CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch rename to CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch index ac0ed6047f..642f25c7b3 100644 --- a/CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch +++ b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch @@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit + public class BlockRedstoneTorch extends BlockTorch { - private boolean isOn; -- private static Map b = new HashMap(); +- private static Map b = Maps.newHashMap(); + private static Map b = new java.util.WeakHashMap(); // Spigot + private final boolean isOn; - private boolean a(World world, int i, int j, int k, boolean flag) { - if (!b.containsKey(world)) { + private boolean a(World world, BlockPosition blockposition, boolean flag) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0042-Player-Collision-API.patch b/CraftBukkit-Patches/0037-Player-Collision-API.patch similarity index 76% rename from CraftBukkit-Patches/0042-Player-Collision-API.patch rename to CraftBukkit-Patches/0037-Player-Collision-API.patch index 075c249b92..fe62a03e1f 100644 --- a/CraftBukkit-Patches/0042-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0037-Player-Collision-API.patch @@ -8,28 +8,35 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { List list = this.world.getEntities(this, axisalignedbb); -- if (list != null) { -+ if (list != null && this.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving) - for (int i = 0; i < list.size(); ++i) { - Entity entity = (Entity) list.get(i); ++ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving) + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + this.d(entity); + } + } ++ } // Spigot + } + + } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - protected void bo() { - List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + protected void bK() { + List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) { -+ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition ++ if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); - + diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java @@ -42,15 +49,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean collidesWithEntities = true; + + @Override -+ public boolean R() ++ public boolean ad() + { -+ return this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) + } + + @Override -+ public boolean S() ++ public boolean ae() + { -+ return this.collidesWithEntities && super.S(); // (second !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving) + } + // Spigot end diff --git a/CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch similarity index 82% rename from CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch rename to CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch index 6be956369c..0bd89b9a9b 100644 --- a/CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch +++ b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch @@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.g[this.ticks % 100] = System.nanoTime() - i; this.methodProfiler.b(); this.methodProfiler.a("snooper"); -- if (!this.l.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.l.d() && this.ticks > 100) { // Spigot - this.l.a(); +- if (!this.m.d() && this.ticks > 100) { ++ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot + this.m.a(); } - if (this.ticks % 6000 == 0) { + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.l.b(); + this.m.b(); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch b/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch deleted file mode 100644 index ba2faf7f01..0000000000 --- a/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 09:07:54 +1000 -Subject: [PATCH] Lower Chunk Compression - -Use a chunk compression level of 4 - this provides an optimal balance between speed and compression. - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk extends Packet { - this.b = chunk.locZ; - this.g = flag; - ChunkMap chunkmap = a(chunk, flag, i); -- Deflater deflater = new Deflater(-1); -+ Deflater deflater = new Deflater(4); // Spigot - - this.d = chunkmap.c; - this.c = chunkmap.b; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { - @Override - protected Deflater initialValue() { - // Don't use higher compression level, slows things down too much -- return new Deflater(6); -+ return new Deflater(4); // Spigot 6 -> 4 - } - }; - // CraftBukkit end --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch b/CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch similarity index 90% rename from CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch rename to CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch index d18d4b4db5..591e5a1103 100644 --- a/CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch +++ b/CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public boolean isInvulnerable() + { -+ return getHandle().isInvulnerable(); ++ return getHandle().isInvulnerable(net.minecraft.server.DamageSource.GENERIC); + } }; diff --git a/CraftBukkit-Patches/0045-Cap-Minimum-Player-Speed.patch b/CraftBukkit-Patches/0040-Cap-Minimum-Player-Speed.patch similarity index 100% rename from CraftBukkit-Patches/0045-Cap-Minimum-Player-Speed.patch rename to CraftBukkit-Patches/0040-Cap-Minimum-Player-Speed.patch diff --git a/CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch b/CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch similarity index 96% rename from CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch rename to CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch index f8cda993ac..eafbae098a 100644 --- a/CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch +++ b/CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch @@ -8,10 +8,10 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { // Update client if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.g)); + // Spigot Start + ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); diff --git a/CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch similarity index 53% rename from CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch rename to CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch index f5e40fe411..88ba3b4b6a 100644 --- a/CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch +++ b/CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch @@ -9,25 +9,16 @@ diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/ne index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -0,0 +0,0 @@ public class BlockTNT extends Block { - - public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { - if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) { -- this.a(world, i, j, k, 1, entityhuman); -+ this.a(world, i, j, k, 1, (EntityLiving) entityhuman); // Spigot - Fix decompile error! - world.setAir(i, j, k); - entityhuman.bF().damage(1, entityhuman); - return true; @@ -0,0 +0,0 @@ public class BlockTNT extends Block { EntityArrow entityarrow = (EntityArrow) entity; if (entityarrow.isBurning()) { + // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, i, j, k, Blocks.AIR, 0).isCancelled()) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { + return; + } + // CraftBukkit end - this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); - world.setAir(i, j, k); + this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); + world.setAir(blockposition); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch b/CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch similarity index 86% rename from CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch rename to CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch index 36036c6b8d..d72021b2ae 100644 --- a/CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch +++ b/CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch @@ -11,19 +11,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { private void a(World world) { - if (this.e == null) { + if (this.d == null) { + // Spigot Start + if ( world.spigotConfig.saveStructureInfo ) + { - this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + } else + { -+ this.e = new PersistentStructure( this.a() ); ++ this.d = new PersistentStructure( this.a() ); + } + // Spigot End - if (this.e == null) { - this.e = new PersistentStructure(this.a()); - world.a(this.a(), (PersistentBase) this.e); + if (this.d == null) { + this.d = new PersistentStructure(this.a()); + world.a(this.a(), (PersistentBase) this.d); diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0049-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch similarity index 96% rename from CraftBukkit-Patches/0049-Item-Despawn-Rate.patch rename to CraftBukkit-Patches/0044-Item-Despawn-Rate.patch index 5d27fa2deb..940820a406 100644 --- a/CraftBukkit-Patches/0049-Item-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { - } + // Craftbukkit end */ - // ++this.age; // CraftBukkit - Moved up + this.W(); - if (!this.world.isStatic && this.age >= 6000) { + if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot // CraftBukkit start - fire ItemDespawnEvent diff --git a/CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch similarity index 86% rename from CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch rename to CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch index 342a6e448b..c03c6d16dc 100644 --- a/CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch +++ b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList private float lastPitch = Float.MAX_VALUE; private float lastYaw = Float.MAX_VALUE; private boolean justTeleported = false; @@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // For the PacketPlayOutBlockPlace hack :( Long lastPacket; -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + } // CraftBukkit start - fire PlayerMoveEvent Player player = this.getPlayer(); + // Spigot Start @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. Location to = player.getLocation().clone(); // Start off the To location as the Players current location. -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.lastPitch = to.getPitch(); // Skip the first time we do this diff --git a/CraftBukkit-Patches/0051-Implement-respawn-API.patch b/CraftBukkit-Patches/0046-Implement-respawn-API.patch similarity index 100% rename from CraftBukkit-Patches/0051-Implement-respawn-API.patch rename to CraftBukkit-Patches/0046-Implement-respawn-API.patch diff --git a/CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch similarity index 88% rename from CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch rename to CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch index 6dc1d9b669..987d47477e 100644 --- a/CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch @@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { if (block == this.g && i == this.h) { - ++this.at; -- if (this.at == 1200) { -+ if (this.at >= world.spigotConfig.arrowDespawnRate) { // First int after shooter + ++this.ap; +- if (this.ap >= 1200) { ++ if (this.ap >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter this.die(); } - } else { + diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch new file mode 100644 index 0000000000..c429037d93 --- /dev/null +++ b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 1 Dec 2013 17:52:14 +1100 +Subject: [PATCH] Fix packed ice generation + + +diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java ++++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java +@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { + Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); + + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { +- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot + } + + if (k != 0 && l > 1) { + block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { +- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot + } + } + } +@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { + Block block1 = world.getType(blockposition1).getBlock(); + + if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { +- this.a(world, blockposition1, Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot + blockposition1 = blockposition1.down(); + --l1; + if (l1 <= 0) { +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0055-Watchdog-Thread.patch b/CraftBukkit-Patches/0049-Watchdog-Thread.patch similarity index 93% rename from CraftBukkit-Patches/0055-Watchdog-Thread.patch rename to CraftBukkit-Patches/0049-Watchdog-Thread.patch index db801179dc..57a51c414c 100644 --- a/CraftBukkit-Patches/0055-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0049-Watchdog-Thread.patch @@ -4,11 +4,24 @@ Date: Tue, 5 Aug 2014 17:20:19 +0100 Subject: [PATCH] Watchdog Thread. +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + // CraftBukkit end + +- if (this.aQ() > 0L) { ++ if (false && this.aQ() > 0L) { // Spigot - disable + Thread thread = new Thread(new ThreadWatchdog(this)); + + thread.setName("Server Watchdog"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.a(crashreport); } finally { try { @@ -16,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.stop(); this.isStopped = true; } catch (Throwable throwable1) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.b(); diff --git a/CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch b/CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch similarity index 80% rename from CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch rename to CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch index 2a4e75b227..a8a74b8eb0 100644 --- a/CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch +++ b/CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch @@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java @@ -0,0 +0,0 @@ public class BlockFlowerPot extends BlockContainer { - if (tileentityflowerpot != null && tileentityflowerpot.a() != null) { - this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b())); + if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { + a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); + tileentityflowerpot.a( null, 0 ); // Spigot } - super.remove(world, i, j, k, block, l); + super.remove(world, blockposition, iblockdata); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch similarity index 93% rename from CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch rename to CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch index 25e0ff9f62..7d7759ba9b 100644 --- a/CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch +++ b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public boolean isReady() { -- return this.m && this.done && this.lit; +- return this.p && this.done && this.lit; + // Spigot Start + /* + * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. @@ -24,5 +24,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot End } - public ChunkCoordIntPair l() { + public ChunkCoordIntPair j() { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch b/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch deleted file mode 100644 index a84415d094..0000000000 --- a/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 9 Oct 2013 18:20:05 +1100 -Subject: [PATCH] Fix BrewingStands Removing NBT / Potions - - -diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBrewingStand.java -+++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java -@@ -0,0 +0,0 @@ public class BlockBrewingStand extends BlockContainer { - entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); - entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); - entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); -- world.addEntity(entityitem); -+ // Spigot Start -+ if ( itemstack.hasTag() ) -+ { -+ entityitem.getItemStack().setTag( (NBTTagCompound) itemstack.getTag().clone() ); -+ } -+ // Spigot End -+ world.addEntity( entityitem ); - } - } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch similarity index 73% rename from CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch rename to CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch index 3fe8dff1b4..c9eb4df3f0 100644 --- a/CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch +++ b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch @@ -8,17 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java -@@ -0,0 +0,0 @@ public class PacketPlayInChat extends Packet { +@@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet { + return this.a; } - // CraftBukkit end -- public void handle(PacketListener packetlistener) { +- public void a(PacketListener packetlistener) { + // Spigot Start + private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); -+ public void handle(final PacketListener packetlistener) ++ @Override ++ public void a(final PacketListener packetlistener) + { -+ if ( a() ) ++ if ( !a.startsWith("/") ) + { + executors.submit( new Runnable() + { @@ -26,13 +27,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void run() + { -+ PacketPlayInChat.this.a( (PacketPlayInListener) packetlistener ); ++ PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener ); + } + } ); + return; + } + // Spigot End - this.a((PacketPlayInListener) packetlistener); + this.a((PacketListenerPlayIn) packetlistener); } } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0060-Orebfuscator.patch b/CraftBukkit-Patches/0053-Orebfuscator.patch similarity index 67% rename from CraftBukkit-Patches/0060-Orebfuscator.patch rename to CraftBukkit-Patches/0053-Orebfuscator.patch index 5ac28d58b8..5e1957110e 100644 --- a/CraftBukkit-Patches/0060-Orebfuscator.patch +++ b/CraftBukkit-Patches/0053-Orebfuscator.patch @@ -9,127 +9,111 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - } - - this.world.setAir(i, j, k); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot - } - - if (this.onGround) { + blockposition = new BlockPosition(this); + if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { + this.world.setAir(blockposition); ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot + } else if (!this.world.isStatic) { + this.die(); + return; @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { + return; } - this.world.setTypeAndData(i, j, k, this.id, this.data, 3); + this.world.setTypeAndData(blockposition, this.block, 3); ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot // CraftBukkit end -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot - - if (this.id instanceof BlockFalling) { - ((BlockFalling) this.id).a(this.world, i, j, k, this.data); + if (block instanceof BlockFalling) { + ((BlockFalling) block).a_(this.world, blockposition); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { - j = chunkposition.y; - k = chunkposition.z; - block = this.world.getType(i, j, k); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot + blockposition = (BlockPosition) iterator.next(); + Block block = this.world.getType(blockposition).getBlock(); + ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot if (flag) { - double d0 = (double) ((float) i + this.world.random.nextFloat()); - double d1 = (double) ((float) j + this.world.random.nextFloat()); + double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); + double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat()); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk extends Packet { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { + this.b = chunk.locZ; + this.d = flag; + this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); ++ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); + } - 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; + public void a(PacketDataSerializer packetdataserializer) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { - } - }; - // CraftBukkit end +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { + private int[] b; + private ChunkMap[] c; + private boolean d; + private World world; // Spigot public PacketPlayOutMapChunkBulk() {} -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { - Chunk chunk = (Chunk) list.get(k); - ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); - -+ // Spigot start -+ world = chunk.world; -+ /* - if (buildBuffer.length < j + chunkmap.a.length) { - byte[] abyte = new byte[j + chunkmap.a.length]; - -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { - } - - System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length); -+ */ -+ // Spigot end - j += chunkmap.a.length; - this.a[k] = chunk.locX; - this.b[k] = chunk.locZ; -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk extends Packet { - if (this.buffer != null) { - return; +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { + this.b[j] = chunk.locZ; + this.c[j] = chunkmap; + } +- ++ ++ world = ((Chunk) list.get(0)).getWorld(); // Spigot + } + + public void a(PacketDataSerializer packetdataserializer) { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet { + } + + for (i = 0; i < this.a.length; ++i) { ++ world.spigotConfig.antiXrayInstance.obfuscate(this.a[i], this.b[i], this.c[i].b, this.c[i].a, world); // Spigot + packetdataserializer.writeBytes(this.c[i].a); } -+ // Spigot start -+ 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); -+ finalBufferSize += inflatedBuffers[i].length; -+ } -+ -+ // Now it's time to efficiently copy the chunk to the build buffer -+ buildBuffer = new byte[finalBufferSize]; -+ int bufferLocation = 0; -+ for (int i = 0; i < a.length; i++) { -+ System.arraycopy(inflatedBuffers[i], 0, buildBuffer, bufferLocation, inflatedBuffers[i].length); -+ bufferLocation += inflatedBuffers[i].length; -+ } -+ // Spigot end - Deflater deflater = localDeflater.get(); - deflater.reset(); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { - this.o = i1; - } } -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot + } ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot } + public void a(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return this.getType(i, k, j); + this.d(blockposition.up(), block); + this.d(blockposition.north(), block); + this.d(blockposition.south(), block); ++ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, blockposition); // Spigot } -- public Block getType(int i, int j, int k) { + public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) { +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + return this.worldProvider.p()[this.getLightLevel(blockposition)]; + } + +- public IBlockData getType(BlockPosition blockposition) { + // Spigot start -+ public Block getType(int i, int j, int k) ++ public IBlockData getType(BlockPosition blockposition) + { -+ return getType( i, j, k, true ); ++ return getType( blockposition, true ); + } -+ -+ public Block getType(int i, int j, int k, boolean useCaptured) { ++ ++ public IBlockData getType(BlockPosition blockposition, boolean useCaptured) { // CraftBukkit start - tree generation - if (captureTreeGeneration) { + if (captureTreeGeneration && useCaptured) { @@ -137,14 +121,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Iterator it = capturedBlockStates.iterator(); while (it.hasNext()) { BlockState previous = it.next(); -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.e(i, j + 1, k, block); - this.e(i, j, k - 1, block); - this.e(i, j, k + 1, block); -+ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, i, j, k); // Spigot - } - - public void b(int i, int j, int k, Block block, int l) { diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -153,9 +129,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package org.spigotmc; + -+import net.minecraft.util.gnu.trove.set.TByteSet; -+import net.minecraft.util.gnu.trove.set.hash.TByteHashSet; ++import gnu.trove.set.TByteSet; ++import gnu.trove.set.hash.TByteHashSet; +import net.minecraft.server.Block; ++import net.minecraft.server.BlockPosition; +import net.minecraft.server.Blocks; +import net.minecraft.server.World; +import org.bukkit.craftbukkit.util.CraftMagicNumbers; @@ -199,12 +176,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Starts the timings handler, then updates all blocks within the set radius + * of the given coordinate, revealing them if they are hidden ores. + */ -+ public void updateNearbyBlocks(World world, int x, int y, int z) ++ public void updateNearbyBlocks(World world, BlockPosition position) + { + if ( world.spigotConfig.antiXray ) + { + update.startTiming(); -+ updateNearbyBlocks( world, x, y, z, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower ++ updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower + update.stopTiming(); + } + } @@ -249,7 +226,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK); + break; + case THE_END: -+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.WHITESTONE); ++ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE); + break; + default: + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE); @@ -277,24 +254,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Grab the block ID in the buffer. + // TODO: extended IDs are not yet supported -+ int blockId = buffer[index] & 0xFF; ++ int blockId = (buffer[index << 1] & 0xFF) ++ | ((buffer[(index << 1) + 1] & 0xFF) << 8); ++ blockId >>>= 4; + // Check if the block should be obfuscated + if ( obfuscateBlocks[blockId] ) + { + // The world isn't loaded, bail out -+ if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) ++ if ( !isLoaded( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) + { + index++; + continue; + } + // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate -+ if ( !hasTransparentBlockAdjacent( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) ++ if ( !hasTransparentBlockAdjacent( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) + { ++ int newId = blockId; + switch ( world.spigotConfig.engineMode ) + { + case 1: + // Replace with replacement material -+ buffer[index] = replaceWithTypeId; ++ newId = replaceWithTypeId & 0xFF; + break; + case 2: + // Replace with random ore. @@ -302,9 +282,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + randomOre = 0; + } -+ buffer[index] = replacementOres[randomOre++]; ++ newId = replacementOres[randomOre++] & 0xFF; + break; + } ++ newId <<= 4; ++ buffer[index << 1] = (byte) (newId & 0xFF); ++ buffer[(index << 1) + 1] = (byte) ((newId >> 8) & 0xFF); + } + } + @@ -317,56 +300,56 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private void updateNearbyBlocks(World world, int x, int y, int z, int radius, boolean updateSelf) ++ private void updateNearbyBlocks(World world, BlockPosition position, int radius, boolean updateSelf) + { + // If the block in question is loaded -+ if ( world.isLoaded( x, y, z ) ) ++ if ( world.isLoaded( position ) ) + { + // Get block id -+ Block block = world.getType(x, y, z); ++ Block block = world.getType(position).getBlock(); + + // See if it needs update + if ( updateSelf && obfuscateBlocks[Block.getId( block )] ) + { + // Send the update -+ world.notify( x, y, z ); ++ world.notify( position ); + } + + // Check other blocks for updates + if ( radius > 0 ) + { -+ updateNearbyBlocks( world, x + 1, y, z, radius - 1, true ); -+ updateNearbyBlocks( world, x - 1, y, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y + 1, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y - 1, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y, z + 1, radius - 1, true ); -+ updateNearbyBlocks( world, x, y, z - 1, radius - 1, true ); ++ updateNearbyBlocks( world, position.east(), radius - 1, true ); ++ updateNearbyBlocks( world, position.west(), radius - 1, true ); ++ updateNearbyBlocks( world, position.up(), radius - 1, true ); ++ updateNearbyBlocks( world, position.down(), radius - 1, true ); ++ updateNearbyBlocks( world, position.south(), radius - 1, true ); ++ updateNearbyBlocks( world, position.north(), radius - 1, true ); + } + } + } + -+ private static boolean isLoaded(World world, int x, int y, int z, int radius) ++ private static boolean isLoaded(World world, BlockPosition position, int radius) + { -+ return world.isLoaded( x, y, z ) ++ return world.isLoaded( position ) + && ( radius == 0 || -+ ( isLoaded( world, x + 1, y, z, radius - 1 ) -+ && isLoaded( world, x - 1, y, z, radius - 1 ) -+ && isLoaded( world, x, y + 1, z, radius - 1 ) -+ && isLoaded( world, x, y - 1, z, radius - 1 ) -+ && isLoaded( world, x, y, z + 1, radius - 1 ) -+ && isLoaded( world, x, y, z - 1, radius - 1 ) ) ); ++ ( isLoaded( world, position.east(), radius - 1 ) ++ && isLoaded( world, position.west(), radius - 1 ) ++ && isLoaded( world, position.up(), radius - 1 ) ++ && isLoaded( world, position.down(), radius - 1 ) ++ && isLoaded( world, position.south(), radius - 1 ) ++ && isLoaded( world, position.north(), radius - 1 ) ) ); + } + -+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) ++ private static boolean hasTransparentBlockAdjacent(World world, BlockPosition position, int radius) + { -+ return !isSolidBlock(world.getType(x, y, z, false)) /* isSolidBlock */ ++ return !isSolidBlock(world.getType(position, false).getBlock()) /* isSolidBlock */ + || ( radius > 0 -+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) ); ++ && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.west(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.up(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.down(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.south(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) ); + } + + private static boolean isSolidBlock(Block block) { @@ -375,7 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // rendering they can be seen through therefor we special + // case them so that the antixray doesn't show the fake + // blocks around them. -+ return block.r() && block != Blocks.MOB_SPAWNER; ++ return block.isOccluding() && block != Blocks.MOB_SPAWNER; + } +} diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch deleted file mode 100644 index 1083007e04..0000000000 --- a/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 1 Dec 2013 17:52:14 +1100 -Subject: [PATCH] Fix packed ice generation - - -diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { - Block block = world.getType(i + l1, j + j1, k + i2); - - if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -- this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + l1, j + j1, k + i2, Blocks.PACKED_ICE); // Spigot - } - - if (j1 != 0 && k1 > 1) { - block = world.getType(i + l1, j - j1, k + i2); - if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -- this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + l1, j - j1, k + i2, Blocks.PACKED_ICE); // Spigot - } - } - } -@@ -0,0 +0,0 @@ public class WorldGenPackedIce2 extends WorldGenerator { - Block block1 = world.getType(i + j2, l1, k + k1); - - if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -- this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + j2, l1, k + k1, Blocks.PACKED_ICE); // Spigot - --l1; - --k2; - if (k2 <= 0) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0061-Optimize-DataWatcher.patch b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch similarity index 78% rename from CraftBukkit-Patches/0061-Optimize-DataWatcher.patch rename to CraftBukkit-Patches/0054-Optimize-DataWatcher.patch index 3bb41a05ba..a172968bda 100644 --- a/CraftBukkit-Patches/0061-Optimize-DataWatcher.patch +++ b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch @@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final Entity a; private boolean b = true; -- private static final HashMap c = new HashMap(); -- private final Map d = new HashMap(); +- private static final Map c = Maps.newHashMap(); +- private final Map d = Maps.newHashMap(); + // Spigot Start -+ private static final net.minecraft.util.gnu.trove.map.TObjectIntMap classToId = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); -+ private final net.minecraft.util.gnu.trove.map.TIntObjectMap dataValues = new net.minecraft.util.gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); ++ private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); ++ private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); + // These exist as an attempt at backwards compatability for (broken) NMS plugins -+ private static final Map c = net.minecraft.util.gnu.trove.TDecorators.wrap( classToId ); -+ private final Map d = net.minecraft.util.gnu.trove.TDecorators.wrap( dataValues ); ++ private static final Map c = gnu.trove.TDecorators.wrap( classToId ); ++ private final Map d = gnu.trove.TDecorators.wrap( dataValues ); + // Spigot End private boolean e; private ReadWriteLock f = new ReentrantReadWriteLock(); @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void a(int i, Object object) { -- Integer integer = (Integer) c.get(object.getClass()); +- Integer integer = (Integer) DataWatcher.c.get(object.getClass()); + int integer = classToId.get(object.getClass()); // Spigot - if (integer == null) { @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.b = false; } @@ -0,0 +0,0 @@ public class DataWatcher { - WatchableObject watchableobject = new WatchableObject(j, i, null); + WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); this.f.writeLock().lock(); - this.d.put(Integer.valueOf(i), watchableobject); @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public List c() { - ArrayList arraylist = null; -+ ArrayList arraylist = new ArrayList(); // Spigot ++ ArrayList arraylist = Lists.newArrayList(); // Spigot this.f.readLock().lock(); @@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { - watchableobject = (WatchableObject) iterator.next(); - if (arraylist == null) { -- arraylist = new ArrayList(); +- arraylist = Lists.newArrayList(); - } - } + arraylist.addAll(this.dataValues.valueCollection()); // Spigot @@ -111,13 +111,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } static { -- c.put(Byte.class, Integer.valueOf(0)); -- c.put(Short.class, Integer.valueOf(1)); -- c.put(Integer.class, Integer.valueOf(2)); -- c.put(Float.class, Integer.valueOf(3)); -- c.put(String.class, Integer.valueOf(4)); -- c.put(ItemStack.class, Integer.valueOf(5)); -- c.put(ChunkCoordinates.class, Integer.valueOf(6)); +- DataWatcher.c.put(Byte.class, Integer.valueOf(0)); +- DataWatcher.c.put(Short.class, Integer.valueOf(1)); +- DataWatcher.c.put(Integer.class, Integer.valueOf(2)); +- DataWatcher.c.put(Float.class, Integer.valueOf(3)); +- DataWatcher.c.put(String.class, Integer.valueOf(4)); +- DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); +- DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); +- DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); + // Spigot Start - remove valueOf + classToId.put(Byte.class, 0); + classToId.put(Short.class, 1); @@ -125,7 +126,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + classToId.put(Float.class, 3); + classToId.put(String.class, 4); + classToId.put(ItemStack.class, 5); -+ classToId.put(ChunkCoordinates.class, 6); ++ classToId.put(BlockPosition.class, 6); ++ classToId.put(Vector3f.class, 7); + // Spigot End } } diff --git a/CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch similarity index 83% rename from CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch rename to CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch index 5da1919131..cda684438c 100644 --- a/CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch +++ b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch @@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { - } +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo + } + // Spigot start @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end + - public void c() { + public void b() { + // Spigot start - Moved to initUUID + /* if (!this.i.isComplete()) { @@ -31,45 +31,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end // CraftBukkit start - fire PlayerLoginEvent - EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, this.hostname); -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { + EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname); +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo this.g = EnumProtocolState.KEY; - this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.K().getPublic(), this.e), new GenericFutureListener[0]); + this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.P().getPublic(), this.e)); } else { - this.g = EnumProtocolState.READY_TO_ACCEPT; + (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot } - } + } diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java +++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java @@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { - GameProfile gameprofile = LoginListener.a(this.a); + GameProfile gameprofile = LoginListener.b(this.a); try { + // Spigot Start -+ if ( !LoginListener.c( this.a ).getOnlineMode() ) ++ if ( !LoginListener.a( this.a ).getOnlineMode() ) + { + a.initUUID(); + fireLoginEvents(); + return; + } + // Spigot End - String s = (new BigInteger(MinecraftEncryption.a(LoginListener.b(this.a), LoginListener.c(this.a).K().getPublic(), LoginListener.d(this.a)))).toString(16); + String s = (new BigInteger(MinecraftEncryption.a(LoginListener.c(this.a), LoginListener.a(this.a).P().getPublic(), LoginListener.d(this.a)))).toString(16); - LoginListener.a(this.a, LoginListener.c(this.a).av().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); - if (LoginListener.a(this.a) != null) { + LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); + if (LoginListener.b(this.a) != null) { - // CraftBukkit start - fire PlayerPreLoginEvent -- if (!this.a.networkManager.isConnected()) { +- if (!this.a.networkManager.g()) { - return; - } - -- String playerName = LoginListener.a(this.a).getName(); +- String playerName = LoginListener.b(this.a).getName(); - java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -- java.util.UUID uniqueId = LoginListener.a(this.a).getId(); -- final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; +- java.util.UUID uniqueId = LoginListener.b(this.a).getId(); +- final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; - - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); - server.getPluginManager().callEvent(asyncEvent); @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - return event.getResult(); - }}; - -- LoginListener.c(this.a).processQueue.add(waitable); +- LoginListener.a(this.a).processQueue.add(waitable); - if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { - this.a.disconnect(event.getKickMessage()); - return; @@ -98,29 +98,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - } - // CraftBukkit end -- -- LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); +- +- LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); - LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + fireLoginEvents(); // Spigot - } else if (LoginListener.c(this.a).N()) { + } else if (LoginListener.a(this.a).S()) { LoginListener.e().warn("Failed to verify username but will let them in anyway!"); LoginListener.a(this.a, this.a.a(gameprofile)); @@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread { - // CraftBukkit end } + } + + private void fireLoginEvents() throws Exception + { + // CraftBukkit start - fire PlayerPreLoginEvent -+ if (!this.a.networkManager.isConnected()) { ++ if (!this.a.networkManager.g()) { + return; + } + -+ String playerName = LoginListener.a(this.a).getName(); ++ String playerName = LoginListener.b(this.a).getName(); + java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -+ java.util.UUID uniqueId = LoginListener.a(this.a).getId(); -+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; ++ java.util.UUID uniqueId = LoginListener.b(this.a).getId(); ++ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; + + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); + server.getPluginManager().callEvent(asyncEvent); @@ -137,7 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return event.getResult(); + }}; + -+ LoginListener.c(this.a).processQueue.add(waitable); ++ LoginListener.a(this.a).processQueue.add(waitable); + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { + this.a.disconnect(event.getKickMessage()); + return; @@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // CraftBukkit end + -+ LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); ++ LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); + LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + } } diff --git a/CraftBukkit-Patches/0063-BungeeCord-Support.patch b/CraftBukkit-Patches/0056-BungeeCord-Support.patch similarity index 76% rename from CraftBukkit-Patches/0063-BungeeCord-Support.patch rename to CraftBukkit-Patches/0056-BungeeCord-Support.patch index 339eb3e315..0e7d16efa8 100644 --- a/CraftBukkit-Patches/0063-BungeeCord-Support.patch +++ b/CraftBukkit-Patches/0056-BungeeCord-Support.patch @@ -9,20 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import net.minecraft.util.com.mojang.authlib.properties.Property; // Spigot - import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - - // CraftBukkit start - import java.net.InetAddress; - import java.util.HashMap; -+import net.minecraft.util.com.mojang.util.UUIDTypeAdapter; +@@ -0,0 +0,0 @@ import java.util.HashMap; // CraftBukkit end public class HandshakeListener implements PacketHandshakingInListener { - +- ++ + private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot // CraftBukkit start - add fields private static final HashMap throttleTracker = new HashMap(); @@ -36,18 +28,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + String[] split = packethandshakinginsetprotocol.b.split("\00"); + if ( split.length == 3 || split.length == 4 ) { + packethandshakinginsetprotocol.b = split[0]; -+ b.n = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); -+ b.spoofedUUID = UUIDTypeAdapter.fromString( split[2] ); ++ b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); ++ b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); + } else + { + chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); -+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); ++ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); + this.b.close(chatcomponenttext); + return; + } + if ( split.length == 4 ) + { -+ b.spoofedProfile = gson.fromJson(split[3], Property[].class); ++ b.spoofedProfile = gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class); + } + } + // Spigot End @@ -58,15 +50,7 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ 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.GenericFutureListener; - import net.minecraft.util.org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo // Spigot start public void initUUID() { @@ -84,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (networkManager.spoofedProfile != null) + { -+ for ( Property property : networkManager.spoofedProfile ) ++ for ( com.mojang.authlib.properties.Property property : networkManager.spoofedProfile ) + { + this.i.getProperties().put( property.getName(), property ); + } @@ -96,36 +80,28 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ import javax.crypto.SecretKey; - - import net.minecraft.util.com.google.common.collect.Queues; - import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.com.mojang.authlib.properties.Property; - import net.minecraft.util.io.netty.channel.Channel; - import net.minecraft.util.io.netty.channel.ChannelFutureListener; - import net.minecraft.util.io.netty.channel.ChannelHandlerContext; @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private final Queue k = Queues.newConcurrentLinkedQueue(); - private final Queue l = Queues.newConcurrentLinkedQueue(); - private Channel m; -- private SocketAddress n; + private final EnumProtocolDirection g; + private final Queue h = Queues.newConcurrentLinkedQueue(); + private Channel i; +- private SocketAddress j; + // Spigot Start -+ public SocketAddress n; ++ public SocketAddress j; + public java.util.UUID spoofedUUID; -+ public Property[] spoofedProfile; ++ public com.mojang.authlib.properties.Property[] spoofedProfile; + // Spigot End - private PacketListener o; - private EnumProtocol p; - private IChatBaseComponent q; + private PacketListener k; + private IChatBaseComponent l; + private boolean m; @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { static Channel a(NetworkManager networkmanager) { - return networkmanager.m; + return networkmanager.i; } + + // Spigot Start + public SocketAddress getRawAddress() + { -+ return this.m.remoteAddress(); ++ return this.i.remoteAddress(); + } + // Spigot End } @@ -133,14 +109,14 @@ diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol extends Packet { +@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet { - public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws - this.a = packetdataserializer.a(); + public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.e(); - this.b = packetdataserializer.c(255); + this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot this.c = packetdataserializer.readUnsignedShort(); - this.d = EnumProtocol.a(packetdataserializer.a()); + this.d = EnumProtocol.a(packetdataserializer.e()); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -148,13 +124,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, new PlayerInteractManager(this.server.getWorldServer(0))); + EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), gameprofile, new PlayerInteractManager(server.getWorldServer(0))); Player player = entity.getBukkitEntity(); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress()); + PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); String s; - if (this.j.isBanned(gameprofile) && !this.j.get(gameprofile).hasExpired()) { + if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch b/CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch similarity index 68% rename from CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch rename to CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch index c3b16cff87..ceb0c2b620 100644 --- a/CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch +++ b/CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch @@ -10,21 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - this.getNavigation().b(true); - this.goalSelector.a(0, new PathfinderGoalFloat(this)); - this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false)); + } + + protected void n() { - this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); -+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); } // Spigot - this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); ++ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); // Spigot + this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true)); this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false)); - this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); -@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true)); -- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false)); -+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false)); } // Spigot - this.a(0.6F, 1.8F); + this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class})); + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); +- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); ++ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true)); } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch b/CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch similarity index 67% rename from CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch rename to CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch index 99bf5a9d5f..ff361b29a0 100644 --- a/CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch +++ b/CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch @@ -9,33 +9,33 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - private final List n = new ArrayList(); - private final ICommandHandler o; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + private final List o = Lists.newArrayList(); + private final ICommandHandler p; public final MethodProfiler methodProfiler = new MethodProfiler(); -- private final ServerConnection p; -+ private ServerConnection p; // Spigot - private final ServerPing q = new ServerPing(); - private final Random r = new Random(); +- private final ServerConnection q; ++ private ServerConnection q; // Spigot + private final ServerPing r = new ServerPing(); + private final Random s = new Random(); private String serverIp; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - j = this; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.d = proxy; - // this.universe = file1; // CraftBukkit -- this.p = new ServerConnection(this); -+ // this.p = new ServerConnection(this); // Spigot - this.o = new CommandDispatcher(); - // this.convertable = new WorldLoaderServer(file1); // CraftBukkit - moved to DedicatedServer.init - this.T = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + MinecraftServer.k = this; + // this.universe = file; // CraftBukkit +- this.q = new ServerConnection(this); ++ // this.q = new ServerConnection(this); // Spigot + this.Z = new UserCache(this, file1); + this.p = this.h(); + // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } // Spigot End - public ServerConnection ai() { -- return this.p; -+ return ( this.p ) == null ? this.p = new ServerConnection( this ) : this.p; // Spigot + public ServerConnection ao() { +- return this.q; ++ return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot } - public boolean ak() { + public boolean aq() { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch b/CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch similarity index 90% rename from CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch rename to CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch index fa69feed8e..87b4e41195 100644 --- a/CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch +++ b/CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch @@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { private void a(World world) { - if (this.e == null) { + if (this.d == null) { // Spigot Start - if ( world.spigotConfig.saveStructureInfo ) + if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) ) { - this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); } else -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch b/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch deleted file mode 100644 index 0bd0a7dacd..0000000000 --- a/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 8 Dec 2013 16:52:42 +1100 -Subject: [PATCH] Remove OS X Special Chars from Signs - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - - for (j = 0; j < 4; ++j) { - boolean flag = true; -+ packetplayinupdatesign.f()[j] = packetplayinupdatesign.f()[j].replaceAll( "\uF700", "" ).replaceAll( "\uF701", "" ); // Spigot - Mac OSX sends weird chars - - if (packetplayinupdatesign.f()[j].length() > 15) { - flag = false; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch similarity index 79% rename from CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch rename to CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch index b636806913..74c07fbe18 100644 --- a/CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch +++ b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch @@ -8,14 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } } catch (Throwable throwable) { - i.error("Encountered an unexpected exception", throwable); + MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable); + // Spigot Start + if ( throwable.getCause() != null ) + { -+ i.error( "\tCause of unexpected exception was", throwable.getCause() ); ++ MinecraftServer.LOGGER.error( "\tCause of unexpected exception was", throwable.getCause() ); + } + // Spigot End CrashReport crashreport = null; diff --git a/CraftBukkit-Patches/0068-Particle-API.patch b/CraftBukkit-Patches/0061-Particle-API.patch similarity index 73% rename from CraftBukkit-Patches/0068-Particle-API.patch rename to CraftBukkit-Patches/0061-Particle-API.patch index 27d7e2a1d1..141243b579 100644 --- a/CraftBukkit-Patches/0068-Particle-API.patch +++ b/CraftBukkit-Patches/0061-Particle-API.patch @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Validate.notNull(effect, "Effect cannot be null"); - Validate.notNull(location.getWorld(), "World cannot be null"); - int packetData = effect.getId(); -- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false); +- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), data, false); - int distance; - radius *= radius; - @@ -73,20 +73,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( effect.getType() != Effect.Type.PARTICLE ) + { + int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); ++ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); + } else + { -+ StringBuilder particleFullName = new StringBuilder(); -+ particleFullName.append( effect.getName() ); -+ if ( effect.getData() != null && ( effect.getData().equals( org.bukkit.Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) ++ net.minecraft.server.EnumParticle particle = null; ++ int[] extra = null; ++ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) + { -+ particleFullName.append( '_' ).append( id ); ++ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) ++ { ++ particle = p; ++ if ( effect.getData() != null ) ++ { ++ if ( effect.getData().equals( org.bukkit.Material.class ) ) ++ { ++ extra = new int[]{ id }; ++ } else ++ { ++ extra = new int[]{ (id << 4) | data }; ++ } ++ } ++ break; ++ } + } -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ++ if ( extra == null ) + { -+ particleFullName.append( '_' ).append( data ); ++ extra = new int[0]; + } -+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); ++ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); + } + int distance; + radius *= radius; @@ -135,20 +149,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( effect.getType() != Effect.Type.PARTICLE ) + { + int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); ++ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); + } else + { -+ StringBuilder particleFullName = new StringBuilder(); -+ particleFullName.append( effect.getName() ); -+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) ++ net.minecraft.server.EnumParticle particle = null; ++ int[] extra = null; ++ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) + { -+ particleFullName.append( '_' ).append( id ); ++ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) ++ { ++ particle = p; ++ if ( effect.getData() != null ) ++ { ++ if ( effect.getData().equals( org.bukkit.Material.class ) ) ++ { ++ extra = new int[]{ id }; ++ } else ++ { ++ extra = new int[]{ (id << 4) | data }; ++ } ++ } ++ break; ++ } + } -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ++ if ( extra == null ) + { -+ particleFullName.append( '_' ).append( data ); ++ extra = new int[0]; + } -+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); ++ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); + } + int distance; + radius *= radius; diff --git a/CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch b/CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch similarity index 81% rename from CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch rename to CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch index 01443e649f..2bfc537e22 100644 --- a/CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch +++ b/CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch @@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); + nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived); // CraftBukkit end - this.b(nbttagcompound); - if (this.vehicle != null) { -@@ -0,0 +0,0 @@ public abstract class Entity { + if (this.getCustomName() != null && this.getCustomName().length() > 0) { + nbttagcompound.setString("CustomName", this.getCustomName()); +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { if (this instanceof EntityLiving) { EntityLiving entity = (EntityLiving) this; diff --git a/CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch similarity index 53% rename from CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch rename to CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch index 0a686e0d11..3714c6d16d 100644 --- a/CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch +++ b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch @@ -14,14 +14,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - for (int k1 = i; k1 < j; ++k1) { - for (int l1 = i1; l1 < j1; ++l1) { -- if (this.isLoaded(k1, 64, l1)) { +- if (this.isLoaded(new BlockPosition(k1, 64, l1))) { - for (int i2 = k - 1; i2 < l; ++i2) { -- Block block; +- BlockPosition blockposition = new BlockPosition(k1, i2, l1); +- boolean flag = entity.aS(); +- boolean flag1 = this.a(this.af(), entity); - -- if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { -- block = this.getType(k1, i2, l1); -- } else { -- block = Blocks.STONE; +- if (flag && flag1) { +- entity.h(false); +- } else if (!flag && !flag1) { +- entity.h(true); +- } + // Spigot start + int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 ); + for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ ) @@ -29,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int cx = chunkx << 4; + for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) + { -+ if ( !this.isChunkLoaded( chunkx, chunkz ) ) ++ if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) + { + continue; + } @@ -47,14 +50,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + for ( int y = ystart; y < l; y++ ) + { -+ Block block = chunk.getType(x - cx, y, z - cz ); ++ BlockPosition blockposition = new BlockPosition( x, y, z ); ++ boolean flag = entity.aS(); ++ boolean flag1 = this.a(this.af(), entity); ++ ++ if (flag && flag1) { ++ entity.h(false); ++ } else if (!flag && !flag1) { ++ entity.h(true); ++ } + +- IBlockData iblockdata; ++ IBlockData iblockdata; + +- if (!this.af().a(blockposition) && flag1) { +- iblockdata = Blocks.STONE.getBlockData(); +- } else { +- iblockdata = this.getType(blockposition); ++ IBlockData block; ++ if (!this.af().a(blockposition) && flag1) { ++ block = Blocks.STONE.getBlockData(); ++ } else ++ { ++ block = chunk.getBlockData( blockposition ); ++ } + if ( block != null ) + { -+ block.a( this, x, y, z, axisalignedbb, this.L, entity ); ++ block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity); + } } - -- block.a(this, k1, i2, l1, axisalignedbb, this.L, entity); +- iblockdata.getBlock().a(this, blockposition, iblockdata, axisalignedbb, arraylist, entity); } } } diff --git a/CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch similarity index 90% rename from CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch rename to CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch index 06ce4f52d7..8f18b87ba2 100644 --- a/CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch +++ b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = 0; @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.a("checkDespawn"); - this.w(); + this.D(); this.world.methodProfiler.b(); + // Spigot Start + if ( this.fromMobSpawner ) @@ -31,14 +31,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End this.world.methodProfiler.a("sensing"); - this.bq.a(); + this.bi.a(); this.world.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); if (!event.isCancelled()) { entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot Start @@ -51,9 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end } @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); if (!event.isCancelled()) { - this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot Start + if ( entity.world.spigotConfig.nerfSpawnerMobs ) + { diff --git a/CraftBukkit-Patches/0073-Warn-if-PermGen-may-be-insufficient.patch b/CraftBukkit-Patches/0065-Warn-if-PermGen-may-be-insufficient.patch similarity index 100% rename from CraftBukkit-Patches/0073-Warn-if-PermGen-may-be-insufficient.patch rename to CraftBukkit-Patches/0065-Warn-if-PermGen-may-be-insufficient.patch diff --git a/CraftBukkit-Patches/0074-Disable-Connected-Check-on-setScoreboard.patch b/CraftBukkit-Patches/0066-Disable-Connected-Check-on-setScoreboard.patch similarity index 100% rename from CraftBukkit-Patches/0074-Disable-Connected-Check-on-setScoreboard.patch rename to CraftBukkit-Patches/0066-Disable-Connected-Check-on-setScoreboard.patch diff --git a/CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch similarity index 74% rename from CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch rename to CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch index 2a70b7fe44..c4dd480c4d 100644 --- a/CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch +++ b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch @@ -11,14 +11,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.a(MinecraftEncryption.b()); - i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L()); + DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.Q()); + if (!org.spigotmc.SpigotConfig.lateBind) { try { - this.ai().a(inetaddress, this.L()); + this.ao().a(inetaddress, this.Q()); } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - i.warn("Perhaps a server is already running on that port?"); + DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); return false; } + } @@ -31,17 +31,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (org.spigotmc.SpigotConfig.lateBind) { + try { -+ this.ai().a(inetaddress, this.L()); ++ this.ao().a(inetaddress, this.Q()); + } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable -+ i.warn("**** FAILED TO BIND TO PORT!"); -+ i.warn("The exception was: {}", new Object[] { ioexception.toString()}); -+ i.warn("Perhaps a server is already running on that port?"); ++ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); ++ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); ++ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); + return false; + } + } - return true; - } - } ++ + if (false && this.aQ() > 0L) { // Spigot - disable + Thread thread = new Thread(new ThreadWatchdog(this)); + diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch b/CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch similarity index 94% rename from CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch rename to CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch index e2570b9ee8..5c2f96f622 100644 --- a/CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch +++ b/CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java @@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { - public ServerStatisticManager(MinecraftServer minecraftserver, File file1) { + public ServerStatisticManager(MinecraftServer minecraftserver, File file) { this.c = minecraftserver; - this.d = file1; + this.d = file; + // Spigot start + for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() ) + { @@ -39,6 +39,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = statistic.d() ? this.getStatisticValue(statistic) : 0; super.setStatistic(entityhuman, statistic, i); +@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { + return this.g; + } + +-} ++} +\ No newline at end of file diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java @@ -47,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.List; import java.util.Map; import java.util.logging.Level; -+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; ++import gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch b/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch deleted file mode 100644 index a7880bebf9..0000000000 --- a/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 5 Jan 2014 09:35:01 +1100 -Subject: [PATCH] Fix Biome Decoration Crashes - -We don't really know what affect this will have on the terrain generation, but its better than crashing and not having terrain generate at all! - -diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeDecorator.java -+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java -@@ -0,0 +0,0 @@ public class BiomeDecorator { - for (j = 0; j < this.z; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - WorldGenerator worldgenerator = biomebase.b(this.b); - - worldgenerator.generate(this.a, this.b, k, i1, l); -@@ -0,0 +0,0 @@ public class BiomeDecorator { - for (j = 0; j < this.A; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - (new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l); - } - -@@ -0,0 +0,0 @@ public class BiomeDecorator { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; - -- for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { -+ for (i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { // Spigot - ; - } - -@@ -0,0 +0,0 @@ public class BiomeDecorator { - if (this.b.nextInt(8) == 0) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.r.generate(this.a, this.b, k, i1, l); - } - } -@@ -0,0 +0,0 @@ public class BiomeDecorator { - if (this.b.nextInt(4) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - this.q.generate(this.a, this.b, j, l, k); - } - - if (this.b.nextInt(8) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - this.r.generate(this.a, this.b, j, l, k); - } - - for (j = 0; j < this.C; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.t.generate(this.a, this.b, k, i1, l); - } - - for (j = 0; j < 10; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.t.generate(this.a, this.b, k, i1, l); - } - - if (this.b.nextInt(32) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - (new WorldGenPumpkin()).generate(this.a, this.b, j, l, k); - } - - for (j = 0; j < this.D; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.u.generate(this.a, this.b, k, i1, l); - } - -@@ -0,0 +0,0 @@ public class BiomeDecorator { - this.a(1, this.n, 0, 16); - this.b(1, this.o, 16, 16); - } -+ -+ // Spigot Start -+ private int getHighestBlockYAt(int x, int z) -+ { -+ return Math.max( 1, this.a.getHighestBlockYAt( x, z ) ); -+ } -+ // Spigot End - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch b/CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch similarity index 82% rename from CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch rename to CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch index fffed616a0..43bfc66f58 100644 --- a/CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch +++ b/CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class ItemStack { } - public boolean g() { -- return this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable"); + public boolean e() { +- return this.item == null ? false : (this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable")); + // Spigot Start + if ( this.item.getMaxDurability() <= 0 ) + { diff --git a/CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch similarity index 89% rename from CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch rename to CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch index 2f6c9d7163..a97b4b9192 100644 --- a/CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch +++ b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch @@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs worldserver.doTick(); worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { + } catch (Throwable throwable1) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable, "Exception ticking world"); + crashreport = CrashReport.a(throwable1, "Exception ticking world"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } @@ -22,13 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 worldserver.a(crashreport); throw new ReportedException(crashreport); } -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs worldserver.tickEntities(); worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { + } catch (Throwable throwable2) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); + crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } diff --git a/CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch similarity index 96% rename from CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch rename to CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch index 2c10b58c33..2e6d7b93eb 100644 --- a/CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch +++ b/CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch @@ -9,10 +9,10 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.u.savePlayers(); + this.v.savePlayers(); - this.saveChunks(true); + // Spigot Start + // We replace this with saving each individual world as this.saveChunks(...) is broken, diff --git a/CraftBukkit-Patches/0082-Support-vanilla-s-direction-tag-on-fireballs.patch b/CraftBukkit-Patches/0072-Support-vanilla-s-direction-tag-on-fireballs.patch similarity index 100% rename from CraftBukkit-Patches/0082-Support-vanilla-s-direction-tag-on-fireballs.patch rename to CraftBukkit-Patches/0072-Support-vanilla-s-direction-tag-on-fireballs.patch diff --git a/CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch b/CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch similarity index 97% rename from CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch rename to CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch index e897a4a9f2..71ac1ce162 100644 --- a/CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch +++ b/CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 static { Builder builder = ImmutableMap.builder(); @@ -0,0 +0,0 @@ public final class CraftChatMessage { - currentChatComponent = null; + } break; case 3: + if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) { diff --git a/CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch b/CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch similarity index 85% rename from CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch rename to CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch index 46db27fc08..5dcd77ed46 100644 --- a/CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch +++ b/CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch @@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java @@ -0,0 +0,0 @@ public class NBTTagByteArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); ++ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (8 * j)); this.data = new byte[j]; @@ -22,9 +22,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java @@ -0,0 +0,0 @@ public class NBTTagIntArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); ++ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (32 * j)); this.data = new int[j]; diff --git a/CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch b/CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch similarity index 80% rename from CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch rename to CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch index 00a1b916c4..8a46ae28d5 100644 --- a/CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch +++ b/CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch @@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -0,0 +0,0 @@ public class BlockPortal extends BlockHalfTransparent { - public void a(World world, int i, int j, int k, Random random) { - super.a(world, i, j, k, random); -- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { -+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { // Spigot - int l; + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + super.b(world, blockposition, iblockdata, random); +- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { ++ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { // Spigot + int i = blockposition.getY(); - for (l = j; !World.a((IBlockAccess) world, i, l, k) && l > 0; --l) { + BlockPosition blockposition1; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch similarity index 77% rename from CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch rename to CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch index 009f94f5b3..745e68b4d4 100644 --- a/CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch +++ b/CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; // CraftBukkit end @@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final double[] recentTps = new double[ 3 ]; + // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet - this.X = new UserCache(this, a); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + this.d = proxy; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.isRunning = false; } @@ -35,27 +35,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void run() { try { if (this.init()) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.q.setServerInfo(new ServerPingServerData("1.7.10", 5)); - this.a(this.q); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.r.setServerInfo(new ServerPingServerData("1.8", 47)); + this.a(this.r); + // Spigot start + Arrays.fill( recentTps, 20 ); + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; while (this.isRunning) { -- long k = ar(); -- long l = k - i; +- long j = ax(); +- long k = j - this.ab; - -- if (l > 2000L && i - this.P >= 15000L) { -- if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages -- MinecraftServer.i.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(l), Long.valueOf(l / 50L)}); -- l = 2000L; -- this.P = i; +- if (k > 2000L && this.ab - this.R >= 15000L) { +- if (server.getWarnOnOverload()) // CraftBukkit +- MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); +- k = 2000L; +- this.R = this.ab; - } - -- if (l < 0L) { -- MinecraftServer.i.warn("Time ran backwards! Did the system time change?"); -- l = 0L; +- if (k < 0L) { +- MinecraftServer.LOGGER.warn("Time ran backwards! Did the system time change?"); +- k = 0L; + curTime = System.nanoTime(); + wait = TICK_TIME - (curTime - lastTick) - catchupTime; + if (wait > 0) { @@ -66,16 +66,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + catchupTime = Math.min(1000000000, Math.abs(wait)); } -- j += l; -- i = k; +- i += k; +- this.ab = j; - if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.u(); -- j = 0L; +- this.y(); +- i = 0L; - } else { -- while (j > 50L) { +- while (i > 50L) { - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit -- j -= 50L; -- this.u(); +- i -= 50L; +- this.y(); - } + if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + { @@ -87,9 +87,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + lastTick = curTime; -- Thread.sleep(Math.max(1L, 50L - j)); -+ this.u(); - this.O = true; +- Thread.sleep(Math.max(1L, 50L - i)); ++ this.y(); + this.Q = true; } + // Spigot end } else { @@ -119,7 +119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.google.common.base.Joiner; +import net.minecraft.server.MinecraftServer; -+import net.minecraft.util.com.google.common.collect.Iterables; ++import com.google.common.collect.Iterables; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; diff --git a/CraftBukkit-Patches/0087-Add-Spigot-Links.patch b/CraftBukkit-Patches/0077-Add-Spigot-Links.patch similarity index 100% rename from CraftBukkit-Patches/0087-Add-Spigot-Links.patch rename to CraftBukkit-Patches/0077-Add-Spigot-Links.patch diff --git a/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch b/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch deleted file mode 100644 index 17cb949f92..0000000000 --- a/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 9 Jan 2014 14:19:12 +0000 -Subject: [PATCH] Fix anvil collisions - - -diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockAnvil.java -+++ b/src/main/java/net/minecraft/server/BlockAnvil.java -@@ -0,0 +0,0 @@ public class BlockAnvil extends BlockFalling { - this.a(CreativeModeTab.c); - } - -+ // Spigot start -+ @Override -+ public AxisAlignedBB a( World world, int i, int j, int k ) -+ { -+ updateShape( world, i, j, k ); -+ return super.a( world, i, j, k ); -+ } -+ // Spigot end -+ - public boolean d() { - return false; - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0088-Configurable-Ping-Sample-Size.patch b/CraftBukkit-Patches/0078-Configurable-Ping-Sample-Size.patch similarity index 100% rename from CraftBukkit-Patches/0088-Configurable-Ping-Sample-Size.patch rename to CraftBukkit-Patches/0078-Configurable-Ping-Sample-Size.patch diff --git a/CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch b/CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch similarity index 91% rename from CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch rename to CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch index 80eb917323..bcc4d436a9 100644 --- a/CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch +++ b/CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch @@ -10,17 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java @@ -0,0 +0,0 @@ public class ServerConnection { - List list = this.f; + List list = this.g; - synchronized (this.f) { + synchronized (this.g) { + // Spigot Start + // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order + if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) + { -+ Collections.shuffle( this.f ); ++ Collections.shuffle( this.g ); + } + // Spigot End - Iterator iterator = this.f.iterator(); + Iterator iterator = this.g.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch b/CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch similarity index 91% rename from CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch rename to CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch index 99478e29c3..eff6b3b0d9 100644 --- a/CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch +++ b/CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Chunk chunk; -- while (iterator1.hasNext() && arraylist.size() < PacketPlayOutMapChunkBulk.c()) { +- while (iterator1.hasNext() && arraylist.size() < 10) { + while (iterator1.hasNext() && arraylist.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public int maxBulkChunk; + private void bulkChunkCount() + { -+ maxBulkChunk = getInt( "max-bulk-chunks", 5 ); ++ maxBulkChunk = getInt( "max-bulk-chunks", 10 ); + log( "Sending up to " + maxBulkChunk + " chunks per packet" ); + } } diff --git a/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch b/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch deleted file mode 100644 index 96d857633e..0000000000 --- a/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 15 Jan 2014 21:52:47 +0000 -Subject: [PATCH] Block data values that crash the client - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - } - - this.sections[l1].setTypeId(l, j1 & 15, i1, block); -- this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]); -+ this.sections[l1].setData(l, j1 & 15, i1, checkData( block, abyte[k1] ) ); - } - } - } -@@ -0,0 +0,0 @@ public class Chunk { - } - } - -+ // Spigot start - prevent invalid data values -+ public static int checkData( Block block, int data ) -+ { -+ if (block == Blocks.DOUBLE_PLANT ) -+ { -+ return data < 6 || data >= 8 ? data : 0; -+ } -+ return data; -+ } -+ // Spigot end -+ - public boolean a(int i, int j, int k, Block block, int l) { - int i1 = k << 4 | i; - -@@ -0,0 +0,0 @@ public class Chunk { - if (chunksection.getTypeId(i, j & 15, k) != block) { - return false; - } else { -- chunksection.setData(i, j & 15, k, l); -+ chunksection.setData(i, j & 15, k, checkData( block, l ) ); - if (flag) { - this.initLighting(); - } else { -@@ -0,0 +0,0 @@ public class Chunk { - return false; - } else { - this.n = true; -- chunksection.setData(i, j & 15, k, l); -- if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) { -+ Block block = chunksection.getTypeId( i, j & 15, k ); -+ chunksection.setData(i, j & 15, k, checkData( block, l ) ); -+ if (block instanceof IContainer) { - TileEntity tileentity = this.e(i, j, k); - - if (tileentity != null) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch b/CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch similarity index 96% rename from CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch rename to CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch index 3d945169c4..d891ff401f 100644 --- a/CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch +++ b/CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bL = LogManager.getLogger(); + private static final Logger bF = LogManager.getLogger(); - private String locale = "en_US"; + public String locale = "en_US"; // Spigot public PlayerConnection playerConnection; diff --git a/CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch b/CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch similarity index 82% rename from CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch rename to CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch index 5ea44b01b2..049d5dae96 100644 --- a/CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch +++ b/CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch @@ -10,47 +10,47 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - public void b_(EntityHuman entityhuman) {} + public void d(EntityHuman entityhuman) {} + int numCollisions = 0; // Spigot public void collide(Entity entity) { if (entity.passenger != this && entity.vehicle != this) { - double d0 = entity.locX - this.locX; + if (!entity.T && !this.T) { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition + if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition + numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot for (int i = 0; i < list.size(); ++i) { + if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot Entity entity = (Entity) list.get(i); - + // TODO better check now? @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end - if (entity.S()) { + if (entity.ae()) { + entity.numCollisions++; // Spigot + numCollisions++; // Spigot - this.o(entity); + this.s(entity); } } + numCollisions = 0; // Spigot } - } + } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig - maxBulkChunk = getInt( "max-bulk-chunks", 5 ); + maxBulkChunk = getInt( "max-bulk-chunks", 10 ); log( "Sending up to " + maxBulkChunk + " chunks per packet" ); } + diff --git a/CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch b/CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch similarity index 86% rename from CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch rename to CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch index d2f1ba9603..139e68cb72 100644 --- a/CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch +++ b/CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java @@ -0,0 +0,0 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { - + // CraftBukkit start - org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); - CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); if (!BlockDispenser.eventFired) { diff --git a/CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch similarity index 91% rename from CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch rename to CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch index 044652b905..58ec815e8d 100644 --- a/CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch +++ b/CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch @@ -8,11 +8,11 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); } -+ // Spigot - spam exclusions ++ // Spigot start - spam exclusions + boolean counted = true; + for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions ) + { @@ -22,11 +22,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + } + } ++ // Spigot end // CraftBukkit start - replaced with thread safe throttle // this.chatThrottle += 20; - if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { - if (packetplayinchat.a()) { ++ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Spigot + if (!isSync) { Waitable waitable = new Waitable() { @Override diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch b/CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch similarity index 77% rename from CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch rename to CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch index 9ad2d73ed8..604ae1e8a9 100644 --- a/CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch +++ b/CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- if (icommandlistener != MinecraftServer.getServer()) { -+ if (icommandlistener != MinecraftServer.getServer() && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot - MinecraftServer.getServer().sendMessage(chatmessage); +- if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { ++ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands") && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot + minecraftserver.sendMessage(chatmessage); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0096-Add-support-for-fetching-hidden-players.patch b/CraftBukkit-Patches/0086-Add-support-for-fetching-hidden-players.patch similarity index 100% rename from CraftBukkit-Patches/0096-Add-support-for-fetching-hidden-players.patch rename to CraftBukkit-Patches/0086-Add-support-for-fetching-hidden-players.patch diff --git a/CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch similarity index 83% rename from CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch rename to CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch index dba2b728f3..1075ba0b8c 100644 --- a/CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch +++ b/CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch @@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - ItemStack itemstack = packetplayinsetcreativeslot.getItemStack(); - boolean flag1 = packetplayinsetcreativeslot.c() >= 1 && packetplayinsetcreativeslot.c() < 36 + PlayerInventory.getHotbarSize(); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + + boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); // CraftBukkit - Add invalidItems check - boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem())); + boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; - - // CraftBukkit start - Call click event + + diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch b/CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch similarity index 86% rename from CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch rename to CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch index 7a4282e722..7a23267362 100644 --- a/CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch +++ b/CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void addChannel(String channel) { -+ com.google.common.base.Preconditions.checkState( channels.size() < 128, "Too many channels registered" ); // Spigot ++ com.google.common.base.Preconditions.checkState( channels.size() < 128, "Too many channels registered" ); // Spigot if (channels.add(channel)) { server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); } diff --git a/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch new file mode 100644 index 0000000000..b97a831736 --- /dev/null +++ b/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Wed, 12 Feb 2014 20:44:14 +0000 +Subject: [PATCH] Allow vanilla commands to be the main version of a command + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + } + + if (type == PluginLoadOrder.POSTWORLD) { ++ // Spigot start - Allow vanilla commands to be forced to be the main command ++ setVanillaCommands(true); + commandMap.setFallbackCommands(); +- setVanillaCommands(); ++ setVanillaCommands(false); ++ // Spigot end + commandMap.registerServerAliases(); + loadCustomPermissions(); + DefaultPermissions.registerCorePermissions(); +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + pluginManager.disablePlugins(); + } + +- private void setVanillaCommands() { ++ private void setVanillaCommands(boolean first) { // Spigot + Map commands = new CommandDispatcher().getCommands(); + for (ICommand cmd : commands.values()) { +- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null)))); ++ // Spigot start ++ VanillaCommandWrapper wrapper = new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))); ++ if (org.spigotmc.SpigotConfig.replaceCommands.contains( wrapper.getName() ) ) { ++ if (first) { ++ commandMap.register("minecraft", wrapper); ++ } ++ } else if (!first) { ++ commandMap.register("minecraft", wrapper); ++ } ++ // Spigot end + } + } + +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -0,0 +0,0 @@ import java.lang.reflect.Method; + import java.lang.reflect.Modifier; + import java.util.Arrays; + import java.util.HashMap; ++import java.util.HashSet; + import java.util.List; + import java.util.Map; ++import java.util.Set; + import java.util.logging.Level; + import gnu.trove.map.hash.TObjectIntHashMap; + import net.minecraft.server.MinecraftServer; +@@ -0,0 +0,0 @@ public class SpigotConfig + { + filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); + } ++ ++ public static Set replaceCommands; ++ private static void replaceCommands() ++ { ++ if ( config.contains( "replace-commands" ) ) ++ { ++ set( "commands.replace-commands", config.getStringList( "replace-commands" ) ); ++ config.set( "replace-commands", null ); ++ } ++ replaceCommands = new HashSet( (List) getList( "commands.replace-commands", ++ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); ++ } + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch b/CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch similarity index 90% rename from CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch rename to CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch index 76a98200ff..a95d9ef1a5 100644 --- a/CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch +++ b/CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } // CraftBukkit start - Add "isDisconnected" method @@ -17,5 +17,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean isDisconnected() { return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead(); } - // CraftBukkit end + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch b/CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch similarity index 84% rename from CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch rename to CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch index 76ea806fb5..579a7c5130 100644 --- a/CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch +++ b/CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch @@ -18,19 +18,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this(world, d0, d1, d2, false); } @@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather { + } + } } - } ++ } + // Spigot start + public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent) + { + this( world, d0, d1, d2, isEffect ); + this.isSilent = isSilent; -+ } + } + // Spigot end -+ - public void h() { - super.h(); + + public void s_() { + super.s_(); - if (this.lifeTicks == 2) { + if (!isSilent && this.lifeTicks == 2) { // Spigot // CraftBukkit start - Use relative location for far away sounds @@ -67,37 +69,16 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - - import net.minecraft.server.EntityLightning; -+ - import org.bukkit.craftbukkit.CraftServer; -+import org.bukkit.entity.Arrow; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.LightningStrike; - @@ -0,0 +0,0 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike - public EntityType getType() { - return EntityType.LIGHTNING; - } -+ -+ // Spigot start -+ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() -+ { -+ + // Spigot start + private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { + + @Override + public boolean isSilent() + { + return getHandle().isSilent; + } -+ -+ }; -+ -+ public LightningStrike.Spigot spigot() -+ { -+ return this.spigot; -+ } -+ // Spigot end - } + }; + + @Override -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0102-Use-one-PermissibleBase-for-all-Command-Blocks.patch b/CraftBukkit-Patches/0092-Use-one-PermissibleBase-for-all-Command-Blocks.patch similarity index 100% rename from CraftBukkit-Patches/0102-Use-one-PermissibleBase-for-all-Command-Blocks.patch rename to CraftBukkit-Patches/0092-Use-one-PermissibleBase-for-all-Command-Blocks.patch diff --git a/CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch b/CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch similarity index 70% rename from CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch rename to CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch index 71259fef32..da96ad8080 100644 --- a/CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch +++ b/CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch @@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { - int i = MathHelper.floor(d0); +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); -+ if ( !world.isLoaded( i, j, k ) ) return null; // Spigot - TileEntity tileentity = world.getTileEntity(i, j, k); + BlockPosition blockposition = new BlockPosition(i, j, k); ++ if ( !world.isLoaded( blockposition ) ) return null; // Spigot + TileEntity tileentity = world.getTileEntity(new BlockPosition(i, j, k)); - if (tileentity != null && tileentity instanceof IInventory) { + if (tileentity instanceof IInventory) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0104-Guard-Entity-List.patch b/CraftBukkit-Patches/0094-Guard-Entity-List.patch similarity index 85% rename from CraftBukkit-Patches/0104-Guard-Entity-List.patch rename to CraftBukkit-Patches/0094-Guard-Entity-List.patch index 56a54d5456..eb46f552ca 100644 --- a/CraftBukkit-Patches/0104-Guard-Entity-List.patch +++ b/CraftBukkit-Patches/0094-Guard-Entity-List.patch @@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ import org.bukkit.event.weather.ThunderChangeEvent; public abstract class World implements IBlockAccess { - public boolean d; -- public List entityList = new ArrayList(); + protected boolean e; +- public final List entityList = Lists.newArrayList(); + // Spigot start - guard entity list from removals -+ public List entityList = new ArrayList() ++ public List entityList = new java.util.ArrayList() + { + @Override + public Object remove(int index) @@ -39,15 +39,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }; + // Spigot end - protected List f = new ArrayList(); - public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet - private List a = new ArrayList(); + protected final List g = Lists.newArrayList(); + public final List h = Lists.newArrayList(); + public final List tileEntityList = Lists.newArrayList(); @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - int[] I; + private int tickPosition; // Spigot start + private boolean guardEntityList; - protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; protected float growthOdds = 100; protected float modifiedOdds = 100; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { diff --git a/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch new file mode 100644 index 0000000000..86e7a3ca71 --- /dev/null +++ b/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Tue, 14 Jan 2014 20:11:25 +0000 +Subject: [PATCH] Fix ConcurrentModificationException while being idle kicked + in a vehicle + + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.everyoneSleeping(); + } + ++ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking + int i = entity.ae; + int j = entity.ag; + +@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + this.entityList.remove(index); + } + // CraftBukkit end ++ } // Spigot + this.b(entity); + } + +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch similarity index 75% rename from CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch rename to CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch index da1c63aeed..d42cd57b9e 100644 --- a/CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch +++ b/CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch @@ -15,10 +15,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot start + boolean didDamage = false; if (this.shooter != null) { -- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F) && !movingobjectposition.entity.isAlive()) { +- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F)) { + didDamage = movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F); -+ if (didDamage && !movingobjectposition.entity.isAlive()) { - this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit ++ if (didDamage) { + if (!movingobjectposition.entity.isAlive()) { + this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit + } else { +@@ -0,0 +0,0 @@ public class EntityWitherSkull extends EntityFireball { + } } } else { - movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); @@ -30,5 +34,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end byte b0 = 0; - if (this.world.difficulty == EnumDifficulty.NORMAL) { + if (this.world.getDifficulty() == EnumDifficulty.NORMAL) { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch b/CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch similarity index 68% rename from CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch rename to CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch index ab61acccd0..f779134c8e 100644 --- a/CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch +++ b/CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch @@ -8,19 +8,19 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { - if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) { if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw"); + this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw"); - ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); + ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)"); //Spigot "Nope" -> Descriptive reason } f = 0; } -@@ -0,0 +0,0 @@ public abstract class Entity { - if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) { if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch"); + this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch"); - ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); + ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)"); //Spigot "Nope" -> Descriptive reason } @@ -30,19 +30,19 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start - Check for NaN - if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) { + if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z)) { c.warn(player.getName() + " was caught trying to crash the server with an invalid position."); - getPlayer().kickPlayer("Nope!"); + getPlayer().kickPlayer("NaN in position (Hacking?)"); //Spigot "Nope" -> Descriptive reason return; } // CraftBukkit end -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - this.player.v(); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + this.player.z(); } else { - c.warn(this.player.getName() + " tried to set an invalid carried item"); + PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item"); - this.disconnect("Nope!"); // CraftBukkit + this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason } diff --git a/CraftBukkit-Patches/0111-Configurable-dragon-death-and-wither-spawn-sounds.patch b/CraftBukkit-Patches/0098-Configurable-dragon-death-and-wither-spawn-sounds.patch similarity index 100% rename from CraftBukkit-Patches/0111-Configurable-dragon-death-and-wither-spawn-sounds.patch rename to CraftBukkit-Patches/0098-Configurable-dragon-death-and-wither-spawn-sounds.patch diff --git a/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch deleted file mode 100644 index 7843428038..0000000000 --- a/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 12 Feb 2014 20:44:14 +0000 -Subject: [PATCH] Allow vanilla commands to be the main version of a command - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender; - import org.bukkit.command.ConsoleCommandSender; - import org.bukkit.command.PluginCommand; - import org.bukkit.command.SimpleCommandMap; -+import org.bukkit.command.defaults.VanillaCommand; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.file.YamlConfiguration; - import org.bukkit.configuration.serialization.ConfigurationSerialization; -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - } - - if (type == PluginLoadOrder.POSTWORLD) { -+ // Spigot start - Allow vanilla commands to be forced to be the main command -+ setVanillaCommands(true); - commandMap.setFallbackCommands(); -- setVanillaCommands(); -+ setVanillaCommands(false); -+ // Spigot end - commandMap.registerServerAliases(); - loadCustomPermissions(); - DefaultPermissions.registerCorePermissions(); -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - pluginManager.disablePlugins(); - } - -- private void setVanillaCommands() { -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandAchievement(), "/achievement give [player]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBan(), "/ban [reason]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBanIp(), "/ban-ip ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBanList(), "/banlist [ips]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandClear(), "/clear [item] [metadata]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamemodeDefault(), "/defaultgamemode ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandDeop(), "/deop ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandDifficulty(), "/difficulty ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandEffect(), "/effect [seconds] [amplifier]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandEnchant(), "/enchant [enchantment level]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamemode(), "/gamemode [player]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamerule(), "/gamerule [true|false]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGive(), "/give [amount] [metadata] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandHelp(), "/help [page|commandname]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandIdleTimeout(), "/setidletimeout ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandKick(), "/kick [reason]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandKill(), "/kill [playername]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandList(), "/list")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandMe(), "/me ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandOp(), "/op ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPardon(), "/pardon ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPardonIP(), "/pardon-ip ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPlaySound(), "/playsound [x] [y] [z] [volume] [pitch] [minimumVolume]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSay(), "/say ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandScoreboard(), "/scoreboard")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSeed(), "/seed")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSetBlock(), "/setblock [datavalue] [oldblockHandling] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSetWorldSpawn(), "/setworldspawn [x] [y] [z]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSpawnpoint(), "/spawnpoint [x] [y] [z]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSpreadPlayers(), "/spreadplayers [spreadDistance] [maxRange] [respectTeams] ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSummon(), "/summon [x] [y] [z] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTp(), "/tp [player] \n/tp [player] ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTell(), "/tell ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTellRaw(), "/tellraw ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTestFor(), "/testfor [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTestForBlock(), "/testforblock [datavalue] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTime(), "/time set \n/time add ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandToggleDownfall(), "/toggledownfall")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandWeather(), "/weather [duration in seconds]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandWhitelist(), "/whitelist (add|remove) \n/whitelist (on|off|list|reload)")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandXp(), "/xp [player]\n/xp L [player]")); -+ // Spigot start -+ private void tryRegister(VanillaCommandWrapper commandWrapper, boolean first) { -+ if (org.spigotmc.SpigotConfig.replaceCommands.contains( commandWrapper.getName() ) ) { -+ if (first) { -+ commandMap.register( "minecraft", commandWrapper ); -+ } -+ } else if (!first) { -+ commandMap.register( "minecraft", commandWrapper ); -+ } -+ } -+ -+ private void setVanillaCommands(boolean first) -+ { -+ tryRegister( new VanillaCommandWrapper( new CommandAchievement(), "/achievement give [player]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBan(), "/ban [reason]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBanIp(), "/ban-ip " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBanList(), "/banlist [ips]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandClear(), "/clear [item] [metadata]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamemodeDefault(), "/defaultgamemode " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandDeop(), "/deop " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandDifficulty(), "/difficulty " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandEffect(), "/effect [seconds] [amplifier]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandEnchant(), "/enchant [enchantment level]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamemode(), "/gamemode [player]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamerule(), "/gamerule [true|false]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGive(), "/give [amount] [metadata] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandHelp(), "/help [page|commandname]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandIdleTimeout(), "/setidletimeout " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandKick(), "/kick [reason]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandKill(), "/kill [playername]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandList(), "/list" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandMe(), "/me " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandOp(), "/op " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPardon(), "/pardon " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPardonIP(), "/pardon-ip " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPlaySound(), "/playsound [x] [y] [z] [volume] [pitch] [minimumVolume]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSay(), "/say " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandScoreboard(), "/scoreboard" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSeed(), "/seed" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSetBlock(), "/setblock [datavalue] [oldblockHandling] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSetWorldSpawn(), "/setworldspawn [x] [y] [z]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSpawnpoint(), "/spawnpoint [x] [y] [z]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSpreadPlayers(), "/spreadplayers [spreadDistance] [maxRange] [respectTeams] " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSummon(), "/summon [x] [y] [z] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTp(), "/tp [player] \n/tp [player] " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTell(), "/tell " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTellRaw(), "/tellraw " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTestFor(), "/testfor [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTestForBlock(), "/testforblock [datavalue] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTime(), "/time set \n/time add " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandToggleDownfall(), "/toggledownfall" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandWeather(), "/weather [duration in seconds]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandWhitelist(), "/whitelist (add|remove) \n/whitelist (on|off|list|reload)" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandXp(), "/xp [player]\n/xp L [player]" ), first ); - // This is what is in the lang file, I swear. -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandNetstat(), "/list")); -+ tryRegister( new VanillaCommandWrapper(new CommandNetstat(), "/list"), first ); - } -+ // Spigot end - - private void loadPlugin(Plugin plugin) { - try { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ import java.lang.reflect.Method; - import java.lang.reflect.Modifier; - import java.util.Arrays; - import java.util.HashMap; -+import java.util.HashSet; - import java.util.List; - import java.util.Map; -+import java.util.Set; - import java.util.logging.Level; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; - import net.minecraft.server.MinecraftServer; -@@ -0,0 +0,0 @@ public class SpigotConfig - { - filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); - } -+ -+ public static Set replaceCommands; -+ private static void replaceCommands() -+ { -+ if ( config.contains( "replace-commands" ) ) -+ { -+ set( "commands.replace-commands", config.getStringList( "replace-commands" ) ); -+ config.set( "replace-commands", null ); -+ } -+ replaceCommands = new HashSet( (List) getList( "commands.replace-commands", -+ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); -+ } - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch b/CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch similarity index 96% rename from CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch rename to CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch index 763043e36a..89cecad8c5 100644 --- a/CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch +++ b/CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } public String getServerModName() { diff --git a/CraftBukkit-Patches/0114-Treat-Bungee-as-Online-Mode.patch b/CraftBukkit-Patches/0100-Treat-Bungee-as-Online-Mode.patch similarity index 100% rename from CraftBukkit-Patches/0114-Treat-Bungee-as-Online-Mode.patch rename to CraftBukkit-Patches/0100-Treat-Bungee-as-Online-Mode.patch diff --git a/CraftBukkit-Patches/0117-Add-Conversion-Message.patch b/CraftBukkit-Patches/0101-Add-Conversion-Message.patch similarity index 96% rename from CraftBukkit-Patches/0117-Add-Conversion-Message.patch rename to CraftBukkit-Patches/0101-Add-Conversion-Message.patch index 22aa800723..3c3312542f 100644 --- a/CraftBukkit-Patches/0117-Add-Conversion-Message.patch +++ b/CraftBukkit-Patches/0101-Add-Conversion-Message.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - protected boolean aE() { + protected boolean aP() { + server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up! boolean flag = false; diff --git a/CraftBukkit-Patches/0118-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch b/CraftBukkit-Patches/0102-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch similarity index 100% rename from CraftBukkit-Patches/0118-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch rename to CraftBukkit-Patches/0102-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch diff --git a/CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch b/CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch similarity index 72% rename from CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch rename to CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch index 16e71b0fc6..dcefccec14 100644 --- a/CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch +++ b/CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - } - - this.close(chatmessage); + public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { + NetworkManager.f.debug("Disconnecting " + this.getSocketAddress(), throwable); + this.close(new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable})); + if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot } diff --git a/CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch b/CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch similarity index 71% rename from CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch rename to CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch index 4d9a21effe..4b88aae57c 100644 --- a/CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch +++ b/CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { try { - File file1 = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); + File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); + // Spigot Start + boolean usingWrongFile = false; -+ if ( !file1.exists() ) ++ if ( !file.exists() ) + { -+ file1 = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); -+ if ( file1.exists() ) ++ file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); ++ if ( file.exists() ) + { + usingWrongFile = true; + org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + entityhuman.getName() + " as it is the only copy we can find." ); @@ -26,16 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot End - if (file1.exists() && file1.isFile()) { - nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + if (file.exists() && file.isFile()) { + nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file))); } + // Spigot Start + if ( usingWrongFile ) + { -+ file1.renameTo( new File( file1.getPath() + ".offline-read" ) ); ++ file.renameTo( new File( file.getPath() + ".offline-read" ) ); + } + // Spigot End } catch (Exception exception) { - a.warn("Failed to load player data for " + entityhuman.getName()); + WorldNBTStorage.a.warn("Failed to load player data for " + entityhuman.getName()); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch deleted file mode 100644 index 60acabf9c1..0000000000 --- a/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Tue, 14 Jan 2014 20:11:25 +0000 -Subject: [PATCH] Fix ConcurrentModificationException while being idle kicked - in a vehicle - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.players.remove(entity); - this.everyoneSleeping(); - } -- -- int i = entity.ah; -- int j = entity.aj; -- -- if (entity.ag && this.isChunkLoaded(i, j)) { -- this.getChunkAt(i, j).b(entity); -- } -- -- // CraftBukkit start - Decrement loop variable field if we've already ticked this entity -- int index = this.entityList.indexOf(entity); -- if (index != -1) { -- if (index <= this.tickPosition) { -- this.tickPosition--; -+ // Spigot start -+ if (!guardEntityList) { // It will get removed after the tick if we are ticking -+ int i = entity.ah; -+ int j = entity.aj; -+ if (entity.ag && this.isChunkLoaded(i, j)) { -+ this.getChunkAt(i, j).b(entity); - } -- this.entityList.remove(index); -+ // CraftBukkit start - Decrement loop variable field if we've already ticked this entity -+ int index = this.entityList.indexOf(entity); -+ if (index != -1) { -+ if (index <= this.tickPosition) { -+ this.tickPosition--; -+ } -+ this.entityList.remove(index); -+ } -+ // CraftBukkit end - } -- // CraftBukkit end -+ // Spigot end - - this.b(entity); - } --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch b/CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch similarity index 91% rename from CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch rename to CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch index 4bd3d4c8f8..432b3bf053 100644 --- a/CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch +++ b/CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - this.e.addFirst(gameprofile); - } + this.e.remove(gameprofile); + this.e.addFirst(gameprofile); } else { - gameprofile = a(this.f, s1); + gameprofile = a(this.f, s); // Spigot - use correct case for offline players diff --git a/CraftBukkit-Patches/0122-Check-for-blank-OfflinePlayer-Names.patch b/CraftBukkit-Patches/0106-Check-for-blank-OfflinePlayer-Names.patch similarity index 100% rename from CraftBukkit-Patches/0122-Check-for-blank-OfflinePlayer-Names.patch rename to CraftBukkit-Patches/0106-Check-for-blank-OfflinePlayer-Names.patch diff --git a/CraftBukkit-Patches/0123-Fix-Player-Banning.patch b/CraftBukkit-Patches/0107-Fix-Player-Banning.patch similarity index 100% rename from CraftBukkit-Patches/0123-Fix-Player-Banning.patch rename to CraftBukkit-Patches/0107-Fix-Player-Banning.patch diff --git a/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch b/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch deleted file mode 100644 index af31ca3a36..0000000000 --- a/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 23 Mar 2014 01:12:10 +0000 -Subject: [PATCH] Check for manually prefixed commands or commands that don't - need a prefix for calling vanilla commands with command blocks - - -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - } - } - -+ // Spigot start - check for manually prefixed command or commands that don't need a prefix -+ org.bukkit.command.Command commandBlockCommand = commandMap.getCommand(args[0]); -+ if (commandBlockCommand instanceof VanillaCommandWrapper) { -+ this.b = ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommandBlock(this, this.e); -+ return; -+ } -+ // Spigot end -+ - // Make sure this is a valid command - if (commandMap.getCommand(args[0]) == null) { - this.b = 0; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0124-Fix-ban-expire-dates.patch b/CraftBukkit-Patches/0108-Fix-ban-expire-dates.patch similarity index 100% rename from CraftBukkit-Patches/0124-Fix-ban-expire-dates.patch rename to CraftBukkit-Patches/0108-Fix-ban-expire-dates.patch diff --git a/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch b/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch deleted file mode 100644 index 084c7cd063..0000000000 --- a/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 23 Mar 2014 10:53:48 +0000 -Subject: [PATCH] Cap window names to prevent client disconnects - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -@@ -0,0 +0,0 @@ public class PacketPlayOutOpenWindow extends Packet { - public PacketPlayOutOpenWindow() {} - - public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { -+ if (s.length() > 32) s = s.substring( 0, 32 ); // Spigot - Cap window name to prevent client disconnects - this.a = i; - this.b = j; - this.c = s; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0125-Correct-Ban-Expiration.patch b/CraftBukkit-Patches/0109-Correct-Ban-Expiration.patch similarity index 100% rename from CraftBukkit-Patches/0125-Correct-Ban-Expiration.patch rename to CraftBukkit-Patches/0109-Correct-Ban-Expiration.patch diff --git a/CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch b/CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch similarity index 50% rename from CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch rename to CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch index a2f0a7bfe1..62023c185d 100644 --- a/CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch +++ b/CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch @@ -9,18 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityHorse.java +++ b/src/main/java/net/minecraft/server/EntityHorse.java @@ -0,0 +0,0 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { - if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) { - this.setOwnerUUID(nbttagcompound.getString("OwnerUUID")); - } -+ // Spigot start -+ else if (nbttagcompound.hasKey("OwnerName")) { -+ String owner = nbttagcompound.getString("OwnerName"); -+ if (owner != null && !owner.isEmpty()) { -+ this.setOwnerUUID(NameReferencingFileConverter.a(owner)); + s = nbttagcompound.getString("OwnerUUID"); + } else { + String s1 = nbttagcompound.getString("Owner"); ++ // Spigot start ++ if ( s1 == null || s1.isEmpty() ) ++ { ++ if (nbttagcompound.hasKey("OwnerName")) { ++ String owner = nbttagcompound.getString("OwnerName"); ++ if (owner != null && !owner.isEmpty()) { ++ s1 = owner; ++ } ++ } + } -+ } -+ // Spigot end - // CraftBukkit start - if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) { - this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); ++ // Spigot end + + s = NameReferencingFileConverter.a(s1); + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch b/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch deleted file mode 100644 index 010a48decd..0000000000 --- a/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 24 Feb 2013 20:45:20 +1100 -Subject: [PATCH] Enable Improved Ping Sending - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public boolean keepLevel = false; - public double maxHealthCache; - public boolean joining = true; -+ public int lastPing = -1; // Spigot - // CraftBukkit end - // Spigot start - public boolean collidesWithEntities = true; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - // CraftBukkit end - } - -+ private int currentPing = 0; -+ - public void tick() { - if (++this.t > 600) { - this.t = 0; -@@ -0,0 +0,0 @@ public abstract class PlayerList { - this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping)); - } - // CraftBukkit end */ -+ // Spigot start -+ try -+ { -+ if ( !players.isEmpty() ) -+ { -+ currentPing = ( currentPing + 1 ) % this.players.size(); -+ 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 ); -+ for ( EntityPlayer splayer : (List) this.players ) -+ { -+ if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) ) -+ { -+ splayer.playerConnection.sendPacket( packet ); -+ } -+ } -+ player.lastPing = player.ping; -+ } -+ } -+ } catch ( Exception e ) { -+ // Better safe than sorry :) -+ } -+ // Spigot end - } - - public void sendAll(Packet packet) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch b/CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch similarity index 77% rename from CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch rename to CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch index 0f99d60aa9..76dba7efe5 100644 --- a/CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch +++ b/CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch @@ -83,4 +83,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override +@@ -0,0 +0,0 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { + scoreboard.teams.remove(team.getName()); + setUnregistered(); + } +- +- // Spigot start +- @Override +- public Set getEntries() throws IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- // Spigot end + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch b/CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch similarity index 82% rename from CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch rename to CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch index 3a5accadb5..a48fcb77a4 100644 --- a/CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch +++ b/CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch @@ -19,19 +19,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (score != null) { // Lazy return score.getScore(); @@ -0,0 +0,0 @@ final class CraftScore implements Score { - objective.checkState().board.getPlayerScoreForObjective(entry, objective.getHandle()).setScore(score); } -+ // Spigot start + // Spigot start +- @Override + @Override -+ public boolean isScoreSet() throws IllegalStateException { + public boolean isScoreSet() throws IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); + Scoreboard board = objective.checkState().board; + + return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle()); -+ } -+ // Spigot end -+ - public CraftScoreboard getScoreboard() { - return objective.getScoreboard(); } + // Spigot end + } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch b/CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch similarity index 81% rename from CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch rename to CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch index 3734eaa798..a202d33c3c 100644 --- a/CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch +++ b/CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch @@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ public class TileEntity { +@@ -0,0 +0,0 @@ public abstract class TileEntity { // CraftBukkit start - add method public InventoryHolder getOwner() { -- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(x, y, z).getState(); +- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); + // Spigot start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(x, y, z); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); + if (block == null) { -+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), x, y, z}); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), position.getX(), position.getY(), position.getZ()}); + return null; + } + // Spigot end diff --git a/CraftBukkit-Patches/0113-Old-New-Version-Support.patch b/CraftBukkit-Patches/0113-Old-New-Version-Support.patch deleted file mode 100644 index 0d48389a2c..0000000000 --- a/CraftBukkit-Patches/0113-Old-New-Version-Support.patch +++ /dev/null @@ -1,244 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 15:11:15 +1000 -Subject: [PATCH] Old / New Version Support. - -This adds support for newer / older Minecraft versions. -At present it supports protocol versions 4 and 5 (1.7.2-1.7.8). - -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { - } - - public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) { -+ // Spigot start -+ if ( NetworkManager.SUPPORTED_VERSIONS.contains( packethandshakinginsetprotocol.d() ) ) -+ { -+ NetworkManager.a( this.b ).attr( NetworkManager.protocolVersion ).set( packethandshakinginsetprotocol.d() ); -+ } -+ // Spigot end - switch (ProtocolOrdinalWrapper.a[packethandshakinginsetprotocol.c().ordinal()]) { - case 1: - this.b.a(EnumProtocol.LOGIN); -@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { - chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); - this.b.close(chatcomponenttext); -- } else if (packethandshakinginsetprotocol.d() < 5) { -+ } else if (packethandshakinginsetprotocol.d() < 4) { - chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); - this.b.close(chatcomponenttext); -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - import org.apache.logging.log4j.Marker; - import org.apache.logging.log4j.MarkerManager; -+// Spigot start -+import com.google.common.collect.ImmutableSet; -+// Spigot end - - public class NetworkManager extends SimpleChannelInboundHandler { - -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private EnumProtocol p; - private IChatBaseComponent q; - private boolean r; -+ // Spigot Start -+ public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); -+ public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5); -+ public static final int CURRENT_VERSION = 5; -+ public static int getVersion(Channel attr) -+ { -+ Integer ver = attr.attr( protocolVersion ).get(); -+ return ( ver != null ) ? ver : CURRENT_VERSION; -+ } -+ public int getVersion() -+ { -+ return getVersion( this.m ); -+ } -+ // Spigot End - - public NetworkManager(boolean flag) { - this.j = flag; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - public class PacketDataSerializer extends ByteBuf { - - private final ByteBuf a; -+ // Spigot Start -+ public final int version; - -- public PacketDataSerializer(ByteBuf bytebuf) { -+ public PacketDataSerializer(ByteBuf bytebuf) -+ { -+ this( bytebuf, NetworkManager.CURRENT_VERSION ); -+ } -+ -+ public PacketDataSerializer(ByteBuf bytebuf, int version) { - this.a = bytebuf; -+ this.version = version; - } -+ // Spigot End - - public static int a(int i) { - return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3 : ((i & -268435456) == 0 ? 4 : 5))); -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+import net.minecraft.util.com.google.common.collect.BiMap; -+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 org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+import org.apache.logging.log4j.Marker; -+import org.apache.logging.log4j.MarkerManager; -+ -+public class PacketEncoder extends MessageToByteEncoder { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private static final Marker b = MarkerManager.getMarker("PACKET_SENT", NetworkManager.b); -+ private final NetworkStatistics c; -+ -+ public PacketEncoder(NetworkStatistics networkstatistics) { -+ this.c = networkstatistics; -+ } -+ -+ protected void a(ChannelHandlerContext channelhandlercontext, Packet packet, ByteBuf bytebuf) throws IOException { -+ Integer integer = (Integer) ((BiMap) channelhandlercontext.channel().attr(NetworkManager.f).get()).inverse().get(packet.getClass()); -+ -+ if (a.isDebugEnabled()) { -+ a.debug(b, "OUT: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), integer, packet.getClass().getName(), packet.b()}); -+ } -+ -+ if (integer == null) { -+ throw new IOException("Can\'t serialize unregistered packet"); -+ } else { -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext.channel())); // Spigot -+ -+ packetdataserializer.b(integer.intValue()); -+ packet.b(packetdataserializer); -+ this.c.b(integer.intValue(), (long) packetdataserializer.readableBytes()); -+ } -+ } -+ -+ protected void encode(ChannelHandlerContext channelhandlercontext, Object object, ByteBuf bytebuf) throws IOException { -+ this.a(channelhandlercontext, (Packet) object, bytebuf); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java b/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.UUID; -+ -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ -+public class PacketLoginOutSuccess extends Packet { -+ -+ private GameProfile a; -+ -+ public PacketLoginOutSuccess() {} -+ -+ public PacketLoginOutSuccess(GameProfile gameprofile) { -+ this.a = gameprofile; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ String s = packetdataserializer.c(36); -+ String s1 = packetdataserializer.c(16); -+ UUID uuid = UUID.fromString(s); -+ -+ this.a = new GameProfile(uuid, s1); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ UUID uuid = this.a.getId(); -+ -+ packetdataserializer.a(uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); -+ packetdataserializer.a(this.a.getName()); -+ } -+ -+ public void a(PacketLoginOutListener packetloginoutlistener) { -+ packetloginoutlistener.a(this); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketLoginOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -0,0 +0,0 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - packetdataserializer.b(this.a); - UUID uuid = this.b.getId(); - -- packetdataserializer.a(uuid == null ? "" : uuid.toString()); -+ 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 - packetdataserializer.b(this.b.getProperties().size()); - Iterator iterator = this.b.getProperties().values().iterator(); - -@@ -0,0 +0,0 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - packetdataserializer.a(property.getValue()); - packetdataserializer.a(property.getSignature()); - } -+ } // Spigot - - packetdataserializer.writeInt(this.c); - packetdataserializer.writeInt(this.d); -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { - ping.setFavicon(event.icon.value); - ping.setMOTD(new ChatComponentText(event.getMotd())); - ping.setPlayerSample(playerSample); -- ping.setServerInfo(new ServerPingServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), 5)); // TODO: Update when protocol changes -+ ping.setServerInfo(new ServerPingServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), networkManager.getVersion())); // TODO: Update when protocol changes - - this.networkManager.handle(new PacketStatusOutServerInfo(ping), new GenericFutureListener[0]); - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity { - - GameProfileSerializer.serialize(nbttagcompound1, this.j); - nbttagcompound.set("Owner", nbttagcompound1); -+ nbttagcompound.setString("ExtraType", nbttagcompound1.getString("Name")); // Spigot - } - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0130-Don-t-special-case-invalid-usernames-for-UUIDs.patch b/CraftBukkit-Patches/0114-Don-t-special-case-invalid-usernames-for-UUIDs.patch similarity index 100% rename from CraftBukkit-Patches/0130-Don-t-special-case-invalid-usernames-for-UUIDs.patch rename to CraftBukkit-Patches/0114-Don-t-special-case-invalid-usernames-for-UUIDs.patch diff --git a/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch new file mode 100644 index 0000000000..070b8109ff --- /dev/null +++ b/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch @@ -0,0 +1,221 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Sun, 20 Apr 2014 13:18:55 +0100 +Subject: [PATCH] Convert player skulls async + + +diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ItemSkull.java ++++ b/src/main/java/net/minecraft/server/ItemSkull.java +@@ -0,0 +0,0 @@ public class ItemSkull extends Item { + return super.a(itemstack); + } + +- public boolean a(NBTTagCompound nbttagcompound) { ++ public boolean a(final NBTTagCompound nbttagcompound) { // Spigot - make final + super.a(nbttagcompound); + if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { + GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + +- gameprofile = TileEntitySkull.b(gameprofile); +- nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ // Spigot start ++ TileEntitySkull.b(gameprofile, new com.google.common.base.Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile gameprofile) { ++ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ return false; ++ } ++ }); ++ // Spigot end + return true; + } else { + return false; + } + } +- + } +diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/server/TileEntitySkull.java +@@ -0,0 +0,0 @@ import com.mojang.authlib.GameProfile; + import com.mojang.authlib.properties.Property; + import java.util.UUID; + ++// Spigot start ++import com.google.common.base.Predicate; ++import com.google.common.cache.LoadingCache; ++import com.google.common.cache.CacheBuilder; ++import com.google.common.cache.CacheLoader; ++import java.util.concurrent.Executor; ++import java.util.concurrent.Executors; ++import java.util.concurrent.TimeUnit; ++ ++import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import com.mojang.authlib.Agent; ++// Spigot end ++ + public class TileEntitySkull extends TileEntity { + + private int a; + public int rotation; + private GameProfile g = null; ++ // Spigot start ++ public static final Executor executor = Executors.newFixedThreadPool(3, ++ new ThreadFactoryBuilder() ++ .setNameFormat("Head Conversion Thread - %1$d") ++ .build() ++ ); ++ public static final LoadingCache skinCache = CacheBuilder.newBuilder() ++ .maximumSize( 5000 ) ++ .expireAfterAccess( 60, TimeUnit.MINUTES ) ++ .build( new CacheLoader() ++ { ++ @Override ++ public GameProfile load(String key) throws Exception ++ { ++ GameProfile[] profiles = new GameProfile[1]; ++ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles); ++ ++ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); ++ ++ GameProfile profile = profiles[ 0 ]; ++ if (profile == null) { ++ UUID uuid = EntityHuman.a(new GameProfile(null, key)); ++ profile = new GameProfile(uuid, key); ++ ++ gameProfileLookup.onProfileLookupSucceeded(profile); ++ } else ++ { ++ ++ Property property = Iterables.getFirst( profile.getProperties().get( "textures" ), null ); ++ ++ if ( property == null ) ++ { ++ profile = MinecraftServer.getServer().aB().fillProfileProperties( profile, true ); ++ } ++ } ++ ++ ++ return profile; ++ } ++ } ); ++ ++ // Spigot end + + public TileEntitySkull() {} + +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity { + } + + private void e() { +- this.g = b(this.g); +- this.update(); ++ // Spigot start ++ GameProfile profile = this.g; ++ setSkullType( 0 ); // Work around client bug ++ b(profile, new Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile input) { ++ setSkullType( 3 ); // Work around client bug ++ g = input; ++ update(); ++ world.notify(position); ++ return false; ++ } ++ }); ++ // Spigot end + } + +- public static GameProfile b(GameProfile gameprofile) { ++ // Spigot start - Support async lookups ++ public static void b(final GameProfile gameprofile, final Predicate callback) { + if (gameprofile != null && !UtilColor.b(gameprofile.getName())) { + if (gameprofile.isComplete() && gameprofile.getProperties().containsKey("textures")) { +- return gameprofile; ++ callback.apply(gameprofile); + } else if (MinecraftServer.getServer() == null) { +- return gameprofile; ++ callback.apply(gameprofile); + } else { +- GameProfile gameprofile1 = MinecraftServer.getServer().getUserCache().getProfile(gameprofile.getName()); +- +- if (gameprofile1 == null) { +- return gameprofile; ++ GameProfile profile = skinCache.getIfPresent(gameprofile.getName()); ++ if (profile != null) { ++ callback.apply(profile); + } else { +- Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); +- +- if (property == null) { +- gameprofile1 = MinecraftServer.getServer().aB().fillProfileProperties(gameprofile1, true); +- } +- +- return gameprofile1; ++ executor.execute(new Runnable() { ++ @Override ++ public void run() { ++ final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase()); ++ MinecraftServer.getServer().processQueue.add(new Runnable() { ++ @Override ++ public void run() { ++ if (profile == null) { ++ callback.apply(gameprofile); ++ } else { ++ callback.apply(profile); ++ } ++ } ++ }); ++ } ++ }); + } + } + } else { +- return gameprofile; ++ callback.apply(gameprofile); + } + } ++ // Spigot end + + public int getSkullType() { + return this.a; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { + } + + @Override +- void applyToItem(NBTTagCompound tag) { ++ void applyToItem(final NBTTagCompound tag) { // Spigot - make final + super.applyToItem(tag); + + if (hasOwner()) { + NBTTagCompound owner = new NBTTagCompound(); + GameProfileSerializer.serialize(owner, profile); +- tag.set(SKULL_OWNER.NBT, owner); ++ tag.set( SKULL_OWNER.NBT, owner ); ++ // Spigot start - do an async lookup of the profile. ++ // Unfortunately there is not way to refresh the holding ++ // inventory, so that responsibility is left to the user. ++ net.minecraft.server.TileEntitySkull.b(profile, new com.google.common.base.Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile input) { ++ NBTTagCompound owner = new NBTTagCompound(); ++ GameProfileSerializer.serialize( owner, input ); ++ tag.set( SKULL_OWNER.NBT, owner ); ++ return false; ++ } ++ }); ++ // Spigot end + } + } + +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch b/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch deleted file mode 100644 index c7cd912a29..0000000000 --- a/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 17:49:14 +1000 -Subject: [PATCH] Fix several occurances of missed diff. - - -diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -@@ -0,0 +0,0 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem { - EnumFacing enumfacing = BlockDispenser.b(isourceblock.h()); - IPosition iposition = BlockDispenser.a(isourceblock); - double d0 = iposition.getX() + (double) ((float) enumfacing.getAdjacentX() * 0.3F); -- double d1 = iposition.getY() + (double) ((float) enumfacing.getAdjacentY() * 0.3F); -+ double d1 = iposition.getY() + (double) ((float) enumfacing.getAdjacentX() * 0.3F); - double d2 = iposition.getZ() + (double) ((float) enumfacing.getAdjacentZ() * 0.3F); - World world = isourceblock.k(); - Random random = world.random; -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -0,0 +0,0 @@ public class EntityBoat extends Entity { - return !this.dead; - } - -- public void h() { -+ public void h() { - // CraftBukkit start - double prevX = this.locX; - double prevY = this.locY; -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -0,0 +0,0 @@ public class EntityItem extends Entity { - public ItemStack getItemStack() { - ItemStack itemstack = this.getDataWatcher().getItemStack(10); - -- return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack; -+ return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack; - } - - public void setItemStack(ItemStack itemstack) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - } - - if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.BOOK_AND_QUILL) { -- CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit -+ CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit - } - - return; -diff --git a/src/main/java/net/minecraft/server/PlayerSelector.java b/src/main/java/net/minecraft/server/PlayerSelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerSelector.java -+++ b/src/main/java/net/minecraft/server/PlayerSelector.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - --import java.util.*; -+import java.util.Collections; -+import java.util.HashMap; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch b/CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch similarity index 92% rename from CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch rename to CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch index cae3c70338..23c5f49ac4 100644 --- a/CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch +++ b/CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch @@ -18,12 +18,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static long chunkToKey(int x, int z) { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + } // CraftBukkit end - - block1.doPhysics(this, i, j, k, block); + iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); + } catch (StackOverflowError stackoverflowerror) { // Spigot Start + haveWeSilencedAPhysicsCrash = true; -+ blockLocation = i + ", " + j + ", " + k; // Spigot End ++ blockLocation = blockposition.getX() + ", " + blockposition.getY() + ", " + blockposition.getZ(); // Spigot End } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated"); diff --git a/CraftBukkit-Patches/0116-Update-Warning.patch b/CraftBukkit-Patches/0116-Update-Warning.patch deleted file mode 100644 index 6bed755c55..0000000000 --- a/CraftBukkit-Patches/0116-Update-Warning.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 21:37:12 +1000 -Subject: [PATCH] Update Warning - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit; - -+import java.io.BufferedReader; - import java.io.File; - import java.io.IOException; -+import java.io.InputStreamReader; - import java.text.SimpleDateFormat; - import java.util.Arrays; - import java.util.List; -+import java.util.concurrent.TimeUnit; - import java.util.logging.Level; - import java.util.logging.Logger; - import joptsimple.OptionParser; -@@ -0,0 +0,0 @@ public class Main { - public static boolean useJline = true; - public static boolean useConsole = true; - -- public static void main(String[] args) { -+ public static void main(String[] args) throws IOException { -+ // Spigot Start -+ File lock = new File( ".update-lock" ); -+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -+ { -+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -+ System.err.println( "=================================================================================" ); -+ System.err.println( "Starting server in 10 seconds" ); -+ lock.createNewFile(); -+ try -+ { -+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ } -+ // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { - { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0133-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0117-Check-Skull-canPlace.patch similarity index 53% rename from CraftBukkit-Patches/0133-Check-Skull-canPlace.patch rename to CraftBukkit-Patches/0117-Check-Skull-canPlace.patch index 88e6597ef5..ab9893051b 100644 --- a/CraftBukkit-Patches/0133-Check-Skull-canPlace.patch +++ b/CraftBukkit-Patches/0117-Check-Skull-canPlace.patch @@ -9,16 +9,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ItemSkull.java +++ b/src/main/java/net/minecraft/server/ItemSkull.java @@ -0,0 +0,0 @@ public class ItemSkull extends Item { - } - - if (!world.isStatic) { -+ // Spigot Start -+ if ( !Blocks.SKULL.canPlace( world, i, j, k ) ) -+ { -+ return false; -+ } -+ // Spigot End - world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2); - int i1 = 0; + return false; + } else { + if (!world.isStatic) { ++ // Spigot Start ++ if ( !Blocks.SKULL.canPlace( world, blockposition ) ) ++ { ++ return false; ++ } ++ // Spigot End + world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); + int i = 0; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch b/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch new file mode 100644 index 0000000000..5b59c6c120 --- /dev/null +++ b/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Mon, 20 Jan 2014 20:42:28 +0000 +Subject: [PATCH] Don't let trees replace any block. + + +diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenForestTree.java ++++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java +@@ -0,0 +0,0 @@ public class WorldGenForestTree extends WorldGenTreeAbstract { + int k2; + + for (k2 = 0; k2 < j2; ++k2) { +- this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ // Spigot start ++ BlockPosition position = new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2); ++ Block bl = world.getType(position).getBlock(); ++ ++ if (bl.getMaterial() == Material.AIR || bl.getMaterial() == Material.LEAVES) ++ { ++ this.a(world, position, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ } ++ // Spigot end + } + + int l2; +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch similarity index 67% rename from CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch rename to CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch index e46ce21164..43d75053d1 100644 --- a/CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch +++ b/CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch @@ -16,23 +16,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public SocketAddress n; + public SocketAddress j; public java.util.UUID spoofedUUID; - public Property[] spoofedProfile; + public com.mojang.authlib.properties.Property[] spoofedProfile; + public boolean preparing = true; // Spigot End - private PacketListener o; - private EnumProtocol p; + private PacketListener k; + private IChatBaseComponent l; @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { super.channelActive(channelhandlercontext); - this.m = channelhandlercontext.channel(); - this.n = this.m.remoteAddress(); + this.i = channelhandlercontext.channel(); + this.j = this.i.remoteAddress(); + // Spigot Start + this.preparing = false; + // Spigot End - this.a(EnumProtocol.HANDSHAKING); - } + try { + this.a(EnumProtocol.HANDSHAKING); @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { } @@ -40,22 +40,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot Start + this.preparing = false; + // Spigot End - if (this.m.isOpen()) { - this.m.close(); - this.q = ichatbasecomponent; + if (this.i.isOpen()) { + this.i.close(); // We can't wait as this may be called from an event loop. + this.l = ichatbasecomponent; diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java @@ -0,0 +0,0 @@ public class ServerConnection { - NetworkManager networkmanager = (NetworkManager) iterator.next(); - if (!networkmanager.isConnected()) { -+ // Spigot Start -+ // Fix a race condition where a NetworkManager could be unregistered just before connection. -+ if (networkmanager.preparing) continue; -+ // Spigot End - iterator.remove(); - if (networkmanager.f() != null) { - networkmanager.getPacketListener().a(networkmanager.f()); + if (!networkmanager.h()) { + if (!networkmanager.g()) { ++ // Spigot Start ++ // Fix a race condition where a NetworkManager could be unregistered just before connection. ++ if (networkmanager.preparing) continue; ++ // Spigot End + iterator.remove(); + networkmanager.l(); + } else { -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0136-Configurable-UserCache-cap.patch b/CraftBukkit-Patches/0120-Configurable-UserCache-cap.patch similarity index 100% rename from CraftBukkit-Patches/0136-Configurable-UserCache-cap.patch rename to CraftBukkit-Patches/0120-Configurable-UserCache-cap.patch diff --git a/CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch similarity index 85% rename from CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch rename to CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch index 566de01d45..8aeb557744 100644 --- a/CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch +++ b/CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + entityplayer.spawnIn(world); + entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); -+ entityplayer.b(loc.getYaw(), loc.getPitch()); // should be setYawAndPitch ++ entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); + // Spigot end + // CraftBukkit - Moved message to after join - // g.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); + // PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0138-Cap-Objective-Score-Length.patch b/CraftBukkit-Patches/0122-Cap-Objective-Score-Length.patch similarity index 100% rename from CraftBukkit-Patches/0138-Cap-Objective-Score-Length.patch rename to CraftBukkit-Patches/0122-Cap-Objective-Score-Length.patch diff --git a/CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch similarity index 93% rename from CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch rename to CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch index 69cb6dcabf..a4ef761659 100644 --- a/CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ b/CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } else if (s.isEmpty()) { c.warn(this.player.getName() + " tried to send an empty message"); } else if (getPlayer().isConversing()) { diff --git a/CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch similarity index 92% rename from CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch rename to CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch index ea40828977..f9de20448e 100644 --- a/CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch +++ b/CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch @@ -8,15 +8,16 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - if (this.l.d()) { - this.l.e(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + if (this.m.d()) { + this.m.e(); } +- + // Spigot start + if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) + { -+ i.info("Saving usercache.json"); -+ this.X.c(); ++ LOGGER.info("Saving usercache.json"); ++ this.Z.c(); + } + //Spigot end } diff --git a/CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch b/CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch similarity index 73% rename from CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch rename to CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch index 51a0a7544b..f61e9ace8b 100644 --- a/CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch +++ b/CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch @@ -11,34 +11,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/IntCache.java @@ -0,0 +0,0 @@ public class IntCache { if (i <= 256) { - if (b.isEmpty()) { + if (IntCache.b.isEmpty()) { aint = new int[256]; -- c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) c.add(aint); +- IntCache.c.add(aint); ++ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); return aint; } else { - aint = (int[]) b.remove(b.size() - 1); -- c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) c.add(aint); + aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); +- IntCache.c.add(aint); ++ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); return aint; } - } else if (i > a) { + } else if (i > IntCache.a) { @@ -0,0 +0,0 @@ public class IntCache { - d.clear(); - e.clear(); - aint = new int[a]; -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + IntCache.d.clear(); + IntCache.e.clear(); + aint = new int[IntCache.a]; +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; - } else if (d.isEmpty()) { - aint = new int[a]; -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + } else if (IntCache.d.isEmpty()) { + aint = new int[IntCache.a]; +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; } else { - aint = (int[]) d.remove(d.size() - 1); -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; } } diff --git a/CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch b/CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch similarity index 96% rename from CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch rename to CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch index 8c388fc26e..20fc16a67a 100644 --- a/CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch +++ b/CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack)); + throw new IllegalArgumentException(String.format("%s performing %s with %s", who, action, itemstack)); // Spigot } - return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack); + return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack); } @@ -0,0 +0,0 @@ public class CraftEventFactory { if (source == DamageSource.CACTUS) { diff --git a/CraftBukkit-Patches/0144-Cross-World-Entity-Teleportation.patch b/CraftBukkit-Patches/0127-Cross-World-Entity-Teleportation.patch similarity index 100% rename from CraftBukkit-Patches/0144-Cross-World-Entity-Teleportation.patch rename to CraftBukkit-Patches/0127-Cross-World-Entity-Teleportation.patch diff --git a/CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch similarity index 63% rename from CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch rename to CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch index 9092ebfb9e..2346f021ac 100644 --- a/CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch +++ b/CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch @@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - } +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + // CraftBukkit end } + // Spigot start - limit place/interactions @@ -17,6 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private int packets = 0; + public void a(PacketPlayInBlockPlace packetplayinblockplace) { + PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + boolean throttled = false; + if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + throttled = true; @@ -26,10 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packets = 0; + } + // Spigot end - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - + // CraftBukkit start -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { + if (this.player.dead) return; +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start int itemstackAmount = itemstack.count; @@ -44,13 +46,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit - notch decrements the counter by 1 in the above method with food, // snowballs and so forth, but he does it in a place that doesn't cause the -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - return; +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } -- if (!this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j())) { -+ if (throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j())) { // Spigot - skip the event if throttled - always = true; // force PacketPlayOutSetSlot to be sent to client to update ItemStack count + if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { +- always = !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); ++ always = throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); } // CraftBukkit end + -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0146-Better-item-validation.patch b/CraftBukkit-Patches/0129-Better-item-validation.patch similarity index 90% rename from CraftBukkit-Patches/0146-Better-item-validation.patch rename to CraftBukkit-Patches/0129-Better-item-validation.patch index a8245a3621..847a3b9e20 100644 --- a/CraftBukkit-Patches/0146-Better-item-validation.patch +++ b/CraftBukkit-Patches/0129-Better-item-validation.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java @@ -0,0 +0,0 @@ public class DataWatcher { - arraylist = new ArrayList(); + arraylist = Lists.newArrayList(); } + // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions @@ -55,21 +55,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { NBTTagCompound nbttagcompound = null; - if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) { + if (itemstack.getItem().usesDurability() || itemstack.getItem().p()) { + // Spigot start - filter + itemstack = itemstack.cloneItemStack(); + CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); + // Spigot end - nbttagcompound = itemstack.tag; + nbttagcompound = itemstack.getTag(); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -@@ -0,0 +0,0 @@ import com.google.common.base.Strings; - import com.google.common.collect.ImmutableList; - import com.google.common.collect.ImmutableMap.Builder; +@@ -0,0 +0,0 @@ import net.minecraft.server.ChatSerializer; + import net.minecraft.server.NBTTagString; + import org.bukkit.craftbukkit.util.CraftChatMessage; +// Spigot start +import static org.spigotmc.ValidateUtils.*; @@ -90,17 +90,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.author = tag.getString(BOOK_AUTHOR.NBT); + this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 1024 ); // Spigot } - - if (tag.hasKey(BOOK_PAGES.NBT)) { + + if (tag.hasKey(RESOLVED.NBT)) { @@ -0,0 +0,0 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { - String[] pageArray = new String[pages.size()]; - - for (int i = 0; i < pages.size(); i++) { -- String page = pages.getString(i); -+ String page = limit( pages.getString(i), 2048 ); // Spigot - pageArray[i] = page; + if (resolved != null && resolved) { + page = CraftChatMessage.fromComponent(ChatSerializer.a(page)); + } +- pageArray[i] = page; ++ pageArray[i] = limit( page, 2048 ); // Spigot } + addPage(pageArray); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/CraftBukkit-Patches/0147-Further-Seed-Customisation.patch b/CraftBukkit-Patches/0130-Further-Seed-Customisation.patch similarity index 90% rename from CraftBukkit-Patches/0147-Further-Seed-Customisation.patch rename to CraftBukkit-Patches/0130-Further-Seed-Customisation.patch index e45777f677..7586d2be46 100644 --- a/CraftBukkit-Patches/0147-Further-Seed-Customisation.patch +++ b/CraftBukkit-Patches/0130-Further-Seed-Customisation.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i1 = i / this.g; int j1 = j / this.g; -- Random random = this.c.A(i1, j1, 14357617); -+ Random random = this.c.A(i1, j1, this.c.spigotConfig.largeFeatureSeed); // Spigot +- Random random = this.c.a(i1, j1, 14357617); ++ Random random = this.c.a(i1, j1, this.c.spigotConfig.largeFeatureSeed); // Spigot i1 *= this.g; j1 *= this.g; @@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i1 = i / this.g; int j1 = j / this.g; -- Random random = this.c.A(i1, j1, 10387312); -+ Random random = this.c.A(i1, j1, this.c.spigotConfig.villageSeed); // Spigot +- Random random = this.c.a(i1, j1, 10387312); ++ Random random = this.c.a(i1, j1, this.c.spigotConfig.villageSeed); // Spigot i1 *= this.g; j1 *= this.g; diff --git a/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch deleted file mode 100644 index 53dc998189..0000000000 --- a/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 20 Apr 2014 13:18:55 +0100 -Subject: [PATCH] Convert player skulls async - - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { - if (nbttagcompound.hasKeyOfType("tag", 10)) { - // CraftBukkit - make defensive copy as this data may be coming from the save thread - this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); -+ validateSkullSkin(); // Spigot - } - } - -+ // Spigot start - make sure the tag is given the full gameprofile if it's a skull (async lookup) -+ public void validateSkullSkin() -+ { -+ if ( this.item == Items.SKULL && this.getData() == 3 ) -+ { -+ String owner; -+ if ( this.tag.hasKeyOfType( "SkullOwner", 8 ) ) -+ { -+ owner = this.tag.getString( "SkullOwner" ); -+ } else if ( this.tag.hasKeyOfType( "SkullOwner", 10 ) ) -+ { -+ net.minecraft.util.com.mojang.authlib.GameProfile profile = GameProfileSerializer.deserialize( this.tag.getCompound( "SkullOwner" ) ); -+ if ( profile == null || !profile.getProperties().isEmpty() ) -+ { -+ return; -+ } else -+ { -+ owner = profile.getName(); -+ } -+ } else -+ { -+ return; -+ } -+ -+ final String finalOwner = owner; -+ TileEntitySkull.executor.execute( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ -+ final net.minecraft.util.com.mojang.authlib.GameProfile profile = TileEntitySkull.skinCache.getUnchecked( finalOwner.toLowerCase() ); -+ if ( profile != null ) -+ { -+ MinecraftServer.getServer().processQueue.add( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ NBTTagCompound nbtProfile = new NBTTagCompound(); -+ GameProfileSerializer.serialize( nbtProfile, profile ); -+ ItemStack.this.tag.set( "SkullOwner", nbtProfile ); -+ } -+ } ); -+ } -+ } -+ } ); -+ } -+ } -+ // Spigot end -+ - public int getMaxStackSize() { - return this.getItem().getMaxStackSize(); - } -@@ -0,0 +0,0 @@ public final class ItemStack { - - public void setTag(NBTTagCompound nbttagcompound) { - this.tag = nbttagcompound; -+ validateSkullSkin(); // Spigot - } - - public String getName() { -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -0,0 +0,0 @@ import net.minecraft.util.com.google.common.collect.Iterables; - import net.minecraft.util.com.mojang.authlib.GameProfile; - import net.minecraft.util.com.mojang.authlib.properties.Property; - -+// Spigot start -+import com.google.common.cache.Cache; -+import com.google.common.cache.CacheBuilder; -+import com.google.common.cache.CacheLoader; -+import java.util.concurrent.Executor; -+import java.util.concurrent.Executors; -+import java.util.concurrent.TimeUnit; -+ -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.com.mojang.authlib.Agent; -+// Spigot end -+ - public class TileEntitySkull extends TileEntity { - - private int a; - private int i; - private GameProfile j = null; -+ // Spigot start -+ public static final Executor executor = Executors.newFixedThreadPool(3, -+ new ThreadFactoryBuilder() -+ .setNameFormat("Head Conversion Thread - %1$d") -+ .build() -+ ); -+ public static final Cache skinCache = CacheBuilder.newBuilder() -+ .maximumSize( 5000 ) -+ .expireAfterAccess( 60, TimeUnit.MINUTES ) -+ .build( new CacheLoader() -+ { -+ @Override -+ public GameProfile load(String key) throws Exception -+ { -+ GameProfile[] profiles = new GameProfile[1]; -+ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles); -+ -+ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); -+ -+ GameProfile profile = profiles[ 0 ]; -+ if (profile == null) { -+ UUID uuid = EntityHuman.a(new GameProfile(null, key)); -+ profile = new GameProfile(uuid, key); -+ -+ gameProfileLookup.onProfileLookupSucceeded(profile); -+ } else -+ { -+ -+ Property property = Iterables.getFirst( profile.getProperties().get( "textures" ), null ); -+ -+ if ( property == null ) -+ { -+ profile = MinecraftServer.getServer().av().fillProfileProperties( profile, true ); -+ } -+ } -+ -+ -+ return profile; -+ } -+ } ); -+ // Spigot end - - public TileEntitySkull() {} - -@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity { - private void d() { - if (this.j != null && !UtilColor.b(this.j.getName())) { - if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) { -- GameProfile gameprofile = MinecraftServer.getServer().getUserCache().getProfile(this.j.getName()); -- -- if (gameprofile != null) { -- Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null); -- -- if (property == null) { -- gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true); -+ // Spigot start - Handle async -+ final String name = this.j.getName(); -+ setSkullType( 0 ); // Work around a client bug -+ executor.execute(new Runnable() { -+ @Override -+ public void run() { -+ -+ GameProfile profile = skinCache.getUnchecked( name.toLowerCase() ); -+ -+ if (profile != null) { -+ final GameProfile finalProfile = profile; -+ MinecraftServer.getServer().processQueue.add(new Runnable() { -+ @Override -+ public void run() { -+ a = 3; -+ j = finalProfile; -+ world.notify( x, y, z ); -+ } -+ }); -+ } else { -+ MinecraftServer.getServer().processQueue.add(new Runnable() { -+ @Override -+ public void run() { -+ a = 3; -+ j = new GameProfile( null, name ); -+ world.notify( x, y, z ); -+ } -+ }); -+ } - } -- -- this.j = gameprofile; -- this.update(); -- } -+ }); -+ // Spigot end - } - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { - } - - @Override -- void applyToItem(NBTTagCompound tag) { -+ void applyToItem(final NBTTagCompound tag) { // Spigot - make final - super.applyToItem(tag); - - if (hasOwner()) { - NBTTagCompound owner = new NBTTagCompound(); - GameProfileSerializer.serialize(owner, profile); -- tag.set(SKULL_OWNER.NBT, owner); -+ tag.set( SKULL_OWNER.NBT, owner ); -+ // Spigot start - do an async lookup of the profile. -+ // Unfortunately there is not way to refresh the holding -+ // inventory, so that responsibility is left to the user. -+ net.minecraft.server.TileEntitySkull.executor.execute( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ -+ final GameProfile profile = net.minecraft.server.TileEntitySkull.skinCache.getUnchecked( CraftMetaSkull.this.profile.getName().toLowerCase() ); -+ if ( profile != null ) -+ { -+ MinecraftServer.getServer().processQueue.add( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ NBTTagCompound owner = new NBTTagCompound(); -+ GameProfileSerializer.serialize( owner, profile ); -+ tag.set( SKULL_OWNER.NBT, owner ); -+ } -+ } ); -+ } -+ } -+ } ); -+ // Spigot end - } - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch b/CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch similarity index 73% rename from CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch rename to CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch index fe784ee83c..697b0c56e9 100644 --- a/CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch +++ b/CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch @@ -9,12 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet -+ net.minecraft.util.io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable - this.X = new UserCache(this, a); - j = this; + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { ++ io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable this.d = proxy; + MinecraftServer.k = this; + // this.universe = file; // CraftBukkit -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch b/CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch similarity index 99% rename from CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch rename to CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch index 380f042503..3b9bf123c1 100644 --- a/CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch +++ b/CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - } + } catch (IOException ioexception) { ioexception.printStackTrace(); - throw new RuntimeException("Failed to check session lock, aborting"); @@ -27,6 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } finally { datainputstream.close(); } + } catch (IOException ioexception) { - throw new ExceptionWorldConflict("Failed to check session lock, aborting"); + throw new ExceptionWorldConflict("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // Spigot diff --git a/CraftBukkit-Patches/0150-Safer-JSON-Loading.patch b/CraftBukkit-Patches/0133-Safer-JSON-Loading.patch similarity index 91% rename from CraftBukkit-Patches/0150-Safer-JSON-Loading.patch rename to CraftBukkit-Patches/0133-Safer-JSON-Loading.patch index 125bdc2194..c2729b19c9 100644 --- a/CraftBukkit-Patches/0150-Safer-JSON-Loading.patch +++ b/CraftBukkit-Patches/0133-Safer-JSON-Loading.patch @@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class JsonList { try { bufferedreader = Files.newReader(this.c, Charsets.UTF_8); - collection = (Collection) this.b.fromJson(bufferedreader, f); + collection = (Collection) this.b.fromJson(bufferedreader, JsonList.f); + // Spigot Start + } catch ( java.io.FileNotFoundException ex ) + { + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Unable to find file {0}, creating it.", this.c ); -+ } catch ( net.minecraft.util.com.google.gson.JsonSyntaxException ex ) ++ } catch ( com.google.gson.JsonSyntaxException ex ) + { + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Unable to read file {0}, backing it up to {0}.backup and creating new copy.", this.c ); + File backup = new File( this.c + ".backup" ); @@ -31,11 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - break label81; + break label64; } catch (FileNotFoundException filenotfoundexception) { ; + // Spigot Start -+ } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) { ++ } catch (com.google.gson.JsonSyntaxException ex) { + JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." ); + this.g.delete(); + // Spigot End diff --git a/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch b/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch deleted file mode 100644 index 208bac4907..0000000000 --- a/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 20 Jan 2014 20:42:28 +0000 -Subject: [PATCH] Don't let trees replace any block. - - -diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenForestTree.java -+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java -@@ -0,0 +0,0 @@ public class WorldGenForestTree extends WorldGenTreeAbstract { - int k3; - - for (k3 = 0; k3 < j3; ++k3) { -- this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); -+ Block block = world.getType(i + l2, k2 - k3 - 1, k + i3); -+ -+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) -+ { -+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); -+ } - } - - int l3; --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch b/CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch similarity index 94% rename from CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch rename to CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch index 01c9c092b4..65995e4769 100644 --- a/CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch +++ b/CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ - -+ ++ diff --git a/CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch b/CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch similarity index 83% rename from CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch rename to CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch index f1c26262c1..3dd93d9669 100644 --- a/CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch +++ b/CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - i.info("Loading properties"); + DedicatedServer.LOGGER.info("Loading properties"); this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.n = new EULA(new File("eula.txt")); -- if (!this.n.a()) { + this.o = new EULA(new File("eula.txt")); +- if (!this.o.a()) { + // Spigot Start + boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); + if ( eulaAgreed ) @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); + } + // Spigot End -+ if (!this.n.a() && !eulaAgreed) { - i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - this.n.b(); ++ if (!this.o.a() && !eulaAgreed) { // Spigot + DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + this.o.b(); return false; -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0154-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch b/CraftBukkit-Patches/0136-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch similarity index 100% rename from CraftBukkit-Patches/0154-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch rename to CraftBukkit-Patches/0136-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch diff --git a/CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch b/CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch similarity index 77% rename from CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch rename to CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch index 3137de0bfe..5738644fe9 100644 --- a/CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch +++ b/CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch @@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - - public class EntityOcelot extends EntityTameableAnimal { - -+ public boolean spawnBonus = true; // Spigot - private PathfinderGoalTempt bq; - - public EntityOcelot(World world) { @@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { - public GroupDataEntity prepare(GroupDataEntity groupdataentity) { - groupdataentity = super.prepare(groupdataentity); + private PathfinderGoalAvoidTarget bm; + private PathfinderGoalTempt bn; ++ public boolean spawnBonus = true; // Spigot + + public EntityOcelot(World world) { + super(world); +@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal { + + public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) { + groupdataentity = super.prepare(difficultydamagescaler, groupdataentity); - if (this.world.random.nextInt(7) == 0) { + if (spawnBonus && this.world.random.nextInt(7) == 0) { // Spigot for (int i = 0; i < 2; ++i) { @@ -40,6 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end if (entity instanceof EntityInsentient) { - ((EntityInsentient) entity).prepare((GroupDataEntity) null); + ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch b/CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch similarity index 81% rename from CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch rename to CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch index d528973dce..778f6e95c6 100644 --- a/CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch +++ b/CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 break; } } -- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); +- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + // Spigot start + double healthMod = scaledHealth ? healthScale : getMaxHealth(); + if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 ) @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + healthMod = 20; // Reset health + getServer().getLogger().warning( getName() + " tried to crash the server with a large health attribute" ); + } -+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); ++ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + // Spigot end } diff --git a/CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch similarity index 80% rename from CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch rename to CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch index 39d2d56734..411e27e20d 100644 --- a/CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch +++ b/CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch @@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - d10 = d4 * d4 + d5 * d5 + d6 * d6; +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + d17 = d11 * d11 + d12 * d12 + d13 * d13; boolean flag1 = false; -- if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { +- if (d17 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { + // Spigot: make "moved wrongly" limit configurable -+ if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { ++ if (d17 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { flag1 = true; - c.warn(this.player.getName() + " moved wrongly!"); + PlayerConnection.c.warn(this.player.getName() + " moved wrongly!"); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch b/CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch similarity index 93% rename from CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch rename to CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch index f0570590d4..328b008975 100644 --- a/CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch +++ b/CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch @@ -15,5 +15,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + tileentity.a(this); // Spigot - No null worlds this.a.add(tileentity); } else { - this.tileEntityList.add(tileentity); + this.a(tileentity); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch similarity index 69% rename from CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch rename to CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch index 4c72fec326..fa72e8da7a 100644 --- a/CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch +++ b/CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch @@ -8,15 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end - double d10 = d7 * d7 + d8 * d8 + d9 * d9; + double d17 = d14 * d14 + d15 * d15 + d16 * d16; -- if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports +- if (d17 > 100.0D && this.checkMovement && (!this.minecraftServer.S() || !this.minecraftServer.R().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports + // Spigot: make "moved too quickly" limit configurable -+ if (d10 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports - c.warn(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")"); - this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); ++ if (d17 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.S() || !this.minecraftServer.R().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports + PlayerConnection.c.warn(this.player.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d14 + ", " + d15 + ", " + d16 + ")"); + this.a(this.o, this.p, this.q, this.player.yaw, this.player.pitch); return; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch b/CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch similarity index 76% rename from CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch rename to CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch index a8512d2d01..40b6b9dc64 100644 --- a/CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch +++ b/CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch @@ -10,33 +10,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/BlockHopper.java @@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer { - if (flag != flag1) { - world.setData(i, j, k, i1 | (flag ? 0 : 8), 4); + if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { + world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4); + // Spigot start - When this hopper becomes unpowered, make it active. + // Called when this block's power level changes. flag1 is the current + // isNotPowered from metadata. flag is the recalculated isNotPowered. + if (world.spigotConfig.altHopperTicking) { + // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = e((IBlockAccess) world, i, j, k); ++ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); + if (flag && hopper != null) { + hopper.makeTick(); + } + } + // Spigot end } - } + } @@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer { - public static TileEntityHopper e(IBlockAccess iblockaccess, int i, int j, int k) { - return (TileEntityHopper) iblockaccess.getTileEntity(i, j, k); + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); } + + // Spigot start - Use random block updates to make hoppers active. + @Override -+ public void a(World world, int i, int j, int k, Random random) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, java.util.Random random) { + if (world.spigotConfig.altHopperTicking) { + // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = e((IBlockAccess) world, i, j, k); ++ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); + if (hopper != null) { + hopper.makeTick(); + } @@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - tileentity.t(); - this.tileEntities.put(chunkposition, tileentity); + tileentity.D(); + this.tileEntities.put(blockposition, tileentity); + // Spigot start - The tile entity has a world, now hoppers can be born ticking. + if (this.world.spigotConfig.altHopperTicking) { + this.world.triggerHoppersList.add(tileentity); @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot end // CraftBukkit start } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java @@ -71,16 +71,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Spigot start - Make the hopper(s) below this item active. + // Called each tick on each item entity. + if (this.world.spigotConfig.altHopperTicking) { -+ int xi = MathHelper.floor(this.boundingBox.a); -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c); -+ int xf = MathHelper.floor(this.boundingBox.d); -+ int yf = MathHelper.floor(this.boundingBox.e) - 1; -+ int zf = MathHelper.floor(this.boundingBox.f); ++ int xi = MathHelper.floor(this.getBoundingBox().a); ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c); ++ int xf = MathHelper.floor(this.getBoundingBox().d); ++ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f); + for (int a = xi; a <= xf; a++) { + for (int c = zi; c <= zf; c++) { + for (int b = yi; b <= yf; b++) { -+ TileEntity tileEntity = this.world.getTileEntity(a, b, c); ++ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); + if (tileEntity instanceof TileEntityHopper) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -90,29 +90,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end - // ++this.age; // CraftBukkit - Moved up - if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot + /* Craftbukkit start - moved up + if (this.age != -32768) { diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { - +@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT this.passenger = null; } + + // Spigot start - Make hoppers around this container minecart active. + // Called each tick on each minecart. + if (this.world.spigotConfig.altHopperTicking && this instanceof EntityMinecartContainer) { -+ int xi = MathHelper.floor(this.boundingBox.a) - 1; -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c) - 1; -+ int xf = MathHelper.floor(this.boundingBox.d) + 1; -+ int yf = MathHelper.floor(this.boundingBox.e) + 1; -+ int zf = MathHelper.floor(this.boundingBox.f) + 1; ++ int xi = MathHelper.floor(this.getBoundingBox().a) - 1; ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c) - 1; ++ int xf = MathHelper.floor(this.getBoundingBox().d) + 1; ++ int yf = MathHelper.floor(this.getBoundingBox().e) + 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f) + 1; + for (int a = xi; a <= xf; a++) { + for (int b = yi; b <= yf; b++) { + for (int c = zi; c <= zf; c++) { -+ TileEntity tileEntity = this.world.getTileEntity(a, b, c); ++ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); + if (tileEntity instanceof TileEntityHopper) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -121,9 +121,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // Spigot end ++ + this.W(); } } - diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java @@ -137,47 +138,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // knowing that it may be dead, gone, or standing after this method returns. + // Called each tick on each ocelot. + @Override -+ public void h() { ++ public void s_() { + if (this.world.spigotConfig.altHopperTicking && this.isSitting()) { -+ int xi = MathHelper.floor(this.boundingBox.a); -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c); -+ int xf = MathHelper.floor(this.boundingBox.d); -+ int yf = MathHelper.floor(this.boundingBox.e) - 1; -+ int zf = MathHelper.floor(this.boundingBox.f); ++ int xi = MathHelper.floor(this.getBoundingBox().a); ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c); ++ int xf = MathHelper.floor(this.getBoundingBox().d); ++ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f); + for (int a = xi; a <= xf; a++) { + for (int c = zi; c <= zf; c++) { + for (int b = yi; b <= yf; b++) { -+ this.world.updateChestAndHoppers(a, b, c); ++ this.world.updateChestAndHoppers(new BlockPosition(a, b, c)); + } + } + } + } -+ super.h(); ++ super.s_(); + } + // Spigot end + - public void bp() { + public void E() { if (this.getControllerMove().a()) { double d0 = this.getControllerMove().b(); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ public class TileEntity { - public int g = -1; - public Block h; +@@ -0,0 +0,0 @@ public abstract class TileEntity { + private int h; + protected Block e; + // Spigot start + // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed + // at this tile entity, then make it active. -+ private void scheduleTick(int x0, int y0, int z0) { -+ TileEntity tileEntity = this.world.getTileEntity(x0, y0, z0); ++ private void scheduleTick(BlockPosition blockposition) { ++ TileEntity tileEntity = this.world.getTileEntity(blockposition); + if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { + // i is the metadeta assoiated with the direction the hopper faces. -+ int i = BlockHopper.b(tileEntity.p()); ++ EnumDirection dir = BlockHopper.b(tileEntity.u()); ++ + // Facing class provides arrays for direction offset. -+ if (tileEntity.x + Facing.b[i] == this.x && tileEntity.y + Facing.c[i] == this.y && tileEntity.z + Facing.d[i] == this.z) { ++ if (tileEntity.position.shift(dir).equals(position)) { + ((TileEntityHopper) tileEntity).makeTick(); + } + } @@ -188,13 +190,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void scheduleTicks() { + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + // Check the top -+ this.scheduleTick(this.x, this.y + 1, this.z); ++ this.scheduleTick(position.up()); + // Check the sides + for (int i = 2; i < 6; i++) { -+ this.scheduleTick(this.x + Facing.b[i], this.y, this.z + Facing.d[i]); ++ this.scheduleTick(position.shift(EnumDirection.fromType1(i))); + } + // Check the bottom. -+ TileEntity tileEntity = this.world.getTileEntity(this.x, this.y - 1, this.z); ++ TileEntity tileEntity = this.world.getTileEntity(position.down()); + if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -202,36 +204,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end + - public TileEntity() {} - - private static void a(Class oclass, String s) { -@@ -0,0 +0,0 @@ public class TileEntity { - if (this.q() != Blocks.AIR) { - this.world.updateAdjacentComparators(this.x, this.y, this.z, this.q()); + public TileEntity() { + this.position = BlockPosition.ZERO; + this.h = -1; +@@ -0,0 +0,0 @@ public abstract class TileEntity { + if (this.w() != Blocks.AIR) { + this.world.updateAdjacentComparators(this.position, this.w()); } + // Spigot start - Called when the contents have changed, so hoppers around this + // tile need updating. + this.scheduleTicks(); + // Spigot end } - } + } diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { - private String i; - private int j = -1; - +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + private ItemStack[] items = new ItemStack[5]; + private String f; + private int g = -1; ++ + // Spigot start + private long nextTick = -1; // Next tick this hopper will be ticked. + private long lastTick = -1; // Last tick this hopper was polled. + + // If this hopper is not cooling down, assaign a visible tick for next time. + public void makeTick() { -+ if (!this.j()) { -+ this.c(0); ++ if (!this.n()) { ++ this.d(0); + } + } + @@ -246,7 +249,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // on from reload. + public void convertToScheduling() { + // j is the cooldown in ticks -+ this.c(this.j); ++ this.d(this.g); + } + + // Called when alt hopper ticking is turned off from the reload command @@ -257,18 +260,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + cooldownDiff = this.nextTick - this.world.getTime() + 1; + } -+ this.c((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); ++ this.d((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); + } + // Spigot end -+ + // CraftBukkit start - add fields and methods public List transaction = new java.util.ArrayList(); - private int maxStack = MAX_STACK; -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } nbttagcompound.set("Items", nbttaglist); -- nbttagcompound.setInt("TransferCooldown", this.j); +- nbttagcompound.setInt("TransferCooldown", this.g); + // Spigot start - Need to write the correct cooldown to disk. We convert from long to int on saving. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + long cooldownDiff; @@ -279,14 +281,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + nbttagcompound.setInt("TransferCooldown", (int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); + } else { -+ // j is the cooldown in ticks. -+ nbttagcompound.setInt("TransferCooldown", this.j); ++ // g is the cooldown in ticks. ++ nbttagcompound.setInt("TransferCooldown", this.g); + } + // Spigot end - if (this.k_()) { - nbttagcompound.setString("CustomName", this.i); + if (this.hasCustomName()) { + nbttagcompound.setString("CustomName", this.f); } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU public void update() { super.update(); @@ -296,46 +298,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public int getSize() { -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - public void h() { + public void c() { if (this.world != null && !this.world.isStatic) { -- --this.j; -- if (!this.j()) { -- this.c(0); -- this.i(); +- --this.g; +- if (!this.n()) { +- this.d(0); +- this.m(); + // Spigot start + if (this.world.spigotConfig.altHopperTicking) { + this.lastTick = this.world.getTime(); + if (this.nextTick == this.world.getTime()) { + // Method that does the pushing and pulling. -+ this.i(); ++ this.m(); + } + } else { -+ --this.j; -+ if (!this.j()) { -+ this.c(0); -+ this.i(); ++ --this.g; ++ if (!this.n()) { ++ this.d(0); ++ this.m(); + } } -+ // Spigot end - } - } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { + } +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } // Spigot start -- if ( !this.j() ) -+ if ( !world.spigotConfig.altHopperTicking && !this.j() ) +- if ( !this.n() ) ++ if ( !world.spigotConfig.altHopperTicking && !this.n() ) { - this.c( world.spigotConfig.hopperCheck ); + this.d( world.spigotConfig.hopperCheck ); } -@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } - public void c(int i) { -- this.j = i; + public void d(int i) { +- this.g = i; + // Spigot start - i is the delay for which this hopper will be ticked next. + // i of 1 or below implies a tick next tick. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { @@ -348,13 +348,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.nextTick = this.world.getTime() + i - 1; + } + } else { -+ this.j = i; ++ this.g = i; + } + // Spigot end } - public boolean j() { -- return this.j > 0; + public boolean n() { +- return this.g > 0; + // Spigot start - Return whether this hopper is cooling down. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + if (this.lastTick == this.world.getTime()) { @@ -363,11 +363,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.nextTick >= this.world.getTime(); + } + } else { -+ return this.j > 0; ++ return this.g > 0; + } + // Spigot end } - } + + public boolean o() { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java @@ -401,17 +402,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // Helper method for altHopperTicking. Updates chests at the specified location, + // accounting for double chests. Updating the chest will update adjacent hoppers. -+ public void updateChestAndHoppers(int a, int b, int c) { -+ Block block = this.getType(a, b, c); ++ public void updateChestAndHoppers(BlockPosition blockposition) { ++ Block block = this.getType(blockposition).getBlock(); + if (block instanceof BlockChest) { -+ TileEntity tile = this.getTileEntity(a, b, c); ++ TileEntity tile = this.getTileEntity(blockposition); + if (tile instanceof TileEntityChest) { + tile.scheduleTicks(); + } + for (int i = 2; i < 6; i++) { + // Facing class provides arrays for direction offset. -+ if (this.getType(a + Facing.b[i], b, c + Facing.d[i]) == block) { -+ tile = this.getTileEntity(a + Facing.b[i], b, c + Facing.d[i]); ++ BlockPosition pos = blockposition.shift(EnumDirection.fromType1(i)); ++ if (this.getType(pos) == block) { ++ tile = this.getTileEntity(pos); + if (tile instanceof TileEntityChest) { + tile.scheduleTicks(); + } @@ -422,28 +424,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Spigot end - public BiomeBase getBiome(int i, int j) { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.notifyAndUpdatePhysics(i, j, k, chunk, block1, block, i1); - // CraftBukkit end + // Modularize client and physic updates + notifyAndUpdatePhysics(blockposition, chunk, block1, block, i); } + // Spigot start - If this block is changing to that which a chest beneath it + // becomes able to be opened, then the chest must be updated. + // block1 is the old block. block is the new block. r returns true if the block type + // prevents access to a chest. -+ if (this.spigotConfig.altHopperTicking && block1 != null && block1.r() && !block.r()) { -+ this.updateChestAndHoppers(i, j - 1, k); ++ if (this.spigotConfig.altHopperTicking && block1 != null && block1.isOccluding()&& !block.isOccluding()) { ++ this.updateChestAndHoppers(blockposition.down()); + } + // Spigot end + // CraftBukkit end - return flag; - } + return true; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.tileEntityList.removeAll(this.b); - this.b.clear(); } -- // CraftBukkit end -+ // Spigot End + // CraftBukkit end + this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently. Iterator iterator = this.tileEntityList.iterator(); diff --git a/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch b/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch deleted file mode 100644 index b2813dec89..0000000000 --- a/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 26 Jun 2014 14:29:11 +0100 -Subject: [PATCH] Fix explosions not moving invulnerable entities - - -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -0,0 +0,0 @@ public class Explosion { - // CraftBukkit start - CraftEventFactory.entityDamage = source; - if (!entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D)))) { -- CraftEventFactory.entityDamage = null; -- continue; -+ - } -+ CraftEventFactory.entityDamage = null; - // CraftBukkit end - double d11 = EnchantmentProtection.a(entity, d10); - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch similarity index 79% rename from CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch rename to CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch index 7aa463f806..9eea78c597 100644 --- a/CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch +++ b/CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch @@ -10,13 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java @@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { - public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) { + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) { try { -- DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte)))); -+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new org.spigotmc.LimitStream(new GZIPInputStream(new ByteArrayInputStream(abyte)), nbtreadlimiter))); // Spigot - - NBTTagCompound nbttagcompound; ++ // Spigot start ++ if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) ++ { ++ datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); ++ } ++ // Spigot end + NBTBase nbtbase = a(datainput, 0, nbtreadlimiter); + if (nbtbase instanceof NBTTagCompound) { diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch similarity index 67% rename from CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch rename to CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch index 8e10efcf94..c1ca6894e0 100644 --- a/CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch +++ b/CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public double b; // Spigot private String c; - public AttributeRanged(String s, double d0, double d1, double d2) { + public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/GenericAttributes.java @@ -26,16 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class GenericAttributes { private static final Logger f = LogManager.getLogger(); -- public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); -+ // Spigot Start -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); // Spigot - public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); - public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -- public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); -- public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); -+ public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); -+ public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); -+ // Spigot End +- public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); ++ // Spigot start ++ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); + public static final IAttribute b = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); + public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); +- public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); +- public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); ++ public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); ++ public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); ++ // Spigot end public static NBTTagList a(AttributeMapBase attributemapbase) { NBTTagList nbttaglist = new NBTTagList(); @@ -43,15 +43,15 @@ diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/sp index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ import java.util.List; - import java.util.Map; +@@ -0,0 +0,0 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; + import gnu.trove.map.hash.TObjectIntHashMap; +import net.minecraft.server.AttributeRanged; +import net.minecraft.server.GenericAttributes; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; + import org.bukkit.ChatColor; @@ -0,0 +0,0 @@ public class SpigotConfig { movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D ); diff --git a/CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch b/CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch similarity index 98% rename from CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch rename to CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch index c224be9f8d..482a9ab539 100644 --- a/CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch +++ b/CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch @@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; -+import net.minecraft.util.com.google.common.cache.Cache; -+import net.minecraft.util.com.google.common.cache.CacheBuilder; ++import com.google.common.cache.Cache; ++import com.google.common.cache.CacheBuilder; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; diff --git a/CraftBukkit-Patches/0165-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0146-Only-fetch-an-online-UUID-in-online-mode.patch similarity index 100% rename from CraftBukkit-Patches/0165-Only-fetch-an-online-UUID-in-online-mode.patch rename to CraftBukkit-Patches/0146-Only-fetch-an-online-UUID-in-online-mode.patch diff --git a/CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch similarity index 95% rename from CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch rename to CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch index 64719ef247..a3382434c0 100644 --- a/CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch +++ b/CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch @@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10); + // Spigot start -+ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); -+ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); ++ gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new gnu.trove.map.hash.TObjectDoubleHashMap(); ++ gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new gnu.trove.map.hash.TObjectDoubleHashMap(); + Map attributesByName = new HashMap(); + attributeTracker.put( "generic.maxHealth", 20.0 ); + attributesByName.put( "generic.maxHealth", GenericAttributes.maxHealth ); diff --git a/CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch b/CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch similarity index 51% rename from CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch rename to CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch index 8f64b48501..e512a43d12 100644 --- a/CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch +++ b/CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch @@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; -- double d3 = 5.0D; -+ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; // Spigot - Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; +- double d3 = 5.0D; ++ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; // Spigot + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch b/CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch similarity index 78% rename from CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch rename to CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch index cd8ed73d28..79a312bd81 100644 --- a/CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch +++ b/CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch @@ -10,13 +10,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -0,0 +0,0 @@ public class PersistentCollection { - private IDataManager a; - private Map b = new HashMap(); -- private List c = new ArrayList(); -+ public List c = new ArrayList(); // Spigot - private Map d = new HashMap(); + private IDataManager b; + protected Map a = Maps.newHashMap(); +- private List c = Lists.newArrayList(); ++ public List c = Lists.newArrayList(); // Spigot + private Map d = Maps.newHashMap(); public PersistentCollection(IDataManager idatamanager) { +@@ -0,0 +0,0 @@ public class PersistentCollection { + return oshort.shortValue(); + } + } +-} ++} +\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java @@ -32,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + { + WorldMap map = (WorldMap) o; + map.i.remove( entity ); -+ for ( Iterator iter = (Iterator) map.f.iterator(); iter.hasNext(); ) ++ for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) + { + if ( iter.next().trackee == entity ) + { @@ -43,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Spigot end this.everyoneSleeping(); + this.b(entity); } - } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java @@ -52,10 +59,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { public byte scale; public byte[] colors = new byte[16384]; - public List f = new ArrayList(); -- private Map i = new HashMap(); -+ public Map i = new HashMap(); // Spigot - public Map decorations = new LinkedHashMap(); - + public List g = Lists.newArrayList(); +- private Map i = Maps.newHashMap(); ++ public Map i = Maps.newHashMap(); // Spigot + public Map decorations = Maps.newLinkedHashMap(); + // CraftBukkit start -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch b/CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch similarity index 79% rename from CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch rename to CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch index 650b48471c..a684adc2aa 100644 --- a/CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch +++ b/CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch @@ -12,13 +12,13 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { - TileEntity result = super.getTileEntity(i, j, k); - Block type = getType(i, j, k); +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + TileEntity result = super.getTileEntity(pos); + Block type = getType(pos).getBlock(); - if (type == Blocks.CHEST) { + if (type == Blocks.CHEST || type == Blocks.TRAPPED_CHEST) { // Spigot if (!(result instanceof TileEntityChest)) { - result = fixTileEntity(i, j, k, type, result); + result = fixTileEntity(pos, type, result); } -- \ No newline at end of file diff --git a/CraftBukkit-Patches/0171-Remove-uneeded-validation.patch b/CraftBukkit-Patches/0151-Remove-uneeded-validation.patch similarity index 100% rename from CraftBukkit-Patches/0171-Remove-uneeded-validation.patch rename to CraftBukkit-Patches/0151-Remove-uneeded-validation.patch diff --git a/CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch b/CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch similarity index 96% rename from CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch rename to CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch index 08a0a5708f..bd0b4dfeed 100644 --- a/CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch +++ b/CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { } } @@ -17,9 +17,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (flag1) { entity.extinguish(); } -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - super.bj(); - this.a(StatisticList.r, 1); +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + super.bE(); + this.b(StatisticList.u); if (this.isSprinting()) { - this.applyExhaustion(0.8F); + this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value @@ -27,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.applyExhaustion(0.2F); + this.applyExhaustion(world.spigotConfig.walkExhaustion); // Spigot - Change to use configurable value } - } + } diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java diff --git a/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch b/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch deleted file mode 100644 index c3acf76113..0000000000 --- a/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Suddenly -Date: Mon, 14 Jul 2014 23:43:10 +0100 -Subject: [PATCH] Fix misnamed function from 1.7.10 update - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { - - public void ac() { - if (this.passenger != null) { -- this.passenger.setPosition(this.locX, this.locY + this.ad() + this.passenger.ad(), this.locZ); -+ this.passenger.setPosition(this.locX, this.locY + this.ae() + this.passenger.ad(), this.locZ); // Spigot - } - } - --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch b/CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch similarity index 95% rename from CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch rename to CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch index 9346452c6a..d71afb2dc3 100644 --- a/CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch +++ b/CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch @@ -8,9 +8,9 @@ diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/sp index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ import net.minecraft.server.AttributeRanged; +@@ -0,0 +0,0 @@ import gnu.trove.map.hash.TObjectIntHashMap; + import net.minecraft.server.AttributeRanged; import net.minecraft.server.GenericAttributes; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; diff --git a/CraftBukkit-Patches/0174-Skip-invalid-enchants-in-CraftMetaItem.patch b/CraftBukkit-Patches/0154-Skip-invalid-enchants-in-CraftMetaItem.patch similarity index 100% rename from CraftBukkit-Patches/0174-Skip-invalid-enchants-in-CraftMetaItem.patch rename to CraftBukkit-Patches/0154-Skip-invalid-enchants-in-CraftMetaItem.patch diff --git a/CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch b/CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch similarity index 94% rename from CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch rename to CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch index beb3105592..f79524b9f4 100644 --- a/CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch +++ b/CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { } - public void h() { + public void s_() { + if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot this.lastX = this.locX; this.lastY = this.locY; @@ -22,14 +22,14 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { } super.tickEntities(); + spigotConfig.currentPrimedTnt = 0; // Spigot } - public void i() { + public void j() { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0156-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch similarity index 100% rename from CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch rename to CraftBukkit-Patches/0156-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch diff --git a/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch b/CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch similarity index 91% rename from CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch rename to CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch index 00a8d4bc01..d25fb39380 100644 --- a/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch +++ b/CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; -- if (this.e++ == 100 && !this.world.isStatic) { -+ if (this.e++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency - this.e = 0; +- if (this.c++ == 100 && !this.world.isStatic) { ++ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency + this.c = 0; if (!this.dead && !this.survives()) { // CraftBukkit start - fire break events diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/CraftBukkit-Patches/0157-Fix-IP-banning.patch b/CraftBukkit-Patches/0157-Fix-IP-banning.patch deleted file mode 100644 index 017d383dbf..0000000000 --- a/CraftBukkit-Patches/0157-Fix-IP-banning.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 19 Jul 2014 22:13:44 +0100 -Subject: [PATCH] Fix IP banning - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } else if (!this.isWhitelisted(gameprofile)) { - // return "You are not white-listed on this server!"; - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot -- } else if (this.k.isBanned(socketaddress) && !this.k.get(gameprofile).hasExpired()) { -+ } else if (this.k.isBanned(socketaddress) && !this.k.get(socketaddress).hasExpired()) { // Spigot - IpBanEntry ipbanentry = this.k.get(socketaddress); - - s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getReason(); --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch b/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch new file mode 100644 index 0000000000..dd5e0c51c6 --- /dev/null +++ b/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 21 Sep 2014 10:06:01 +1000 +Subject: [PATCH] Fix Some Memory Leaks + + +diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EnchantmentManager.java ++++ b/src/main/java/net/minecraft/server/EnchantmentManager.java +@@ -0,0 +0,0 @@ public class EnchantmentManager { + if (entity instanceof EntityHuman) { + a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); + } +- ++ // Spigot start ++ d.b = null; ++ d.a = null; ++ // Spigot end + } + + public static void b(EntityLiving entityliving, Entity entity) { +@@ -0,0 +0,0 @@ public class EnchantmentManager { + if (entityliving instanceof EntityHuman) { + a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); + } +- ++ // Spigot start ++ e.a = null; ++ e.b = null; ++ // Spigot end + } + + public static int a(EntityLiving entityliving) { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import java.lang.ref.WeakReference; // Spigot + import java.util.Iterator; + import java.util.List; + import java.util.UUID; +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + protected NavigationAbstract navigation; + protected final PathfinderGoalSelector goalSelector; + protected final PathfinderGoalSelector targetSelector; +- private EntityLiving goalTarget; ++ private WeakReference goalTarget = new WeakReference(null); + private EntitySenses bi; + private ItemStack[] equipment = new ItemStack[5]; + public float[] dropChances = new float[5]; +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public EntityLiving getGoalTarget() { +- return this.goalTarget; ++ return this.goalTarget.get(); // Spigot + } + + public void setGoalTarget(EntityLiving entityliving) { +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + entityliving = null; + } + } +- this.goalTarget = entityliving; ++ this.goalTarget = new WeakReference(entityliving); // Spigot + // CraftBukkit end + } + +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public void close(IChatBaseComponent ichatbasecomponent) { + // Spigot Start + this.preparing = false; ++ this.h.clear(); + // Spigot End + if (this.i.isOpen()) { + this.i.close(); // We can't wait as this may be called from an event loop. +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +@@ -0,0 +0,0 @@ package net.minecraft.server; + public class PathfinderGoalSwell extends PathfinderGoal { + + EntityCreeper a; +- EntityLiving b; ++ // EntityLiving b; // Spigot + + public PathfinderGoalSwell(EntityCreeper entitycreeper) { + this.a = entitycreeper; +@@ -0,0 +0,0 @@ public class PathfinderGoalSwell extends PathfinderGoal { + + public void c() { + this.a.getNavigation().n(); +- this.b = this.a.getGoalTarget(); ++ // this.b = this.a.getGoalTarget(); // Spigot + } + + public void d() { +- this.b = null; ++ // this.b = null; // Spigot + } + + public void e() { +- if (this.b == null) { ++ // Spigot start ++ EntityLiving b = this.a.getGoalTarget(); ++ if (b == null) { + this.a.a(-1); +- } else if (this.a.h(this.b) > 49.0D) { ++ } else if (this.a.h(b) > 49.0D) { + this.a.a(-1); +- } else if (!this.a.getEntitySenses().a(this.b)) { ++ } else if (!this.a.getEntitySenses().a(b)) { + this.a.a(-1); + } else { + this.a.a(1); + } ++ // Spigot end + } + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch b/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch new file mode 100644 index 0000000000..6e1c0d7c82 --- /dev/null +++ b/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 30 Sep 2014 21:43:15 +1000 +Subject: [PATCH] Refactor ItemDoor Place + + +diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ItemDoor.java ++++ b/src/main/java/net/minecraft/server/ItemDoor.java +@@ -0,0 +0,0 @@ public class ItemDoor extends Item { + BlockPosition blockposition3 = blockposition.up(); + IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); + +- world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); +- world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); +- world.applyPhysics(blockposition, block); +- world.applyPhysics(blockposition3, block); ++ // Spigot start - update physics after the block multi place event ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 3); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 3); ++ // world.applyPhysics(blockposition, block); ++ // world.applyPhysics(blockposition3, block); ++ // Spigot end + } + } +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch b/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch new file mode 100644 index 0000000000..03dfef8d2c --- /dev/null +++ b/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 30 Sep 2014 21:49:10 +1000 +Subject: [PATCH] Don't Fire InventoryCloseEvent Unless Required + + +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -0,0 +0,0 @@ public class CraftEventFactory { + } + + public static void handleInventoryCloseEvent(EntityHuman human) { ++ if (human.activeContainer == human.defaultContainer) return; // Spigot + InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); + human.world.getServer().getPluginManager().callEvent(event); + human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); +-- \ No newline at end of file diff --git a/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch b/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch deleted file mode 100644 index 946f8867e7..0000000000 --- a/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Thu, 31 Jul 2014 20:05:06 -0500 -Subject: [PATCH] Fix missed diff from Minecraft 1.3.1 update - - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - this.a(pair.x, pair.z, true).a(entityplayer); - } - -- if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) { -+ if (j1 > 1 || j1 < -1 || k1 > 1 || k1 < -1) { // Spigot - missed diff - Collections.sort(entityplayer.chunkCoordIntPairQueue, new ChunkCoordComparator(entityplayer)); - } - // CraftBukkit end --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch b/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch deleted file mode 100644 index cdd6e74123..0000000000 --- a/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 30 Aug 2014 18:36:32 +0100 -Subject: [PATCH] Fix a missed rename in WorldGenGroundBush - - -diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java -+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java -@@ -0,0 +0,0 @@ public class WorldGenGroundBush extends WorldGenTrees { - this.a = j; - } - -- public boolean a(World world, Random random, int i, int j, int k) { -+ public boolean generate(World world, Random random, int i, int j, int k) { // Spigot - Block block; - - while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) && j > 0) { --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0179-Snapshot-imports.patch b/CraftBukkit-Patches/0179-Snapshot-imports.patch deleted file mode 100644 index d5d1c31c03..0000000000 --- a/CraftBukkit-Patches/0179-Snapshot-imports.patch +++ /dev/null @@ -1,3252 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 1 Sep 2014 16:47:48 +1000 -Subject: [PATCH] Snapshot imports - - -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class MerchantRecipe { -+ -+ private ItemStack buyingItem1; -+ private ItemStack buyingItem2; -+ private ItemStack sellingItem; -+ private int uses; -+ private int maxUses; -+ -+ public MerchantRecipe(NBTTagCompound nbttagcompound) { -+ this.a(nbttagcompound); -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) { -+ this.buyingItem1 = itemstack; -+ this.buyingItem2 = itemstack1; -+ this.sellingItem = itemstack2; -+ this.maxUses = 7; -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1) { -+ this(itemstack, (ItemStack) null, itemstack1); -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, Item item) { -+ this(itemstack, new ItemStack(item)); -+ } -+ -+ public ItemStack getBuyItem1() { -+ return this.buyingItem1; -+ } -+ -+ public ItemStack getBuyItem2() { -+ return this.buyingItem2; -+ } -+ -+ public boolean hasSecondItem() { -+ return this.buyingItem2 != null; -+ } -+ -+ public ItemStack getBuyItem3() { -+ return this.sellingItem; -+ } -+ -+ public boolean a(MerchantRecipe merchantrecipe) { -+ return this.buyingItem1.getItem() == merchantrecipe.buyingItem1.getItem() && this.sellingItem.getItem() == merchantrecipe.sellingItem.getItem() ? this.buyingItem2 == null && merchantrecipe.buyingItem2 == null || this.buyingItem2 != null && merchantrecipe.buyingItem2 != null && this.buyingItem2.getItem() == merchantrecipe.buyingItem2.getItem() : false; -+ } -+ -+ public boolean b(MerchantRecipe merchantrecipe) { -+ return this.a(merchantrecipe) && (this.buyingItem1.count < merchantrecipe.buyingItem1.count || this.buyingItem2 != null && this.buyingItem2.count < merchantrecipe.buyingItem2.count); -+ } -+ -+ public void f() { -+ ++this.uses; -+ } -+ -+ public void a(int i) { -+ this.maxUses += i; -+ } -+ -+ public boolean g() { -+ return this.uses >= this.maxUses; -+ } -+ -+ public void a(NBTTagCompound nbttagcompound) { -+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("buy"); -+ -+ this.buyingItem1 = ItemStack.createStack(nbttagcompound1); -+ NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("sell"); -+ -+ this.sellingItem = ItemStack.createStack(nbttagcompound2); -+ if (nbttagcompound.hasKeyOfType("buyB", 10)) { -+ this.buyingItem2 = ItemStack.createStack(nbttagcompound.getCompound("buyB")); -+ } -+ -+ if (nbttagcompound.hasKeyOfType("uses", 99)) { -+ this.uses = nbttagcompound.getInt("uses"); -+ } -+ -+ if (nbttagcompound.hasKeyOfType("maxUses", 99)) { -+ this.maxUses = nbttagcompound.getInt("maxUses"); -+ } else { -+ this.maxUses = 7; -+ } -+ } -+ -+ public NBTTagCompound i() { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ nbttagcompound.set("buy", this.buyingItem1.save(new NBTTagCompound())); -+ nbttagcompound.set("sell", this.sellingItem.save(new NBTTagCompound())); -+ if (this.buyingItem2 != null) { -+ nbttagcompound.set("buyB", this.buyingItem2.save(new NBTTagCompound())); -+ } -+ -+ nbttagcompound.setInt("uses", this.uses); -+ nbttagcompound.setInt("maxUses", this.maxUses); -+ return nbttagcompound; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+ -+public class MerchantRecipeList extends ArrayList { -+ -+ public MerchantRecipeList() {} -+ -+ public MerchantRecipeList(NBTTagCompound nbttagcompound) { -+ this.a(nbttagcompound); -+ } -+ -+ public MerchantRecipe a(ItemStack itemstack, ItemStack itemstack1, int i) { -+ if (i > 0 && i < this.size()) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ return itemstack.getItem() == merchantrecipe.getBuyItem1().getItem() && (itemstack1 == null && !merchantrecipe.hasSecondItem() || merchantrecipe.hasSecondItem() && itemstack1 != null && merchantrecipe.getBuyItem2().getItem() == itemstack1.getItem()) && itemstack.count >= merchantrecipe.getBuyItem1().count && (!merchantrecipe.hasSecondItem() || itemstack1.count >= merchantrecipe.getBuyItem2().count) ? merchantrecipe : null; -+ } else { -+ for (int j = 0; j < this.size(); ++j) { -+ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(j); -+ -+ if (itemstack.getItem() == merchantrecipe1.getBuyItem1().getItem() && itemstack.count >= merchantrecipe1.getBuyItem1().count && (!merchantrecipe1.hasSecondItem() && itemstack1 == null || merchantrecipe1.hasSecondItem() && itemstack1 != null && merchantrecipe1.getBuyItem2().getItem() == itemstack1.getItem() && itemstack1.count >= merchantrecipe1.getBuyItem2().count)) { -+ return merchantrecipe1; -+ } -+ } -+ -+ return null; -+ } -+ } -+ -+ public void a(MerchantRecipe merchantrecipe) { -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(i); -+ -+ if (merchantrecipe.a(merchantrecipe1)) { -+ if (merchantrecipe.b(merchantrecipe1)) { -+ this.set(i, merchantrecipe); -+ } -+ -+ return; -+ } -+ } -+ -+ this.add(merchantrecipe); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte((byte) (this.size() & 255)); -+ -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ packetdataserializer.a(merchantrecipe.getBuyItem1()); -+ packetdataserializer.a(merchantrecipe.getBuyItem3()); -+ ItemStack itemstack = merchantrecipe.getBuyItem2(); -+ -+ packetdataserializer.writeBoolean(itemstack != null); -+ if (itemstack != null) { -+ packetdataserializer.a(itemstack); -+ } -+ -+ packetdataserializer.writeBoolean(merchantrecipe.g()); -+ } -+ } -+ -+ public void a(NBTTagCompound nbttagcompound) { -+ NBTTagList nbttaglist = nbttagcompound.getList("Recipes", 10); -+ -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i); -+ -+ this.add(new MerchantRecipe(nbttagcompound1)); -+ } -+ } -+ -+ public NBTTagCompound a() { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ NBTTagList nbttaglist = new NBTTagList(); -+ -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ nbttaglist.add(merchantrecipe.i()); -+ } -+ -+ nbttagcompound.set("Recipes", nbttaglist); -+ return nbttagcompound; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketDecoder.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.List; -+ -+import net.minecraft.util.com.google.common.collect.BiMap; -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -+import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+import org.apache.logging.log4j.Marker; -+import org.apache.logging.log4j.MarkerManager; -+ -+public class PacketDecoder extends ByteToMessageDecoder { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private static final Marker b = MarkerManager.getMarker("PACKET_RECEIVED", NetworkManager.b); -+ private final NetworkStatistics c; -+ -+ public PacketDecoder(NetworkStatistics networkstatistics) { -+ this.c = networkstatistics; -+ } -+ -+ protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List list) throws IOException { -+ int i = bytebuf.readableBytes(); -+ -+ if (i != 0) { -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); -+ int j = packetdataserializer.a(); -+ Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j); -+ -+ if (packet == null) { -+ throw new IOException("Bad packet id " + j); -+ } else { -+ packet.a(packetdataserializer); -+ if (packetdataserializer.readableBytes() > 0) { -+ throw new IOException("Packet was larger than I expected, found " + packetdataserializer.readableBytes() + " bytes extra whilst reading packet " + j); -+ } else { -+ list.add(packet); -+ this.c.a(j, (long) i); -+ if (a.isDebugEnabled()) { -+ a.debug(b, " IN: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), Integer.valueOf(j), packet.getClass().getName(), packet.b()}); -+ } -+ } -+ } -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInArmAnimation extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayInArmAnimation() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b)}); -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInBlockDig extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int face; -+ private int e; -+ -+ public PacketPlayInBlockDig() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.e = packetdataserializer.readUnsignedByte(); -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ this.face = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.face); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public int f() { -+ return this.face; -+ } -+ -+ public int g() { -+ return this.e; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInBlockPlace extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private ItemStack e; -+ private float f; -+ private float g; -+ private float h; -+ -+ public PacketPlayInBlockPlace() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.c(); -+ this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ this.g = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ this.h = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.a(this.e); -+ packetdataserializer.writeByte((int) (this.f * 16.0F)); -+ packetdataserializer.writeByte((int) (this.g * 16.0F)); -+ packetdataserializer.writeByte((int) (this.h * 16.0F)); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public int getFace() { -+ return this.d; -+ } -+ -+ public ItemStack getItemStack() { -+ return this.e; -+ } -+ -+ public float h() { -+ return this.f; -+ } -+ -+ public float i() { -+ return this.g; -+ } -+ -+ public float j() { -+ return this.h; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInEntityAction extends Packet { -+ -+ private int a; -+ private int animation; -+ private int c; -+ -+ public PacketPlayInEntityAction() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.animation = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.animation); -+ packetdataserializer.writeInt(this.c); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int d() { -+ return this.animation; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInKeepAlive extends Packet { -+ -+ private int a; -+ -+ public PacketPlayInKeepAlive() {} -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInPosition extends PacketPlayInFlying { -+ -+ public PacketPlayInPosition() { -+ this.hasPos = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.x = packetdataserializer.readDouble(); -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ this.z = packetdataserializer.readDouble(); -+ super.a(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.x); -+ packetdataserializer.writeDouble(this.y); -+ packetdataserializer.writeDouble(this.stance); -+ packetdataserializer.writeDouble(this.z); -+ super.b(packetdataserializer); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInPositionLook extends PacketPlayInFlying { -+ -+ public PacketPlayInPositionLook() { -+ this.hasPos = true; -+ this.hasLook = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.x = packetdataserializer.readDouble(); -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ this.z = packetdataserializer.readDouble(); -+ this.yaw = packetdataserializer.readFloat(); -+ this.pitch = packetdataserializer.readFloat(); -+ super.a(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.x); -+ packetdataserializer.writeDouble(this.y); -+ packetdataserializer.writeDouble(this.stance); -+ packetdataserializer.writeDouble(this.z); -+ packetdataserializer.writeFloat(this.yaw); -+ packetdataserializer.writeFloat(this.pitch); -+ super.b(packetdataserializer); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInSettings extends Packet { -+ -+ private String a; -+ private int b; -+ private EnumChatVisibility c; -+ private boolean d; -+ private EnumDifficulty e; -+ private boolean f; -+ -+ public PacketPlayInSettings() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(7); -+ this.b = packetdataserializer.readByte(); -+ this.c = EnumChatVisibility.a(packetdataserializer.readByte()); -+ this.d = packetdataserializer.readBoolean(); -+ this.e = EnumDifficulty.getById(packetdataserializer.readByte()); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c.a()); -+ packetdataserializer.writeBoolean(this.d); -+ packetdataserializer.writeByte(this.e.a()); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public EnumChatVisibility e() { -+ return this.c; -+ } -+ -+ public boolean f() { -+ return this.d; -+ } -+ -+ public EnumDifficulty g() { -+ return this.e; -+ } -+ -+ public boolean h() { -+ return this.f; -+ } -+ -+ public String b() { -+ return String.format("lang=\'%s\', view=%d, chat=%s, col=%b, difficulty=%s, cape=%b", new Object[] { this.a, Integer.valueOf(this.b), this.c, Boolean.valueOf(this.d), this.e, Boolean.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInSteerVehicle extends Packet { -+ -+ private float a; -+ private float b; -+ private boolean c; -+ private boolean d; -+ -+ public PacketPlayInSteerVehicle() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.b = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readBoolean(); -+ this.d = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeFloat(this.b); -+ packetdataserializer.writeBoolean(this.c); -+ packetdataserializer.writeBoolean(this.d); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public float c() { -+ return this.a; -+ } -+ -+ public float d() { -+ return this.b; -+ } -+ -+ public boolean e() { -+ return this.c; -+ } -+ -+ public boolean f() { -+ return this.d; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import net.minecraft.util.org.apache.commons.lang3.StringUtils; -+ -+import java.io.IOException; -+ -+public class PacketPlayInTabComplete extends Packet { -+ -+ private String a; -+ -+ public PacketPlayInTabComplete() {} -+ -+ public PacketPlayInTabComplete(String s) { -+ this.a = s; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(32767); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(StringUtils.substring(this.a, 0, 32767)); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String c() { -+ return this.a; -+ } -+ -+ public String b() { -+ return String.format("message=\'%s\'", new Object[] { this.a}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInUpdateSign extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private String[] d; -+ -+ public PacketPlayInUpdateSign() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = new String[4]; -+ -+ for (int i = 0; i < 4; ++i) { -+ this.d[i] = packetdataserializer.c(15); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ -+ for (int i = 0; i < 4; ++i) { -+ packetdataserializer.a(this.d[i]); -+ } -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public String[] f() { -+ return this.d; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInUseEntity extends Packet { -+ -+ private int a; -+ private EnumEntityUseAction action; -+ -+ public PacketPlayInUseEntity() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.action.ordinal()); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public Entity a(World world) { -+ return world.getEntity(this.a); -+ } -+ -+ public EnumEntityUseAction c() { -+ return this.action; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInWindowClick extends Packet { -+ -+ private int a; -+ private int slot; -+ private int button; -+ private short d; -+ private ItemStack item; -+ private int shift; -+ -+ public PacketPlayInWindowClick() {} -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readByte(); -+ this.slot = packetdataserializer.readShort(); -+ this.button = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readShort(); -+ this.shift = packetdataserializer.readByte(); -+ this.item = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.slot); -+ packetdataserializer.writeByte(this.button); -+ packetdataserializer.writeShort(this.d); -+ packetdataserializer.writeByte(this.shift); -+ packetdataserializer.a(this.item); -+ } -+ -+ public String b() { -+ return this.item != null ? String.format("id=%d, slot=%d, button=%d, type=%d, itemid=%d, itemcount=%d, itemaux=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift), Integer.valueOf(Item.getId(this.item.getItem())), Integer.valueOf(this.item.count), Integer.valueOf(this.item.getData())}) : String.format("id=%d, slot=%d, button=%d, type=%d, itemid=-1", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift)}); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.slot; -+ } -+ -+ public int e() { -+ return this.button; -+ } -+ -+ public short f() { -+ return this.d; -+ } -+ -+ public ItemStack g() { -+ return this.item; -+ } -+ -+ public int h() { -+ return this.shift; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBed extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutBed() {} -+ -+ public PacketPlayOutBed(EntityHuman entityhuman, int i, int j, int k) { -+ this.b = i; -+ this.c = j; -+ this.d = k; -+ this.a = entityhuman.getId(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeInt(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBlockAction extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private Block f; -+ -+ public PacketPlayOutBlockAction() {} -+ -+ public PacketPlayOutBlockAction(int i, int j, int k, Block block, int l, int i1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = i1; -+ this.f = block; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.readUnsignedByte(); -+ this.f = Block.getById(packetdataserializer.a() & 4095); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.b(Block.getId(this.f) & 4095); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBlockBreakAnimation extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ -+ public PacketPlayOutBlockBreakAnimation() {} -+ -+ public PacketPlayOutBlockBreakAnimation(int i, int j, int k, int l, int i1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = i1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.e); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutChat extends Packet { -+ -+ private IChatBaseComponent a; -+ private boolean b; -+ -+ public PacketPlayOutChat() { -+ this.b = true; -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { -+ this(ichatbasecomponent, true); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) { -+ this.b = true; -+ this.a = ichatbasecomponent; -+ this.b = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = ChatSerializer.a(packetdataserializer.c(32767)); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(ChatSerializer.a(this.a)); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("message=\'%s\'", new Object[] { this.a}); -+ } -+ -+ public boolean d() { -+ return this.b; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutCollect extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayOutCollect() {} -+ -+ public PacketPlayOutCollect(int i, int j) { -+ this.a = i; -+ this.b = j; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutCustomPayload extends Packet { -+ -+ private String tag; -+ private byte[] data; -+ -+ public PacketPlayOutCustomPayload() {} -+ -+ public PacketPlayOutCustomPayload(String s, ByteBuf bytebuf) { -+ this(s, bytebuf.array()); -+ } -+ -+ public PacketPlayOutCustomPayload(String s, byte[] abyte) { -+ this.tag = s; -+ this.data = abyte; -+ if (abyte.length >= 1048576) { -+ throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes"); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.tag = packetdataserializer.c(20); -+ this.data = new byte[packetdataserializer.readUnsignedShort()]; -+ packetdataserializer.readBytes(this.data); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.tag); -+ packetdataserializer.writeShort(this.data.length); -+ packetdataserializer.writeBytes(this.data); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntity extends Packet { -+ -+ protected int a; -+ protected byte b; -+ protected byte c; -+ protected byte d; -+ protected byte e; -+ protected byte f; -+ protected boolean g; -+ -+ public PacketPlayOutEntity() {} -+ -+ public PacketPlayOutEntity(int i) { -+ this.a = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d", new Object[] { Integer.valueOf(this.a)}); -+ } -+ -+ public String toString() { -+ return "Entity_" + super.toString(); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityDestroy extends Packet { -+ -+ private int[] a; -+ -+ public PacketPlayOutEntityDestroy() {} -+ -+ public PacketPlayOutEntityDestroy(int... aint) { -+ this.a = aint; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = new int[packetdataserializer.readByte()]; -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ this.a[i] = packetdataserializer.readInt(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a.length); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeInt(this.a[i]); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ StringBuilder stringbuilder = new StringBuilder(); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ if (i > 0) { -+ stringbuilder.append(", "); -+ } -+ -+ stringbuilder.append(this.a[i]); -+ } -+ -+ return String.format("entities=%d[%s]", new Object[] { Integer.valueOf(this.a.length), stringbuilder}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityEffect extends Packet { -+ -+ private int a; -+ private byte b; -+ private byte c; -+ private short d; -+ -+ public PacketPlayOutEntityEffect() {} -+ -+ public PacketPlayOutEntityEffect(int i, MobEffect mobeffect) { -+ this.a = i; -+ this.b = (byte) (mobeffect.getEffectId() & 255); -+ this.c = (byte) (mobeffect.getAmplifier() & 255); -+ if (mobeffect.getDuration() > 32767) { -+ this.d = 32767; -+ } else { -+ this.d = (short) mobeffect.getDuration(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeShort(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityEquipment extends Packet { -+ -+ private int a; -+ private int b; -+ private ItemStack c; -+ -+ public PacketPlayOutEntityEquipment() {} -+ -+ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) { -+ this.a = i; -+ this.b = j; -+ this.c = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.a(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("entity=%d, slot=%d, item=%s", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), this.c}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityHeadRotation extends Packet { -+ -+ private int a; -+ private byte b; -+ -+ public PacketPlayOutEntityHeadRotation() {} -+ -+ public PacketPlayOutEntityHeadRotation(Entity entity, byte b0) { -+ this.a = entity.getId(); -+ this.b = b0; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, rot=%d", new Object[] { Integer.valueOf(this.a), Byte.valueOf(this.b)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityLook extends PacketPlayOutEntity { -+ -+ public PacketPlayOutEntityLook() { -+ this.g = true; -+ } -+ -+ public PacketPlayOutEntityLook(int i, byte b0, byte b1) { -+ super(i); -+ this.e = b0; -+ this.f = b1; -+ this.g = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.e), Byte.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutEntityMetadata extends Packet { -+ -+ private int a; -+ private List b; -+ -+ public PacketPlayOutEntityMetadata() {} -+ -+ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) { -+ this.a = i; -+ if (flag) { -+ this.b = datawatcher.c(); -+ } else { -+ this.b = datawatcher.b(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = DataWatcher.b(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ DataWatcher.a(this.b, packetdataserializer); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityTeleport extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private byte e; -+ private byte f; -+ -+ public PacketPlayOutEntityTeleport() {} -+ -+ public PacketPlayOutEntityTeleport(Entity entity) { -+ this.a = entity.getId(); -+ this.b = MathHelper.floor(entity.locX * 32.0D); -+ this.c = MathHelper.floor(entity.locY * 32.0D); -+ this.d = MathHelper.floor(entity.locZ * 32.0D); -+ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F)); -+ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); -+ } -+ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = b0; -+ this.f = b1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityVelocity extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutEntityVelocity() {} -+ -+ public PacketPlayOutEntityVelocity(Entity entity) { -+ this(entity.getId(), entity.motX, entity.motY, entity.motZ); -+ } -+ -+ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) { -+ this.a = i; -+ double d3 = 3.9D; -+ -+ if (d0 < -d3) { -+ d0 = -d3; -+ } -+ -+ if (d1 < -d3) { -+ d1 = -d3; -+ } -+ -+ if (d2 < -d3) { -+ d2 = -d3; -+ } -+ -+ if (d0 > d3) { -+ d0 = d3; -+ } -+ -+ if (d1 > d3) { -+ d1 = d3; -+ } -+ -+ if (d2 > d3) { -+ d2 = d3; -+ } -+ -+ this.b = (int) (d0 * 8000.0D); -+ this.c = (int) (d1 * 8000.0D); -+ this.d = (int) (d2 * 8000.0D); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readShort(); -+ this.d = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeShort(this.c); -+ packetdataserializer.writeShort(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Float.valueOf((float) this.b / 8000.0F), Float.valueOf((float) this.c / 8000.0F), Float.valueOf((float) this.d / 8000.0F)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutExperience extends Packet { -+ -+ private float a; -+ private int b; -+ private int c; -+ -+ public PacketPlayOutExperience() {} -+ -+ public PacketPlayOutExperience(float f, int i, int j) { -+ this.a = f; -+ this.b = i; -+ this.c = j; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readShort(); -+ this.b = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeShort(this.c); -+ packetdataserializer.writeShort(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutKeepAlive extends Packet { -+ -+ private int a; -+ -+ public PacketPlayOutKeepAlive() {} -+ -+ public PacketPlayOutKeepAlive(int i) { -+ this.a = i; -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutLogin extends Packet { -+ -+ private int a; -+ private boolean b; -+ private EnumGamemode c; -+ private int d; -+ private EnumDifficulty e; -+ private int f; -+ private WorldType g; -+ -+ public PacketPlayOutLogin() {} -+ -+ public PacketPlayOutLogin(int i, EnumGamemode enumgamemode, boolean flag, int j, EnumDifficulty enumdifficulty, int k, WorldType worldtype) { -+ this.a = i; -+ this.d = j; -+ this.e = enumdifficulty; -+ this.c = enumgamemode; -+ this.f = k; -+ this.b = flag; -+ this.g = worldtype; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ short short1 = packetdataserializer.readUnsignedByte(); -+ -+ this.b = (short1 & 8) == 8; -+ int i = short1 & -9; -+ -+ this.c = EnumGamemode.getById(i); -+ this.d = packetdataserializer.readByte(); -+ this.e = EnumDifficulty.getById(packetdataserializer.readUnsignedByte()); -+ this.f = packetdataserializer.readUnsignedByte(); -+ this.g = WorldType.getType(packetdataserializer.c(16)); -+ if (this.g == null) { -+ this.g = WorldType.NORMAL; -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ int i = this.c.getId(); -+ -+ if (this.b) { -+ i |= 8; -+ } -+ -+ packetdataserializer.writeByte(i); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e.a()); -+ packetdataserializer.writeByte(this.f); -+ packetdataserializer.a(this.g.name()); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("eid=%d, gameType=%d, hardcore=%b, dimension=%d, difficulty=%s, maxplayers=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.c.getId()), Boolean.valueOf(this.b), Integer.valueOf(this.d), this.e, Integer.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutMap extends Packet { -+ -+ private int a; -+ private byte[] b; -+ -+ public PacketPlayOutMap() {} -+ -+ public PacketPlayOutMap(int i, byte[] abyte) { -+ this.a = i; -+ this.b = abyte; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = new byte[packetdataserializer.readUnsignedShort()]; -+ packetdataserializer.readBytes(this.b); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeShort(this.b.length); -+ packetdataserializer.writeBytes(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, length=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b.length)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.ByteArrayOutputStream; -+import java.io.DataOutputStream; -+import java.io.IOException; -+ -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class PacketPlayOutMultiBlockChange extends Packet { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private ChunkCoordIntPair b; -+ private byte[] c; -+ private int d; -+ -+ public PacketPlayOutMultiBlockChange() {} -+ -+ public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) { -+ 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); -+ -+ 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)); -+ } -+ -+ this.c = bytearrayoutputstream.toByteArray(); -+ if (this.c.length != j) { -+ throw new RuntimeException("Expected length " + j + " doesn\'t match received length " + this.c.length); -+ } -+ } catch (IOException ioexception) { -+ a.error("Couldn\'t create bulk block update packet", ioexception); -+ this.c = null; -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.b = new ChunkCoordIntPair(packetdataserializer.readInt(), packetdataserializer.readInt()); -+ this.d = packetdataserializer.readShort() & '\uffff'; -+ int i = packetdataserializer.readInt(); -+ -+ if (i > 0) { -+ this.c = new byte[i]; -+ packetdataserializer.readBytes(this.c); -+ } -+ } -+ -+ 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); -+ } else { -+ packetdataserializer.writeInt(0); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("xc=%d, zc=%d, count=%d", new Object[] { Integer.valueOf(this.b.x), Integer.valueOf(this.b.z), Integer.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutOpenSignEditor extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ -+ public PacketPlayOutOpenSignEditor() {} -+ -+ public PacketPlayOutOpenSignEditor(int i, int j, int k) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ } -+ -+ 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 -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutPlayerInfo extends Packet { -+ -+ private String a; -+ private boolean b; -+ private int c; -+ -+ public PacketPlayOutPlayerInfo() {} -+ -+ public PacketPlayOutPlayerInfo(String s, boolean flag, int i) { -+ this.a = s; -+ this.b = flag; -+ this.c = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.b = packetdataserializer.readBoolean(); -+ this.c = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeBoolean(this.b); -+ packetdataserializer.writeShort(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutPosition extends Packet { -+ -+ private double a; -+ private double b; -+ private double c; -+ private float d; -+ private float e; -+ private boolean f; -+ -+ public PacketPlayOutPosition() {} -+ -+ public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag) { -+ this.a = d0; -+ this.b = d1; -+ this.c = d2; -+ this.d = f; -+ this.e = f1; -+ this.f = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readDouble(); -+ this.b = packetdataserializer.readDouble(); -+ this.c = packetdataserializer.readDouble(); -+ this.d = packetdataserializer.readFloat(); -+ this.e = packetdataserializer.readFloat(); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.a); -+ packetdataserializer.writeDouble(this.b); -+ packetdataserializer.writeDouble(this.c); -+ packetdataserializer.writeFloat(this.d); -+ packetdataserializer.writeFloat(this.e); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { -+ -+ public PacketPlayOutRelEntityMove() {} -+ -+ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2) { -+ super(i); -+ this.b = b0; -+ this.c = b1; -+ this.d = b2; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeByte(this.d); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", xa=%d, ya=%d, za=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { -+ -+ public PacketPlayOutRelEntityMoveLook() { -+ this.g = true; -+ } -+ -+ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4) { -+ super(i); -+ this.b = b0; -+ this.c = b1; -+ this.d = b2; -+ this.e = b3; -+ this.f = b4; -+ this.g = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readByte(); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", xa=%d, ya=%d, za=%d, yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d), Byte.valueOf(this.e), Byte.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRemoveEntityEffect extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayOutRemoveEntityEffect() {} -+ -+ public PacketPlayOutRemoveEntityEffect(int i, MobEffect mobeffect) { -+ this.a = i; -+ this.b = mobeffect.getEffectId(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutScoreboardObjective extends Packet { -+ -+ private String a; -+ private String b; -+ private int c; -+ -+ public PacketPlayOutScoreboardObjective() {} -+ -+ public PacketPlayOutScoreboardObjective(ScoreboardObjective scoreboardobjective, int i) { -+ this.a = scoreboardobjective.getName(); -+ this.b = scoreboardobjective.getDisplayName(); -+ this.c = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.b = packetdataserializer.c(32); -+ this.c = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.a(this.b); -+ packetdataserializer.writeByte(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutScoreboardScore extends Packet { -+ -+ private String a = ""; -+ private String b = ""; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutScoreboardScore() {} -+ -+ public PacketPlayOutScoreboardScore(ScoreboardScore scoreboardscore, int i) { -+ this.a = scoreboardscore.getPlayerName(); -+ this.b = scoreboardscore.getObjective().getName(); -+ this.c = scoreboardscore.getScore(); -+ this.d = i; -+ } -+ -+ public PacketPlayOutScoreboardScore(String s) { -+ this.a = s; -+ this.b = ""; -+ this.c = 0; -+ this.d = 1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.d = packetdataserializer.readByte(); -+ if (this.d != 1) { -+ this.b = packetdataserializer.c(16); -+ this.c = packetdataserializer.readInt(); -+ } -+ } -+ -+ 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); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.Iterator; -+ -+public class PacketPlayOutScoreboardTeam extends Packet { -+ -+ private String a = ""; -+ private String b = ""; -+ private String c = ""; -+ private String d = ""; -+ private Collection e = new ArrayList(); -+ private int f; -+ private int g; -+ -+ public PacketPlayOutScoreboardTeam() {} -+ -+ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, int i) { -+ this.a = scoreboardteam.getName(); -+ this.f = i; -+ if (i == 0 || i == 2) { -+ this.b = scoreboardteam.getDisplayName(); -+ this.c = scoreboardteam.getPrefix(); -+ this.d = scoreboardteam.getSuffix(); -+ this.g = scoreboardteam.packOptionData(); -+ } -+ -+ if (i == 0) { -+ this.e.addAll(scoreboardteam.getPlayerNameSet()); -+ } -+ } -+ -+ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, Collection collection, int i) { -+ if (i != 3 && i != 4) { -+ throw new IllegalArgumentException("Method must be join or leave for player constructor"); -+ } else if (collection != null && !collection.isEmpty()) { -+ this.f = i; -+ this.a = scoreboardteam.getName(); -+ this.e.addAll(collection); -+ } else { -+ throw new IllegalArgumentException("Players cannot be null/empty"); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.f = packetdataserializer.readByte(); -+ if (this.f == 0 || this.f == 2) { -+ this.b = packetdataserializer.c(32); -+ this.c = packetdataserializer.c(16); -+ this.d = packetdataserializer.c(16); -+ this.g = packetdataserializer.readByte(); -+ } -+ -+ if (this.f == 0 || this.f == 3 || this.f == 4) { -+ short short1 = packetdataserializer.readShort(); -+ -+ for (int i = 0; i < short1; ++i) { -+ this.e.add(packetdataserializer.c(40)); -+ } -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.f); -+ if (this.f == 0 || this.f == 2) { -+ packetdataserializer.a(this.b); -+ packetdataserializer.a(this.c); -+ packetdataserializer.a(this.d); -+ packetdataserializer.writeByte(this.g); -+ } -+ -+ if (this.f == 0 || this.f == 3 || this.f == 4) { -+ packetdataserializer.writeShort(this.e.size()); -+ Iterator iterator = this.e.iterator(); -+ -+ while (iterator.hasNext()) { -+ String s = (String) iterator.next(); -+ -+ packetdataserializer.a(s); -+ } -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutSetSlot extends Packet { -+ -+ private int a; -+ private int b; -+ private ItemStack c; -+ -+ public PacketPlayOutSetSlot() {} -+ -+ public PacketPlayOutSetSlot(int i, int j, ItemStack itemstack) { -+ this.a = i; -+ this.b = j; -+ this.c = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readByte(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.a(this.c); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutSpawnEntity extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private int f; -+ private int g; -+ private int h; -+ private int i; -+ private int j; -+ private int k; -+ -+ public PacketPlayOutSpawnEntity() {} -+ -+ public PacketPlayOutSpawnEntity(Entity entity, int i) { -+ this(entity, i, 0); -+ } -+ -+ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) { -+ this.a = entity.getId(); -+ this.b = MathHelper.floor(entity.locX * 32.0D); -+ this.c = MathHelper.floor(entity.locY * 32.0D); -+ this.d = MathHelper.floor(entity.locZ * 32.0D); -+ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); -+ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); -+ this.j = i; -+ this.k = j; -+ if (j > 0) { -+ double d0 = entity.motX; -+ double d1 = entity.motY; -+ double d2 = entity.motZ; -+ double d3 = 3.9D; -+ -+ if (d0 < -d3) { -+ d0 = -d3; -+ } -+ -+ if (d1 < -d3) { -+ d1 = -d3; -+ } -+ -+ if (d2 < -d3) { -+ d2 = -d3; -+ } -+ -+ if (d0 > d3) { -+ d0 = d3; -+ } -+ -+ if (d1 > d3) { -+ d1 = d3; -+ } -+ -+ if (d2 > d3) { -+ d2 = d3; -+ } -+ -+ this.e = (int) (d0 * 8000.0D); -+ this.f = (int) (d1 * 8000.0D); -+ this.g = (int) (d2 * 8000.0D); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.j = packetdataserializer.readByte(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.h = packetdataserializer.readByte(); -+ this.i = packetdataserializer.readByte(); -+ this.k = packetdataserializer.readInt(); -+ if (this.k > 0) { -+ this.e = packetdataserializer.readShort(); -+ this.f = packetdataserializer.readShort(); -+ this.g = packetdataserializer.readShort(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeByte(this.j); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.h); -+ packetdataserializer.writeByte(this.i); -+ packetdataserializer.writeInt(this.k); -+ if (this.k > 0) { -+ packetdataserializer.writeShort(this.e); -+ packetdataserializer.writeShort(this.f); -+ packetdataserializer.writeShort(this.g); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.j), Float.valueOf((float) this.b / 32.0F), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F)}); -+ } -+ -+ public void a(int i) { -+ this.b = i; -+ } -+ -+ public void b(int i) { -+ this.c = i; -+ } -+ -+ public void c(int i) { -+ this.d = i; -+ } -+ -+ public void d(int i) { -+ this.e = i; -+ } -+ -+ public void e(int i) { -+ this.f = i; -+ } -+ -+ public void f(int i) { -+ this.g = i; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutSpawnEntityLiving extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private int f; -+ private int g; -+ private int h; -+ private byte i; -+ private byte j; -+ private byte k; -+ private DataWatcher l; -+ private List m; -+ -+ public PacketPlayOutSpawnEntityLiving() {} -+ -+ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) { -+ this.a = entityliving.getId(); -+ this.b = (byte) EntityTypes.a(entityliving); -+ this.c = entityliving.as.a(entityliving.locX); -+ this.d = MathHelper.floor(entityliving.locY * 32.0D); -+ this.e = entityliving.as.a(entityliving.locZ); -+ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); -+ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); -+ this.k = (byte) ((int) (entityliving.aO * 256.0F / 360.0F)); -+ double d0 = 3.9D; -+ double d1 = entityliving.motX; -+ double d2 = entityliving.motY; -+ double d3 = entityliving.motZ; -+ -+ if (d1 < -d0) { -+ d1 = -d0; -+ } -+ -+ if (d2 < -d0) { -+ d2 = -d0; -+ } -+ -+ if (d3 < -d0) { -+ d3 = -d0; -+ } -+ -+ if (d1 > d0) { -+ d1 = d0; -+ } -+ -+ if (d2 > d0) { -+ d2 = d0; -+ } -+ -+ if (d3 > d0) { -+ d3 = d0; -+ } -+ -+ this.f = (int) (d1 * 8000.0D); -+ this.g = (int) (d2 * 8000.0D); -+ this.h = (int) (d3 * 8000.0D); -+ this.l = entityliving.getDataWatcher(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = packetdataserializer.readByte() & 255; -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readInt(); -+ this.i = packetdataserializer.readByte(); -+ this.j = packetdataserializer.readByte(); -+ this.k = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readShort(); -+ this.g = packetdataserializer.readShort(); -+ this.h = packetdataserializer.readShort(); -+ this.m = DataWatcher.b(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeByte(this.b & 255); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeInt(this.e); -+ packetdataserializer.writeByte(this.i); -+ packetdataserializer.writeByte(this.j); -+ packetdataserializer.writeByte(this.k); -+ packetdataserializer.writeShort(this.f); -+ packetdataserializer.writeShort(this.g); -+ packetdataserializer.writeShort(this.h); -+ this.l.a(packetdataserializer); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F), Float.valueOf((float) this.e / 32.0F), Float.valueOf((float) this.f / 8000.0F), Float.valueOf((float) this.g / 8000.0F), Float.valueOf((float) this.h / 8000.0F)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutSpawnEntityPainting extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private String f; -+ -+ public PacketPlayOutSpawnEntityPainting() {} -+ -+ public PacketPlayOutSpawnEntityPainting(EntityPainting entitypainting) { -+ this.a = entitypainting.getId(); -+ this.b = entitypainting.x; -+ this.c = entitypainting.y; -+ this.d = entitypainting.z; -+ this.e = entitypainting.direction; -+ this.f = entitypainting.art.B; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.a(); -+ this.f = packetdataserializer.c(EnumArt.A); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readInt(); -+ } -+ -+ 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); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%s, x=%d, y=%d, z=%d", new Object[] { Integer.valueOf(this.a), this.f, Integer.valueOf(this.b), Integer.valueOf(this.c), Integer.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutTileEntityData extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private NBTTagCompound e; -+ -+ public PacketPlayOutTileEntityData() {} -+ -+ public PacketPlayOutTileEntityData(int i, int j, int k, int l, NBTTagCompound nbttagcompound) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = nbttagcompound; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.b(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte((byte) this.d); -+ packetdataserializer.a(this.e); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.Iterator; -+import java.util.List; -+import java.util.UUID; -+ -+public class PacketPlayOutUpdateAttributes extends Packet { -+ -+ private int a; -+ private final List b = new ArrayList(); -+ -+ public PacketPlayOutUpdateAttributes() {} -+ -+ public PacketPlayOutUpdateAttributes(int i, Collection collection) { -+ this.a = i; -+ Iterator iterator = collection.iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeInstance attributeinstance = (AttributeInstance) iterator.next(); -+ -+ this.b.add(new AttributeSnapshot(this, attributeinstance.getAttribute().getName(), attributeinstance.b(), attributeinstance.c())); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ int i = packetdataserializer.readInt(); -+ -+ for (int j = 0; j < i; ++j) { -+ String s = packetdataserializer.c(64); -+ double d0 = packetdataserializer.readDouble(); -+ ArrayList arraylist = new ArrayList(); -+ short short1 = packetdataserializer.readShort(); -+ -+ for (int k = 0; k < short1; ++k) { -+ UUID uuid = new UUID(packetdataserializer.readLong(), packetdataserializer.readLong()); -+ -+ arraylist.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", packetdataserializer.readDouble(), packetdataserializer.readByte())); -+ } -+ -+ this.b.add(new AttributeSnapshot(this, s, d0, arraylist)); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b.size()); -+ Iterator iterator = this.b.iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeSnapshot attributesnapshot = (AttributeSnapshot) iterator.next(); -+ -+ packetdataserializer.a(attributesnapshot.a()); -+ packetdataserializer.writeDouble(attributesnapshot.b()); -+ packetdataserializer.writeShort(attributesnapshot.c().size()); -+ Iterator iterator1 = attributesnapshot.c().iterator(); -+ -+ while (iterator1.hasNext()) { -+ AttributeModifier attributemodifier = (AttributeModifier) iterator1.next(); -+ -+ packetdataserializer.writeLong(attributemodifier.a().getMostSignificantBits()); -+ packetdataserializer.writeLong(attributemodifier.a().getLeastSignificantBits()); -+ packetdataserializer.writeDouble(attributemodifier.d()); -+ packetdataserializer.writeByte(attributemodifier.c()); -+ } -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutUpdateHealth extends Packet { -+ -+ private float a; -+ private int b; -+ private float c; -+ -+ public PacketPlayOutUpdateHealth() {} -+ -+ public PacketPlayOutUpdateHealth(float f, int i, float f1) { -+ this.a = f; -+ this.b = i; -+ this.c = f1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readFloat(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeFloat(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutUpdateSign extends Packet { -+ -+ private int x; -+ private int y; -+ private int z; -+ private String[] lines; -+ -+ public PacketPlayOutUpdateSign() {} -+ -+ public PacketPlayOutUpdateSign(int i, int j, int k, String[] astring) { -+ this.x = i; -+ this.y = j; -+ this.z = k; -+ this.lines = new String[] { astring[0], astring[1], astring[2], astring[3]}; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.x = packetdataserializer.readInt(); -+ this.y = packetdataserializer.readShort(); -+ this.z = packetdataserializer.readInt(); -+ this.lines = new String[4]; -+ -+ for (int i = 0; i < 4; ++i) { -+ this.lines[i] = packetdataserializer.c(15); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.x); -+ packetdataserializer.writeShort(this.y); -+ packetdataserializer.writeInt(this.z); -+ -+ for (int i = 0; i < 4; ++i) { -+ packetdataserializer.a(this.lines[i]); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutWindowItems extends Packet { -+ -+ private int a; -+ private ItemStack[] b; -+ -+ public PacketPlayOutWindowItems() {} -+ -+ public PacketPlayOutWindowItems(int i, List list) { -+ this.a = i; -+ this.b = new ItemStack[list.size()]; -+ -+ for (int j = 0; j < this.b.length; ++j) { -+ ItemStack itemstack = (ItemStack) list.get(j); -+ -+ this.b[j] = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readUnsignedByte(); -+ short short1 = packetdataserializer.readShort(); -+ -+ this.b = new ItemStack[short1]; -+ -+ for (int i = 0; i < short1; ++i) { -+ this.b[i] = packetdataserializer.c(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.b.length); -+ ItemStack[] aitemstack = this.b; -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack[j]; -+ -+ packetdataserializer.a(itemstack); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutWorldEvent extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private boolean f; -+ -+ public PacketPlayOutWorldEvent() {} -+ -+ public PacketPlayOutWorldEvent(int i, int j, int k, int l, int i1, boolean flag) { -+ this.a = i; -+ this.c = j; -+ this.d = k; -+ this.e = l; -+ this.b = i1; -+ this.f = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readByte() & 255; -+ this.e = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d & 255); -+ packetdataserializer.writeInt(this.e); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutWorldParticles extends Packet { -+ -+ private String a; -+ private float b; -+ private float c; -+ private float d; -+ private float e; -+ private float f; -+ private float g; -+ private float h; -+ private int i; -+ -+ public PacketPlayOutWorldParticles() {} -+ -+ public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i) { -+ this.a = s; -+ this.b = f; -+ this.c = f1; -+ this.d = f2; -+ this.e = f3; -+ this.f = f4; -+ this.g = f5; -+ this.h = f6; -+ this.i = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(64); -+ this.b = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readFloat(); -+ this.d = packetdataserializer.readFloat(); -+ this.e = packetdataserializer.readFloat(); -+ this.f = packetdataserializer.readFloat(); -+ this.g = packetdataserializer.readFloat(); -+ this.h = packetdataserializer.readFloat(); -+ this.i = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeFloat(this.b); -+ packetdataserializer.writeFloat(this.c); -+ packetdataserializer.writeFloat(this.d); -+ packetdataserializer.writeFloat(this.e); -+ packetdataserializer.writeFloat(this.f); -+ packetdataserializer.writeFloat(this.g); -+ packetdataserializer.writeFloat(this.h); -+ packetdataserializer.writeInt(this.i); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0180-Snapshot-protocol.patch b/CraftBukkit-Patches/0180-Snapshot-protocol.patch deleted file mode 100644 index 561d105dc5..0000000000 --- a/CraftBukkit-Patches/0180-Snapshot-protocol.patch +++ /dev/null @@ -1,4466 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 1 Sep 2014 16:47:48 +1000 -Subject: [PATCH] Snapshot protocol - - -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - ${api.version} - Bukkit Team - true -+ ${maven.build.timestamp} - - - -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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(); - -@@ -0,0 +0,0 @@ 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 - } - } - -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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: -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityAgeable.java -+++ b/src/main/java/net/minecraft/server/EntityAgeable.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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)); - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItemFrame.java -+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -0,0 +0,0 @@ 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)); - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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()) { -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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); -@@ -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 { - 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() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 - } - } - -@@ -0,0 +0,0 @@ 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; - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipeList.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private boolean r; - // Spigot Start - public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); -- public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5); -+ public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 47); - public static final int CURRENT_VERSION = 5; - public static int getVersion(Channel attr) - { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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); - } - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDecoder.java -+++ b/src/main/java/net/minecraft/server/PacketDecoder.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBed.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet { - private int d; - private byte e; - private byte f; -+ private boolean onGround; // Spigot - protocol patch - - public PacketPlayOutEntityTeleport() {} - -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMap.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -@@ -0,0 +0,0 @@ - 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; - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; -+ } - } - } - -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ 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]; -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; - } - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import org.bukkit.craftbukkit.util.CraftChatMessage; -+ - import java.io.IOException; - - public class PacketPlayOutOpenWindow extends Packet { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -@@ -0,0 +0,0 @@ - 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -@@ -0,0 +0,0 @@ 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(); - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - - import java.io.IOException; -+import java.util.HashMap; // Spigot - - public class PacketPlayOutWorldParticles extends Packet { - -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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 particleMap = new HashMap(); -+ -+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 - } - } - -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ 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); - -@@ -0,0 +0,0 @@ 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 - } - } -@@ -0,0 +0,0 @@ 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); - -@@ -0,0 +0,0 @@ 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) 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ - 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; -@@ -0,0 +0,0 @@ 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 ) -@@ -0,0 +0,0 @@ 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 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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); - } - } -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -0,0 +0,0 @@ public class AntiXray - if ( world.spigotConfig.antiXray ) - { - obfuscate.startTiming(); -- obfuscate( chunkX, chunkY, bitmask, buffer, world ); -+ obfuscate( chunkX, chunkY, bitmask, buffer, world, false ); - obfuscate.stopTiming(); - } - } -@@ -0,0 +0,0 @@ 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 ) -@@ -0,0 +0,0 @@ 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] ) - { -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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. -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/ProtocolData.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/ProtocolInjector.java -@@ -0,0 +0,0 @@ -+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 packet) throws NoSuchFieldException, IllegalAccessException -+ { -+ Field packets; -+ if (!clientbound) { -+ packets = EnumProtocol.class.getDeclaredField( "h" ); -+ } else { -+ packets = EnumProtocol.class.getDeclaredField( "i" ); -+ } -+ packets.setAccessible( true ); -+ BiMap> pMap = (BiMap>) packets.get( protocol ); -+ pMap.put( id, packet ); -+ Field map = EnumProtocol.class.getDeclaredField( "f" ); -+ map.setAccessible( true ); -+ Map, EnumProtocol> protocolMap = (Map, 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotComponentReverter.java -@@ -0,0 +0,0 @@ -+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 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotCompressor.java -@@ -0,0 +0,0 @@ -+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 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 -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotDecompressor.java -@@ -0,0 +0,0 @@ -+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 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /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"] --- \ No newline at end of file diff --git a/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch b/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch deleted file mode 100644 index da8e1760a9..0000000000 --- a/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 11 Sep 2014 01:07:52 -0700 -Subject: [PATCH] Spigot Update - 20140909a - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - + "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 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() { --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch b/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch deleted file mode 100644 index 1fc779c104..0000000000 --- a/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 17:16:43 -0700 -Subject: [PATCH] Spigot Update - 20140909b - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import net.md_5.bungee.api.chat.BaseComponent; -+import net.md_5.bungee.chat.ComponentSerializer; -+ - import java.io.IOException; - - public class PacketPlayOutChat extends Packet { - - private IChatBaseComponent a; -+ public BaseComponent[] components; // Spigot - Update 20140909b - private boolean b; - - public PacketPlayOutChat() { -@@ -0,0 +0,0 @@ public class PacketPlayOutChat extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(ChatSerializer.a(this.a)); -+ // Spigot start - Update 20140909b -+ if (components != null) -+ { -+ packetdataserializer.a( ComponentSerializer.toString(components) ); -+ } -+ else { -+ packetdataserializer.a( ChatSerializer.a(a) ); -+ } -+ // Spigot end -+ - // Spigot start - protocol patch - if ( packetdataserializer.version >= 16 ) - { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ import java.util.regex.Pattern; - - import javax.imageio.ImageIO; - -+import net.md_5.bungee.api.chat.BaseComponent; - import net.minecraft.server.ChunkCoordinates; - import net.minecraft.server.CommandAchievement; - import net.minecraft.server.CommandBan; -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - { - return org.spigotmc.SpigotConfig.config; - } -+ -+ @Override -+ public void broadcast( BaseComponent component ) -+ { -+ for ( Player player : getOnlinePlayers() ) -+ { -+ player.spigot().sendMessage( component ); -+ } -+ } -+ -+ @Override -+ public void broadcast( BaseComponent... components ) -+ { -+ for ( Player player : getOnlinePlayers() ) -+ { -+ player.spigot().sendMessage( components ); -+ } -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - public static boolean useConsole = true; - - 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 ) -- { -- System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -- System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -- System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -- System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -- System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -- System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -- System.err.println( "=================================================================================" ); -- System.err.println( "Starting server in 10 seconds" ); -- lock.createNewFile(); -- try -- { -- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -- } catch ( InterruptedException ex ) -- { -- } -- } -- -- 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" ); -- -- // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { - { -@@ -0,0 +0,0 @@ public class Main { - } else if (options.has("v")) { - System.out.println(CraftServer.class.getPackage().getImplementationVersion()); - } else { -+ // Spigot start - Update 20140909b -+ File lock = new File( ".update-lock" ); -+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -+ { -+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -+ System.err.println( "=================================================================================" ); -+ System.err.println( "Starting server in 10 seconds" ); -+ lock.createNewFile(); -+ try -+ { -+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ } -+ -+ 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" ); -+ -+ // Spigot end -+ - try { - // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals - String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'}); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ import java.util.UUID; - import java.util.logging.Level; - import java.util.logging.Logger; - -+import net.md_5.bungee.api.chat.BaseComponent; - import net.minecraft.server.*; - - import net.minecraft.util.com.mojang.authlib.GameProfile; -@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - return java.util.Collections.unmodifiableSet( ret ); - } -+ -+ @Override -+ public void sendMessage( BaseComponent component ) -+ { -+ sendMessage( new BaseComponent[] { component } ); -+ } -+ -+ @Override -+ public void sendMessage( BaseComponent... components ) -+ { -+ if ( getHandle().playerConnection == null ) return; -+ -+ PacketPlayOutChat packet = new PacketPlayOutChat(); -+ packet.components = components; -+ getHandle().playerConnection.sendPacket( packet ); -+ } - }; - - public Player.Spigot spigot() --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch b/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch deleted file mode 100644 index fd36e32fd9..0000000000 --- a/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 21 Sep 2014 12:57:40 -0700 -Subject: [PATCH] Spigot Update - 20140916a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ 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, tracker.onGround); // Spigot - protocol patch -+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround, tracker instanceof EntityFallingBlock || tracker instanceof EntityTNTPrimed); // Spigot - protocol patch // Spigot Update - 20140916a - } - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet { - private byte e; - private byte f; - private boolean onGround; // Spigot - protocol patch -+ private boolean heightCorrection; // Spigot Update - 20140916a - - public PacketPlayOutEntityTeleport() {} - -@@ -0,0 +0,0 @@ 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, boolean onGround) { // Spigot - protocol patch -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround, boolean heightCorrection) { // Spigot - protocol patch // Spigot Update - 20140916a - this.a = i; - this.b = j; - this.c = k; -@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.e = b0; - this.f = b1; - this.onGround = onGround; // Spigot - protocol patch -+ this.heightCorrection = heightCorrection; // Spigot Update - 20140916a - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet { - } - // Spigot end - packetdataserializer.writeInt(this.b); -- packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt((packetdataserializer.version >= 16 && heightCorrection) ? (this.c - 16) : this.c); // Spigot Update - 20140916a - packetdataserializer.writeInt(this.d); - packetdataserializer.writeByte(this.e); - packetdataserializer.writeByte(this.f); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -0,0 +0,0 @@ public class PacketPlayOutSpawnEntity extends Packet { - int data = k >> 16; - k = id | ( data << 12 ); - } -+ -+ if ( ( j == 50 || j == 70 || j == 74 ) && packetdataserializer.version >= 16 ) // Spigot Update - 20140916a -+ { -+ c -= 16; -+ } -+ - // Spigot end - packetdataserializer.writeInt(this.b); - packetdataserializer.writeInt(this.c); --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch b/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch deleted file mode 100644 index a665403c79..0000000000 --- a/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch +++ /dev/null @@ -1,973 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 21 Sep 2014 18:11:43 -0700 -Subject: [PATCH] Spigot Update - 20140921a - - -diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+import java.util.HashMap; -+import java.util.Iterator; -+import java.util.LinkedHashMap; -+import java.util.List; -+import java.util.Map; -+import java.util.Random; -+ -+public class EnchantmentManager { -+ -+ private static final Random random = new Random(); -+ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null); -+ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null); -+ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null); -+ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null); -+ -+ public static int getEnchantmentLevel(int i, ItemStack itemstack) { -+ if (itemstack == null) { -+ return 0; -+ } else { -+ NBTTagList nbttaglist = itemstack.getEnchantments(); -+ -+ if (nbttaglist == null) { -+ return 0; -+ } else { -+ for (int j = 0; j < nbttaglist.size(); ++j) { -+ short short1 = nbttaglist.get(j).getShort("id"); -+ short short2 = nbttaglist.get(j).getShort("lvl"); -+ -+ if (short1 == i) { -+ return short2; -+ } -+ } -+ -+ return 0; -+ } -+ } -+ } -+ -+ public static Map a(ItemStack itemstack) { -+ LinkedHashMap linkedhashmap = new LinkedHashMap(); -+ NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.g(itemstack) : itemstack.getEnchantments(); -+ -+ if (nbttaglist != null) { -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ short short1 = nbttaglist.get(i).getShort("id"); -+ short short2 = nbttaglist.get(i).getShort("lvl"); -+ -+ linkedhashmap.put(Integer.valueOf(short1), Integer.valueOf(short2)); -+ } -+ } -+ -+ return linkedhashmap; -+ } -+ -+ public static void a(Map map, ItemStack itemstack) { -+ NBTTagList nbttaglist = new NBTTagList(); -+ Iterator iterator = map.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ int i = ((Integer) iterator.next()).intValue(); -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ nbttagcompound.setShort("id", (short) i); -+ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue()); -+ nbttaglist.add(nbttagcompound); -+ if (itemstack.getItem() == Items.ENCHANTED_BOOK) { -+ Items.ENCHANTED_BOOK.a(itemstack, new EnchantmentInstance(i, ((Integer) map.get(Integer.valueOf(i))).intValue())); -+ } -+ } -+ -+ if (nbttaglist.size() > 0) { -+ if (itemstack.getItem() != Items.ENCHANTED_BOOK) { -+ itemstack.a("ench", (NBTBase) nbttaglist); -+ } -+ } else if (itemstack.hasTag()) { -+ itemstack.getTag().remove("ench"); -+ } -+ } -+ -+ public static int getEnchantmentLevel(int i, ItemStack[] aitemstack) { -+ if (aitemstack == null) { -+ return 0; -+ } else { -+ int j = 0; -+ ItemStack[] aitemstack1 = aitemstack; -+ int k = aitemstack.length; -+ -+ for (int l = 0; l < k; ++l) { -+ ItemStack itemstack = aitemstack1[l]; -+ int i1 = getEnchantmentLevel(i, itemstack); -+ -+ if (i1 > j) { -+ j = i1; -+ } -+ } -+ -+ return j; -+ } -+ } -+ -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { -+ if (itemstack != null) { -+ NBTTagList nbttaglist = itemstack.getEnchantments(); -+ -+ if (nbttaglist != null) { -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ short short1 = nbttaglist.get(i).getShort("id"); -+ short short2 = nbttaglist.get(i).getShort("lvl"); -+ -+ if (Enchantment.byId[short1] != null) { -+ enchantmentmodifier.a(Enchantment.byId[short1], short2); -+ } -+ } -+ } -+ } -+ } -+ -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) { -+ ItemStack[] aitemstack1 = aitemstack; -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack1[j]; -+ -+ a(enchantmentmodifier, itemstack); -+ } -+ } -+ -+ public static int a(ItemStack[] aitemstack, DamageSource damagesource) { -+ b.a = 0; -+ b.b = damagesource; -+ a((EnchantmentModifier) b, aitemstack); -+ if (b.a > 25) { -+ b.a = 25; -+ } -+ -+ return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1); -+ } -+ -+ public static float a(EntityLiving entityliving, EntityLiving entityliving1) { -+ return a(entityliving.be(), entityliving1.getMonsterType()); -+ } -+ -+ public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { -+ c.a = 0.0F; -+ c.b = enummonstertype; -+ a((EnchantmentModifier) c, itemstack); -+ return c.a; -+ } -+ -+ public static void a(EntityLiving entityliving, Entity entity) { -+ d.b = entity; -+ d.a = entityliving; -+ a((EnchantmentModifier) d, entityliving.getEquipment()); -+ if (entity instanceof EntityHuman) { -+ a((EnchantmentModifier) d, entityliving.be()); -+ } -+ d.b = null; -+ d.a = null; -+ } -+ -+ public static void b(EntityLiving entityliving, Entity entity) { -+ e.a = entityliving; -+ e.b = entity; -+ a((EnchantmentModifier) e, entityliving.getEquipment()); -+ if (entityliving instanceof EntityHuman) { -+ a((EnchantmentModifier) e, entityliving.be()); -+ } -+ e.a = null; -+ e.b = null; -+ } -+ -+ public static int getKnockbackEnchantmentLevel(EntityLiving entityliving, EntityLiving entityliving1) { -+ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.be()); -+ } -+ -+ public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.be()); -+ } -+ -+ public static int getOxygenEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.OXYGEN.id, entityliving.getEquipment()); -+ } -+ -+ public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.be()); -+ } -+ -+ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.be()) > 0; -+ } -+ -+ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.be()); -+ } -+ -+ public static int getLuckEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.be()); -+ } -+ -+ public static int getLureEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.be()); -+ } -+ -+ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.be()); -+ } -+ -+ public static boolean hasWaterWorkerEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0; -+ } -+ -+ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) { -+ ItemStack[] aitemstack = entityliving.getEquipment(); -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack[j]; -+ -+ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) { -+ return itemstack; -+ } -+ } -+ -+ return null; -+ } -+ -+ public static int a(Random random, int i, int j, ItemStack itemstack) { -+ Item item = itemstack.getItem(); -+ int k = item.c(); -+ -+ if (k <= 0) { -+ return 0; -+ } else { -+ if (j > 15) { -+ j = 15; -+ } -+ -+ int l = random.nextInt(8) + 1 + (j >> 1) + random.nextInt(j + 1); -+ -+ return i == 0 ? Math.max(l / 3, 1) : (i == 1 ? l * 2 / 3 + 1 : Math.max(l, j * 2)); -+ } -+ } -+ -+ public static ItemStack a(Random random, ItemStack itemstack, int i) { -+ List list = b(random, itemstack, i); -+ boolean flag = itemstack.getItem() == Items.BOOK; -+ -+ if (flag) { -+ itemstack.setItem(Items.ENCHANTED_BOOK); -+ } -+ -+ if (list != null) { -+ Iterator iterator = list.iterator(); -+ -+ while (iterator.hasNext()) { -+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) iterator.next(); -+ -+ if (flag) { -+ Items.ENCHANTED_BOOK.a(itemstack, enchantmentinstance); -+ } else { -+ itemstack.addEnchantment(enchantmentinstance.enchantment, enchantmentinstance.level); -+ } -+ } -+ } -+ -+ return itemstack; -+ } -+ -+ public static List b(Random random, ItemStack itemstack, int i) { -+ Item item = itemstack.getItem(); -+ int j = item.c(); -+ -+ if (j <= 0) { -+ return null; -+ } else { -+ j /= 2; -+ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1); -+ int k = j + i; -+ float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; -+ int l = (int) ((float) k * (1.0F + f) + 0.5F); -+ -+ if (l < 1) { -+ l = 1; -+ } -+ -+ ArrayList arraylist = null; -+ Map map = b(l, itemstack); -+ -+ if (map != null && !map.isEmpty()) { -+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) WeightedRandom.a(random, map.values()); -+ -+ if (enchantmentinstance != null) { -+ arraylist = new ArrayList(); -+ arraylist.add(enchantmentinstance); -+ -+ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) { -+ Iterator iterator = map.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Integer integer = (Integer) iterator.next(); -+ boolean flag = true; -+ Iterator iterator1 = arraylist.iterator(); -+ -+ while (true) { -+ if (iterator1.hasNext()) { -+ EnchantmentInstance enchantmentinstance1 = (EnchantmentInstance) iterator1.next(); -+ -+ if (enchantmentinstance1.enchantment.a(Enchantment.byId[integer.intValue()])) { -+ continue; -+ } -+ -+ flag = false; -+ } -+ -+ if (!flag) { -+ iterator.remove(); -+ } -+ break; -+ } -+ } -+ -+ if (!map.isEmpty()) { -+ EnchantmentInstance enchantmentinstance2 = (EnchantmentInstance) WeightedRandom.a(random, map.values()); -+ -+ arraylist.add(enchantmentinstance2); -+ } -+ } -+ } -+ } -+ -+ return arraylist; -+ } -+ } -+ -+ public static Map b(int i, ItemStack itemstack) { -+ Item item = itemstack.getItem(); -+ HashMap hashmap = null; -+ boolean flag = itemstack.getItem() == Items.BOOK; -+ Enchantment[] aenchantment = Enchantment.byId; -+ int j = aenchantment.length; -+ -+ for (int k = 0; k < j; ++k) { -+ Enchantment enchantment = aenchantment[k]; -+ -+ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) { -+ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { -+ if (i >= enchantment.a(l) && i <= enchantment.b(l)) { -+ if (hashmap == null) { -+ hashmap = new HashMap(); -+ } -+ -+ hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l)); -+ } -+ } -+ } -+ } -+ -+ return hashmap; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierArthropods implements EnchantmentModifier { -+ -+ public EntityLiving a; -+ public Entity b; -+ -+ private EnchantmentModifierArthropods() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ enchantment.a(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierArthropods(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierDamage implements EnchantmentModifier { -+ -+ public float a; -+ public EnumMonsterType b; -+ -+ private EnchantmentModifierDamage() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierDamage(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierProtection implements EnchantmentModifier { -+ -+ public int a; -+ public DamageSource b; -+ -+ private EnchantmentModifierProtection() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierProtection(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierThorns implements EnchantmentModifier { -+ -+ public EntityLiving a; -+ public Entity b; -+ -+ private EnchantmentModifierThorns() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ enchantment.b(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierThorns(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentThorns.java b/src/main/java/net/minecraft/server/EnchantmentThorns.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentThorns.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class EnchantmentThorns extends Enchantment { -+ -+ public EnchantmentThorns(int i, int j) { -+ super(i, j, EnchantmentSlotType.ARMOR_TORSO); -+ this.b("thorns"); -+ } -+ -+ public int a(int n) { -+ return 10 + 20 * (n - 1); -+ } -+ -+ public int b(int i) { -+ return super.a(i) + 50; -+ } -+ -+ public int getMaxLevel() { -+ return 3; -+ } -+ -+ public boolean canEnchant(ItemStack itemstack) { -+ return itemstack.getItem() instanceof ItemArmor ? true : super.canEnchant(itemstack); -+ } -+ -+ public void b(EntityLiving entityliving, Entity entity, int n) { -+ Random ai = entityliving.aI(); -+ ItemStack a = EnchantmentManager.a(Enchantment.THORNS, entityliving); -+ -+ if (a(n, ai)) { -+ entity.damageEntity(DamageSource.a(entityliving), b(n, ai)); -+ entity.makeSound("damage.thorns", 0.5F, 1.0F); -+ if (a != null) { -+ a.damage(3, entityliving); -+ } -+ } else if (a != null) { -+ a.damage(1, entityliving); -+ } -+ } -+ -+ public static boolean a(int n, Random random) { -+ return n > 0 && random.nextFloat() < 0.15f * n; -+ } -+ -+ public static int b(int n, Random random) { -+ if (n > 10) { -+ return n - 10; -+ } -+ -+ return 1 + random.nextInt(4); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import java.lang.ref.WeakReference; - import java.util.Iterator; - import java.util.List; - import java.util.UUID; -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - private Navigation navigation; - protected final PathfinderGoalSelector goalSelector; - protected final PathfinderGoalSelector targetSelector; -- private EntityLiving goalTarget; -+ private WeakReference goalTarget = new WeakReference(null); // Spigot Update - 20140921a - private EntitySenses bq; - private ItemStack[] equipment = new ItemStack[5]; - public float[] dropChances = new float[5]; // CraftBukkit - protected -> public -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public EntityLiving getGoalTarget() { -- return this.goalTarget; -+ return this.goalTarget.get(); - } - - public void setGoalTarget(EntityLiving entityliving) { -- this.goalTarget = entityliving; -+ this.goalTarget = new WeakReference(entityliving); - } - - public boolean a(Class oclass) { -diff --git a/src/main/java/net/minecraft/server/ItemEnchantedBook.java b/src/main/java/net/minecraft/server/ItemEnchantedBook.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemEnchantedBook.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class ItemEnchantedBook extends Item { -+ -+ public ItemEnchantedBook() {} -+ -+ public boolean e_(ItemStack itemStack) { -+ return false; -+ } -+ -+ public EnumItemRarity f(ItemStack itemstack) { -+ if (this.g(itemstack).size() > 0) { -+ return EnumItemRarity.UNCOMMON; -+ } -+ return super.f(itemstack); -+ } -+ -+ public NBTTagList g(ItemStack itemStack) { -+ if (itemStack.tag == null || !itemStack.tag.hasKeyOfType("StoredEnchantments", 9)) { -+ return new NBTTagList(); -+ } -+ return (NBTTagList)itemStack.tag.get("StoredEnchantments"); -+ } -+ -+ public void a(ItemStack itemStack, EnchantmentInstance enchantmentInstance) { -+ NBTTagList g = this.g(itemStack); -+ boolean b = true; -+ for (int i = 0; i < g.size(); ++i) { -+ NBTTagCompound value = g.get(i); -+ if (value.getShort("id") == enchantmentInstance.enchantment.id) { -+ if (value.getShort("lvl") < enchantmentInstance.level) { -+ value.setShort("lvl", (short)enchantmentInstance.level); -+ } -+ -+ b = false; -+ break; -+ } -+ } -+ -+ if (b) { -+ NBTTagCompound nbtTagCompound = new NBTTagCompound(); -+ nbtTagCompound.setShort("id", (short)enchantmentInstance.enchantment.id); -+ nbtTagCompound.setShort("lvl", (short)enchantmentInstance.level); -+ g.add(nbtTagCompound); -+ } -+ -+ if (!itemStack.hasTag()) { -+ itemStack.setTag(new NBTTagCompound()); -+ } -+ -+ itemStack.getTag().set("StoredEnchantments", g); -+ } -+ -+ public ItemStack a(EnchantmentInstance enchantmentInstance) { -+ ItemStack itemStack = new ItemStack(this); -+ this.a(itemStack, enchantmentInstance); -+ return itemStack; -+ } -+ -+ public StructurePieceTreasure b(Random random) { -+ return this.a(random, 1, 1, 1); -+ } -+ -+ public StructurePieceTreasure a(final Random random, final int n, final int n2, final int n3) { -+ ItemStack itemstack = new ItemStack(Items.BOOK, 1, 0); -+ -+ EnchantmentManager.a(random, itemstack, 30); -+ return new StructurePieceTreasure(itemstack, n, n2, n3); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public void close(IChatBaseComponent ichatbasecomponent) { - // Spigot Start - this.preparing = false; -+ this.k.clear(); // Spigot Update - 20140921a -+ this.l.clear(); // Spigot Update - 20140921a - // Spigot End - if (this.m.isOpen()) { - this.m.close(); -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.lang.ref.WeakReference; -+import java.util.Collections; -+import java.util.List; -+ -+public class PathfinderGoalNearestAttackableTarget extends PathfinderGoalTarget { -+ -+ private final Class a; -+ private final int b; -+ private final DistanceComparator e; -+ private final IEntitySelector f; -+ private WeakReference g; // Spigot Update - 20140921a -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag) { -+ this(entitycreature, oclass, i, flag, false); -+ } -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1) { -+ this(entitycreature, oclass, i, flag, flag1, (IEntitySelector) null); -+ } -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1, IEntitySelector ientityselector) { -+ super(entitycreature, flag, flag1); -+ this.g = new WeakReference(null); -+ this.a = oclass; -+ this.b = i; -+ this.e = new DistanceComparator(entitycreature); -+ this.a(1); -+ this.f = new EntitySelectorNearestAttackableTarget(this, ientityselector); -+ } -+ -+ public boolean a() { -+ if (this.b > 0 && this.c.aI().nextInt(this.b) != 0) { -+ return false; -+ } else { -+ double d0 = this.f(); -+ List list = this.c.world.a(this.a, this.c.boundingBox.grow(d0, 4.0D, d0), this.f); -+ -+ Collections.sort(list, this.e); -+ if (list.isEmpty()) { -+ return false; -+ } else { -+ this.g = new WeakReference((EntityLiving) list.get(0)); -+ return true; -+ } -+ } -+ } -+ -+ public void c() { -+ this.c.setGoalTarget(this.g.get()); -+ super.c(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class PathfinderGoalSwell extends PathfinderGoal { -+ -+ EntityCreeper a; -+ -+ public PathfinderGoalSwell(EntityCreeper entitycreeper) { -+ this.a = entitycreeper; -+ this.a(1); -+ } -+ -+ public boolean a() { -+ EntityLiving entityliving = this.a.getGoalTarget(); -+ -+ return this.a.cb() > 0 || entityliving != null && this.a.f(entityliving) < 9.0D; -+ } -+ -+ public void c() { -+ this.a.getNavigation().h(); -+ } -+ -+ public void d() {} -+ -+ public void e() { -+ EntityLiving b = this.a.getGoalTarget(); // Spigot Update - 20140921a -+ if (b == null) { -+ this.a.a(-1); -+ } else if (this.a.f(b) > 49.0D) { -+ this.a.a(-1); -+ } else if (!this.a.getEntitySenses().canSee(b)) { -+ this.a.a(-1); -+ } else { -+ this.a.a(1); -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -@@ -0,0 +0,0 @@ public class LongHash { - } - - public static int lsw(long l) { -- return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant & -+ return (int) (l & -1L) + Integer.MIN_VALUE; // Spigot - remove redundant & // Spigot Update - 20140921a - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -@@ -0,0 +0,0 @@ public class LongHashSet { - private int elements; - private long[] values; - private int modCount; -- private org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongHashSet() { - this(INITIAL_SIZE); -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public boolean contains(int msw, int lsw) { -- // Spigot start -- if ( elements == 0 ) -- { -- return false; -- } -- if ( flat.contains( msw, lsw ) ) -- { -- return true; -- } -- // Spigot end - return contains(LongHash.toLong(msw, lsw)); - } - - public boolean contains(long value) { -- // Spigot start -- if ( elements == 0 ) -- { -- return false; -- } -- if ( flat.contains( value ) ) -- { -- return true; -- } -- // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public boolean add(long value) { -- flat.put( value, Boolean.TRUE ); // Spigot - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - } - - public void remove(int msw, int lsw) { -- // Spigot start -- flat.remove(msw, lsw); -- remove0(LongHash.toLong(msw, lsw)); -+ remove(LongHash.toLong(msw, lsw)); - } - - public boolean remove(long value) { -- flat.remove(value); -- return remove0(value); -- } -- -- private boolean remove0(long value) { -- // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -0,0 +0,0 @@ public class LongHashSet { - - freeEntries = values.length; - modCount++; -- flat = new org.spigotmc.FlatMap(); - } - - public long[] toArray() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - private transient V[][] values; - private transient int modCount; - private transient int size; -- private transient org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongObjectHashMap() { - initialize(); -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V get(long key) { -- // Spigot start -- if ( size == 0 ) -- { -- return null; -- } -- V val = flat.get( key ); -- if ( val != null ) -- { -- return val; -- } -- // Spigot end - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) return null; -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V put(long key, V value) { -- flat.put(key, value); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] innerKeys = keys[index]; - V[] innerValues = values[index]; -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V remove(long key) { -- flat.remove(key); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) { -@@ -0,0 +0,0 @@ public class LongObjectHashMap implements Cloneable, Serializable { - size = 0; - Arrays.fill(keys, null); - Arrays.fill(values, null); -- flat = new org.spigotmc.FlatMap(); - } - - public Set keySet() { -diff --git a/src/main/java/org/spigotmc/FlatMap.java b/src/main/java/org/spigotmc/FlatMap.java -deleted file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- a/src/main/java/org/spigotmc/FlatMap.java -+++ /dev/null -@@ -0,0 +0,0 @@ --package org.spigotmc; -- --import org.bukkit.craftbukkit.util.LongHash; -- --public class FlatMap --{ -- -- private static final int FLAT_LOOKUP_SIZE = 512; -- private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ]; -- -- public void put(long msw, long lsw, V value) -- { -- long acx = Math.abs( msw ); -- long acz = Math.abs( lsw ); -- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -- { -- flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value; -- } -- } -- -- public void put(long key, V value) -- { -- put( LongHash.msw( key ), LongHash.lsw( key ), value ); -- -- } -- -- public void remove(long key) -- { -- put( key, null ); -- } -- -- public void remove(long msw, long lsw) -- { -- put( msw, lsw, null ); -- } -- -- public boolean contains(long msw, long lsw) -- { -- return get( msw, lsw ) != null; -- } -- -- public boolean contains(long key) -- { -- return get( key ) != null; -- } -- -- public V get(long msw, long lsw) -- { -- long acx = Math.abs( msw ); -- long acz = Math.abs( lsw ); -- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -- { -- return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )]; -- } else -- { -- return null; -- } -- } -- -- public V get(long key) -- { -- return get( LongHash.msw( key ), LongHash.lsw( key ) ); -- } --} --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch b/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch deleted file mode 100644 index 49bd2dcfdc..0000000000 --- a/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 1 Oct 2014 00:27:39 -0700 -Subject: [PATCH] Spigot Update - 20140927a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - if ( tracker instanceof EntityPlayer ) - { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); -+ -+ if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a -+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( (EntityPlayer) this.tracker ) ); -+ } - } - // Spigot end - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - - // CraftBukkit start - sendAll above replaced with this loop - PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer( entityplayer ); // Spigot - protocol patch -+ PacketPlayOutPlayerInfo displayPacket = PacketPlayOutPlayerInfo.updateDisplayName( entityplayer ); // Spigot Update - 20140927a - for (int i = 0; i < this.players.size(); ++i) { - EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); - - if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { - entityplayer1.playerConnection.sendPacket(packet); -+ // Spigot start - Update 20140927a -+ if ( entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { -+ entityplayer1.playerConnection.sendPacket( displayPacket ); -+ } -+ // Spigot end - } - } - // CraftBukkit end -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - // .name -> .listName - entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch -+ // Spigot start - Update 20140927a -+ if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { -+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( entityplayer1 ) ); -+ } -+ // Spigot end - // CraftBukkit end - } - } --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch b/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch deleted file mode 100644 index 3e886d4380..0000000000 --- a/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 1 Oct 2014 03:00:09 -0700 -Subject: [PATCH] Spigot Update - 20141001a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); - -- if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a // Spigot Update - 20141001a - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( (EntityPlayer) this.tracker ) ); - } - } -diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemDoor.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public class ItemDoor extends Item { -+ -+ private Material a; -+ -+ public ItemDoor(Material material) { -+ this.a = material; -+ this.maxStackSize = 1; -+ this.a(CreativeModeTab.d); -+ } -+ -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) { -+ if (l != 1) { -+ return false; -+ } else { -+ ++j; -+ Block block; -+ -+ if (this.a == Material.WOOD) { -+ block = Blocks.WOODEN_DOOR; -+ } else { -+ block = Blocks.IRON_DOOR_BLOCK; -+ } -+ -+ if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) { -+ if (!block.canPlace(world, i, j, k)) { -+ return false; -+ } else { -+ int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; -+ -+ place(world, i, j, k, i1, block); -+ --itemstack.count; -+ return true; -+ } -+ } else { -+ return false; -+ } -+ } -+ } -+ -+ public static void place(World world, int i, int j, int k, int l, Block block) { -+ byte b0 = 0; -+ byte b1 = 0; -+ -+ if (l == 0) { -+ b1 = 1; -+ } -+ -+ if (l == 1) { -+ b0 = -1; -+ } -+ -+ if (l == 2) { -+ b1 = -1; -+ } -+ -+ if (l == 3) { -+ b0 = 1; -+ } -+ -+ int i1 = (world.getType(i - b0, j, k - b1).r() ? 1 : 0) + (world.getType(i - b0, j + 1, k - b1).r() ? 1 : 0); -+ int j1 = (world.getType(i + b0, j, k + b1).r() ? 1 : 0) + (world.getType(i + b0, j + 1, k + b1).r() ? 1 : 0); -+ boolean flag = world.getType(i - b0, j, k - b1) == block || world.getType(i - b0, j + 1, k - b1) == block; -+ boolean flag1 = world.getType(i + b0, j, k + b1) == block || world.getType(i + b0, j + 1, k + b1) == block; -+ boolean flag2 = false; -+ -+ if (flag && !flag1) { -+ flag2 = true; -+ } else if (j1 > i1) { -+ flag2 = true; -+ } -+ -+ world.setTypeAndData(i, j, k, block, l, 3); // Spigot Update - 20141001a -+ world.setTypeAndData(i, j + 1, k, block, 8 | (flag2 ? 1 : 0), 3); // Spigot Update - 20141001a -+ //world.applyPhysics(i, j, k, block); // Spigot Update - 20141001a -+ //world.applyPhysics(i, j + 1, k, block); // Spigot Update - 20141001a -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ public class PacketPlayOutChat extends Packet { - private IChatBaseComponent a; - public BaseComponent[] components; // Spigot - Update 20140909b - private boolean b; -+ private int pos; // Spigot - Update 20141001a - - public PacketPlayOutChat() { - this.b = true; -@@ -0,0 +0,0 @@ public class PacketPlayOutChat extends Packet { - this(ichatbasecomponent, true); - } - -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, int pos) { -+ this(ichatbasecomponent, pos, true); -+ } -+ - public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) { -+ this(ichatbasecomponent, 0, flag); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, int pos, boolean flag) { - this.b = true; - this.a = ichatbasecomponent; - this.b = flag; -+ this.pos = pos; - } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -0,0 +0,0 @@ public class PacketPlayOutChat extends Packet { - // Spigot start - protocol patch - if ( packetdataserializer.version >= 16 ) - { -- packetdataserializer.writeByte(0); -+ packetdataserializer.writeByte( this.pos ); - } - // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -0,0 +0,0 @@ public class PacketPlayOutPosition extends Packet { - private float d; - private float e; - private boolean f; -+ private byte relativeBitMask; // Spigot Update - 20141001a - - public PacketPlayOutPosition() {} - - public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag) { -+ this(d0, d1, d2, f, f1, flag, (byte)0); -+ } -+ -+ public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag, byte relativeBitMask) { - this.a = d0; - this.b = d1; - this.c = d2; - this.d = f; - this.e = f1; - this.f = flag; -+ this.relativeBitMask = relativeBitMask; - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -0,0 +0,0 @@ public class PacketPlayOutPosition extends Packet { - packetdataserializer.writeBoolean( this.f ); - } else - { -- packetdataserializer.writeByte( 0 ); -+ packetdataserializer.writeByte( this.relativeBitMask ); - } - // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - - if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { - entityplayer1.playerConnection.sendPacket(packet); -- // Spigot start - Update 20140927a -- if ( entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { -+ // Spigot start - Update 20140927a // Update - 20141001a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { - entityplayer1.playerConnection.sendPacket( displayPacket ); - } - // Spigot end -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - // .name -> .listName - entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch -- // Spigot start - Update 20140927a -- if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { -+ // Spigot start - Update 20140927a // Update - 20141001a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer.playerConnection.networkManager.getVersion() > 28 ) { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( entityplayer1 ) ); - } - // Spigot end -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ public class CraftEventFactory { - } - - public static void handleInventoryCloseEvent(EntityHuman human) { -+ if (human.activeContainer == human.defaultContainer) { // Spigot Update - 20141001a -+ return; -+ } - InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); - human.world.getServer().getPluginManager().callEvent(event); - human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch b/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch deleted file mode 100644 index 8499d4292e..0000000000 --- a/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 13 Nov 2014 20:41:31 -0600 -Subject: [PATCH] Spigot Update - 20141113a - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - } - - public void a(PacketPlayInTabComplete packetplayintabcomplete) { -+ // Spigot start - Update 20141113a -+ if (PlayerConnection.chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ this.disconnect("disconnect.spam"); -+ return; -+ } -+ // Spigot end - ArrayList arraylist = Lists.newArrayList(); - Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator(); - --- \ No newline at end of file diff --git a/MinecraftRelocate/pom.xml b/MinecraftRelocate/pom.xml deleted file mode 100644 index ced882a8c4..0000000000 --- a/MinecraftRelocate/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - - - org.github.paperspigot - paperspigot-parent - dev-SNAPSHOT - ../pom.xml - - - org.github.paperspigot - minecraft-server-relocated - 1.7.10-SNAPSHOT - jar - - Minecraft Server Relocation - - - - org.github.paperspigot - minecraft-server - ${project.version} - compile - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - package - - shade - - - - - - - net.minecraft.util.com.google - com.google - - - net.minecraft.util.gnu - gnu - - - net.minecraft.util.io - io - - - net.minecraft.util.org - org - - - - - - - \ No newline at end of file diff --git a/MinecraftRelocate/rename.sh b/MinecraftRelocate/rename.sh deleted file mode 100755 index b9b25f357c..0000000000 --- a/MinecraftRelocate/rename.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -find ../PaperSpigot-Server/src/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../Spigot-Server/src/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../Spigot-Server-Patches/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../CraftBukkit-Patches/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; - -find ../PaperSpigot-Server/src/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../Spigot-Server/src/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../CraftBukkit-Patches/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../Spigot-Server-Patches/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; diff --git a/MinecraftServer/pom.xml b/MinecraftServer/pom.xml deleted file mode 100644 index 827c2fa386..0000000000 --- a/MinecraftServer/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - - org.github.paperspigot - paperspigot-parent - dev-SNAPSHOT - ../pom.xml - - - org.github.paperspigot - minecraft-server - 1.7.10-SNAPSHOT - jar - - Minecraft Server - - - - repobo-snap - http://repo.bukkit.org/content/groups/public - - - - - - org.bukkit - minecraft-server - 1.7.10 - compile - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - package - - shade - - - - - - - \ No newline at end of file diff --git a/SneakyThrow.jar b/SneakyThrow.jar deleted file mode 100644 index 321f64ee81..0000000000 Binary files a/SneakyThrow.jar and /dev/null differ diff --git a/Spigot-API-Patches/POM-changes.patch b/Spigot-API-Patches/POM-changes.patch index 35e88d6c32..8b9a020d21 100644 --- a/Spigot-API-Patches/POM-changes.patch +++ b/Spigot-API-Patches/POM-changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 21 Jul 2014 15:35:46 -0500 +Date: Thu, 27 Nov 2014 21:07:38 -0800 Subject: [PATCH] POM changes @@ -15,11 +15,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - spigot-api + org.github.paperspigot + paperspigot-api - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Spigot-API - http://www.spigotmc.org + PaperSpigot-API -+ https://github.com/PaperSpigot/Spigot ++ >https://github.com/PaperSpigot/Paper UTF-8 diff --git a/Spigot-Server-Patches/Add-1.8-recipes-for-stone-variants.patch b/Spigot-Server-Patches/Add-1.8-recipes-for-stone-variants.patch deleted file mode 100644 index 92723ec130..0000000000 --- a/Spigot-Server-Patches/Add-1.8-recipes-for-stone-variants.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 10 Jun 2014 18:22:19 -0500 -Subject: [PATCH] Add 1.8 recipes for stone variants - - -diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CraftingManager.java -+++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -0,0 +0,0 @@ public class CraftingManager { - this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, new ItemStack(Items.COAL, 1, 1)}); - this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOOD_STEP}); - this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST}); -+ // PaperSpigot start - Register moss stone and mossy and chiseled stone brick recipes -+ this.registerShapelessRecipe(new ItemStack(Blocks.MOSSY_COBBLESTONE), new Object[] { Blocks.VINE, Blocks.COBBLESTONE}); -+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 1), new Object[] { Blocks.VINE, Blocks.SMOOTH_BRICK}); -+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 3), new Object[] { new ItemStack(Blocks.STEP, 1, 5), new ItemStack(Blocks.STEP, 1, 5)}); -+ // PaperSpigot end - // Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below - this.sort(); // CraftBukkit - call new sort method - } -diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RecipesFurnace.java -+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java -@@ -0,0 +0,0 @@ public class RecipesFurnace { - this.registerRecipe(Blocks.EMERALD_ORE, new ItemStack(Items.EMERALD), 1.0F); - this.a(Items.POTATO, new ItemStack(Items.POTATO_BAKED), 0.35F); - this.registerRecipe(Blocks.NETHERRACK, new ItemStack(Items.NETHER_BRICK), 0.1F); -+ this.registerRecipe(Blocks.SMOOTH_BRICK, new ItemStack(Blocks.SMOOTH_BRICK, 1, 2), 0.5F); // PaperSpigot - Register cracked stone brick recipe - EnumFish[] aenumfish = EnumFish.values(); - int i = aenumfish.length; - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch index f619cc1ce7..5ddf90da95 100644 --- a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Suddenly -Date: Mon, 7 Jul 2014 04:11:34 +0100 +Date: Fri, 28 Nov 2014 01:49:53 -0600 Subject: [PATCH] Add configurable despawn distances for living entities @@ -17,37 +17,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.die(); } -- if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check -+ if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances +- if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances this.die(); - } else if (d3 < 1024.0D) { + } else if (d3 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances - this.aU = 0; + this.aO = 0; } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig + private void blockGrowthHeight() + { + cactusMaxHeight = getInt( "max-growth-height.cactus", 3 ); +- reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); ++ reedMaxHeight = getInt("max-growth-height.reeds", 3); + log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); + } + @@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F ); playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F ); } + -+ public Integer softDespawnDistance; -+ public Integer hardDespawnDistance; ++ public int softDespawnDistance; ++ public int hardDespawnDistance; + private void despawnDistances() + { + softDespawnDistance = getInt( "despawn-ranges.soft", 32 ); // 32^2 = 1024, Minecraft Default + hardDespawnDistance = getInt( "despawn-ranges.hard", 128 ); // 128^2 = 16384, Minecraft Default; -+ -+ if ( softDespawnDistance > hardDespawnDistance) -+ { ++ ++ if ( softDespawnDistance > hardDespawnDistance) { + softDespawnDistance = hardDespawnDistance; + } -+ ++ + log( "Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance ); -+ ++ + softDespawnDistance = softDespawnDistance*softDespawnDistance; + hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; + } diff --git a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch index 17eba67fc0..183cb450e7 100644 --- a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch @@ -1,9 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmck2b -Date: Thu, 10 Jul 2014 16:57:10 +0100 +Date: Fri, 28 Nov 2014 01:53:14 -0600 Subject: [PATCH] Allow for toggling of spawn chunks -Now with 100% more confirmed working by creator diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -16,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot // Spigot start this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); - this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -25,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 softDespawnDistance = softDespawnDistance*softDespawnDistance; hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; } -+ ++ + public boolean keepSpawnInMemory; + private void keepSpawnInMemory() + { diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch index 16602bfad7..33ad4c8625 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.world.methodProfiler.a("goalSelector"); + this.goalSelector.a(); + this.world.methodProfiler.c("jump"); -+ this.bm.b(); ++ this.g.b(); + // PaperSpigot end return; } diff --git a/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch b/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch index 8aa1884f2e..ceb8ad325a 100644 --- a/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch +++ b/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 16:10:44 -0500 +Date: Fri, 28 Nov 2014 00:08:37 -0600 Subject: [PATCH] Allow undead horse types to be leashed @@ -11,18 +11,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } - public boolean bM() { -- return !this.cE() && super.bM(); + public boolean ca() { +- return !this.cP() && super.ca(); + // PaperSpigot start - Configurable undead horse leashing + if (this.world.paperSpigotConfig.allowUndeadHorseLeashing) { -+ return super.bM(); ++ return super.ca(); + } else { -+ return !this.cE() && super.bM(); ++ return !this.cP() && super.ca(); + } + // PaperSpigot end } - protected void o(float f) { + protected void n(float f) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/Backwards-compatible-PacketPlayOutEntityTeleport-con.patch b/Spigot-Server-Patches/Backwards-compatible-PacketPlayOutEntityTeleport-con.patch deleted file mode 100644 index e1af486489..0000000000 --- a/Spigot-Server-Patches/Backwards-compatible-PacketPlayOutEntityTeleport-con.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sat, 13 Sep 2014 02:23:56 -0700 -Subject: [PATCH] Backwards compatible PacketPlayOutEntityTeleport constructor - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +0,0 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.heightCorrection = heightCorrection; // Spigot Update - 20140916a - } - -+ /** -+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor -+ */ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { -+ this(i, j, k, l, b0, b1, onGround, false); -+ } -+ -+ /** -+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor -+ */ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { -+ this(i, j, k, l, b0, b1, false, false); -+ } -+ - public void a(PacketDataSerializer packetdataserializer) { - this.a = packetdataserializer.readInt(); - this.b = packetdataserializer.readInt(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Better-EULA-handling.patch b/Spigot-Server-Patches/Better-EULA-handling.patch deleted file mode 100644 index ff633824a5..0000000000 --- a/Spigot-Server-Patches/Better-EULA-handling.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 8 Jul 2014 22:39:41 -0500 -Subject: [PATCH] Better EULA handling - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -0,0 +0,0 @@ import java.util.Collections; - import java.util.List; - import java.util.Random; - import java.util.concurrent.Callable; -+import java.util.concurrent.TimeUnit; // PaperSpigot - - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - i.info("Loading properties"); - this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support -- this.n = new EULA(new File("eula.txt")); -+ // PaperSpigot start - Display a EULA warning then continue -+ File EULALock = new File( ".eula-lock"); - // Spigot Start - boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); - if ( eulaAgreed ) -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - System.err.println( "You have used the Spigot command line EULA agreement flag." ); - System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." ); - System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); -- } -- // Spigot End -- if (!this.n.a() && !eulaAgreed) { -- i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -- this.n.b(); -- return false; -+ // Spigot End - } else { -+ if (!EULALock.exists()) { -+ System.err.println("WARNING: By using this server you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)"); -+ System.err.println("If you do not agree to the above EULA please stop this server and remove it from your system immediately."); -+ System.err.println("The server will start in 10 seconds, you will only see this message and have to wait this one time."); -+ try { -+ EULALock.createNewFile(); -+ } catch (IOException e1) { -+ System.err.println("Unable to create EULA lock file"); -+ e1.printStackTrace(); -+ } -+ try { -+ Thread.sleep(TimeUnit.SECONDS.toMillis(10)); -+ } catch (InterruptedException ex) { -+ } -+ } -+ // PaperSpigot end - if (this.N()) { - this.c("127.0.0.1"); - } else { -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - return true; - } - } -+ return true; // PaperSpigot - } - - // CraftBukkit start --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Center-TNT-grid-sample-points.patch b/Spigot-Server-Patches/Center-TNT-grid-sample-points.patch index c5b0d746bd..7496e3170a 100644 --- a/Spigot-Server-Patches/Center-TNT-grid-sample-points.patch +++ b/Spigot-Server-Patches/Center-TNT-grid-sample-points.patch @@ -1,9 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Wed, 6 Aug 2014 18:17:41 -0500 +Date: Fri, 28 Nov 2014 02:36:18 -0600 Subject: [PATCH] Center TNT grid sample points -More information at https://bugs.mojang.com/browse/MC-65697 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -26,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1; double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2; -- if (this.a(vec3d2.b(d3, d4, d5), vec3d) == null) { // CraftBukkit -+ if (this.a(vec3d2.b(xOffset + d3, d4, zOffset + d5), vec3d) == null) { // CraftBukkit // PaperSpigot +- if (this.rayTrace(new Vec3D(d3, d4, d5), vec3d) == null) { ++ if (this.rayTrace(new Vec3D(xOffset, d4, zOffset + d5), vec3d) == null) { // PaperSpigot - Center TNT sample points ++i; } diff --git a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch index c288c525cc..f58f995714 100644 --- a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 17:18:23 -0500 +Date: Fri, 28 Nov 2014 01:01:51 -0600 Subject: [PATCH] Configurable baby zombie movement speed @@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - protected static final IAttribute bp = (new AttributeRanged("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); - private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); -- private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.5D, 1); + protected static final IAttribute b = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); + private static final UUID c = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); +- private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", 0.5D, 1); + // PaperSpigot - Configurable baby zombie movement speed -+ private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); - private final PathfinderGoalBreakDoor bs = new PathfinderGoalBreakDoor(this); - private int bt; - private boolean bu = false; ++ private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); + private final PathfinderGoalBreakDoor bl = new PathfinderGoalBreakDoor(this); + private int bm; + private boolean bn = false; diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java diff --git a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch index 7e87ae4c98..126d2c82a6 100644 --- a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch +++ b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 16:26:30 -0500 +Date: Fri, 28 Nov 2014 00:55:17 -0600 Subject: [PATCH] Configurable cactus and reed natural growth heights @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ; } -- if (l < 3) { -+ if (l < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks - int i1 = world.getData(i, j, k); +- if (i < 3) { ++ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ; } -- if (l < 3) { -+ if (l < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks - int i1 = world.getData(i, j, k); +- if (i < 3) { ++ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); - if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch b/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch index 28083710bf..7be8016daf 100644 --- a/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch +++ b/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 16:21:03 -0500 +Date: Fri, 28 Nov 2014 00:45:14 -0600 Subject: [PATCH] Configurable damage multiplier for PvP blocking @@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end - if (!this.isInvulnerable()) { + if (!this.isInvulnerable(damagesource)) { if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { - f = (1.0F + f) * 0.5F; + f = (1.0F + f) * this.world.paperSpigotConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for blocking diff --git a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch index 1f6f069232..8c23390db8 100644 --- a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 17:49:02 -0500 +Date: Fri, 28 Nov 2014 01:29:35 -0600 Subject: [PATCH] Configurable fishing time ranges @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity { - this.az = MathHelper.nextInt(this.random, 20, 80); + this.av = MathHelper.nextInt(this.random, 20, 80); } } else { -- this.ay = MathHelper.nextInt(this.random, 100, 900); +- this.au = MathHelper.nextInt(this.random, 100, 900); + // PaperSpigot - Configurable fishing tick range -+ this.ay = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); - this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5; ++ this.au = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); + this.au -= EnchantmentManager.h(this.owner) * 20 * 5; } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false ); - log( "Inverted Redstone Lamps: " + invertedDaylightDetectors ); + reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); + log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); } + + public int fishingMinTicks; diff --git a/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch b/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch index f4b4706a82..8f61806279 100644 --- a/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch +++ b/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch @@ -1,23 +1,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: gsand -Date: Fri, 24 Oct 2014 22:09:58 -0500 +Date: Fri, 28 Nov 2014 13:53:48 -0600 Subject: [PATCH] Configurable game mechanics changes -diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTorch.java -+++ b/src/main/java/net/minecraft/server/BlockTorch.java -@@ -0,0 +0,0 @@ public class BlockTorch extends Block { - } else { - Block block = world.getType(i, j, k); - -- return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; -+ // PaperSpigot - Allow torch placement on stained glass as well -+ return world.paperSpigotConfig.lessPickyTorches ? block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.STAINED_GLASS || block == Blocks.COBBLE_WALL : block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; - } - } - diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java @@ -27,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.die(); - for (k = 0; k < 3; ++k) { -- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); +- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); - } - - for (k = 0; k < 2; ++k) { - this.a(Items.STICK, 1, 0.0F); - } -+ breakNaturally(); // PaperSpigot - Customizable boat drops ++ breakNaturally(); // PaperSpigot } // CraftBukkit end } @@ -41,21 +27,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!destroyEvent.isCancelled()) { this.die(); -- int l; +- int i; - -- for (l = 0; l < 3; ++l) { -- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); +- for (i = 0; i < 3; ++i) { +- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); - } - -- for (l = 0; l < 2; ++l) { +- for (i = 0; i < 2; ++i) { - this.a(Items.STICK, 1, 0.0F); - } -+ breakNaturally(); // PaperSpigot - Customizable boat drops ++ breakNaturally(); // PaperSpigot } // CraftBukkit end } @@ -0,0 +0,0 @@ public class EntityBoat extends Entity { - public int i() { + public int m() { return this.datawatcher.getInt(18); } + @@ -67,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(Items.BOAT, 1, 0.0F); + } else { + for (int k = 0; k < 3; ++k) { -+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); ++ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); + } + + for (int k = 0; k < 2; ++k) { diff --git a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch index d3aac5d8d8..437acd588e 100644 --- a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch @@ -1,45 +1,42 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Sun, 3 Aug 2014 21:20:42 -0500 +Date: Fri, 28 Nov 2014 02:31:02 -0600 Subject: [PATCH] Configurable speed for water flowing over lava -Basic info: http://hastebin.com/axuzaralas.vhdl diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { + b0 = 2; } - boolean flag = true; -- int i1 = this.a(world); -+ int i1 = this.getFlowSpeed(world, i, j, k); // PaperSpigot - int j1; +- int j = this.a(world); ++ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot + int k; - if (l > 0) { + if (i > 0) { @@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - public void onPlace(World world, int i, int j, int k) { - super.onPlace(world, i, j, k); - if (world.getType(i, j, k) == this) { -- world.a(i, j, k, this, this.a(world)); -+ world.a(i, j, k, this, this.getFlowSpeed(world, i, j, k)); // PaperSpigot - } - } - public boolean L() { - return true; + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + if (!this.e(world, blockposition, iblockdata)) { +- world.a(blockposition, (Block) this, this.a(world)); ++ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot + } + } + + /** + * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava + */ -+ public int getFlowSpeed(World world, int x, int y, int z) { ++ public int getFlowSpeed(World world, BlockPosition blockposition) { + if (this.getMaterial() == Material.WATER && ( -+ world.getType(x, y, z - 1).getMaterial() == Material.LAVA || -+ world.getType(x, y, z + 1).getMaterial() == Material.LAVA || -+ world.getType(x - 1, y, z).getMaterial() == Material.LAVA || -+ world.getType(x + 1, y, z).getMaterial() == Material.LAVA)) { ++ // TODO: Double check that this does what I think it does ++ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) { + return world.paperSpigotConfig.waterOverLavaFlowSpeed; + } + return super.a(world); @@ -58,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private void waterOverLavaFlowSpeed() + { + waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); -+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); ++ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); + } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch b/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch index f13035ed34..63986882f3 100644 --- a/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch +++ b/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 16:17:15 -0500 +Date: Fri, 28 Nov 2014 00:41:04 -0600 Subject: [PATCH] Configurable squid spawn ranges @@ -11,12 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal { } - public boolean canSpawn() { -- return this.locY > 45.0D && this.locY < 63.0D && super.canSpawn(); -+ // PaperSpigot - Configurable squid spawn height range -+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.canSpawn(); + public boolean bQ() { +- return this.locY > 45.0D && this.locY < 63.0D && super.bQ(); ++ // PaperSpigot - Configurable squid spawn range ++ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.bQ(); } - } + + public void b(float f, float f1, float f2) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch b/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch index 1329b28a92..e4cfe7c1d2 100644 --- a/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch +++ b/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 31 Aug 2014 12:13:32 -0500 +Date: Fri, 28 Nov 2014 12:23:02 -0600 Subject: [PATCH] Configurable strength and weakness effect modifiers @@ -8,21 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java +++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import org.github.paperspigot.PaperSpigotConfig; -+ - public class MobEffectAttackDamage extends MobEffectList { - - protected MobEffectAttackDamage(int i, boolean flag, int j) { @@ -0,0 +0,0 @@ public class MobEffectAttackDamage extends MobEffectList { } public double a(int i, AttributeModifier attributemodifier) { - return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); + // PaperSpigot - Configurable modifiers for strength and weakness effects -+ return this.id == MobEffectList.WEAKNESS.id ? (double) (PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : PaperSpigotConfig.strengthEffectModifier * (double) (i + 1); ++ return this.id == MobEffectList.WEAKNESS.id ? (double) (org.github.paperspigot.PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : org.github.paperspigot.PaperSpigotConfig.strengthEffectModifier * (double) (i + 1); } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java diff --git a/Spigot-Server-Patches/Do-not-remove-player-in-world-change.patch b/Spigot-Server-Patches/Do-not-remove-player-in-world-change.patch index 9d262e76f2..7ca843f22a 100644 --- a/Spigot-Server-Patches/Do-not-remove-player-in-world-change.patch +++ b/Spigot-Server-Patches/Do-not-remove-player-in-world-change.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: T00thpick1 -Date: Mon, 23 Jun 2014 21:37:24 -0500 +Date: Fri, 28 Nov 2014 01:25:45 -0600 Subject: [PATCH] Do not remove player in world change @@ -9,21 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.r().getTracker().untrackPlayer(entityplayer); - // entityplayer.r().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.r().getPlayerChunkMap().removePlayer(entityplayer); + entityplayer.u().getTracker().untrackPlayer(entityplayer); + // entityplayer.u().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.u().getPlayerChunkMap().removePlayer(entityplayer); - this.players.remove(entityplayer); -+ // this.players.remove(entityplayer); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094 ++ // this.players.remove(entityplayer); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094 this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); - ChunkCoordinates chunkcoordinates = entityplayer.getBed(); + BlockPosition blockposition = entityplayer.getBed(); boolean flag1 = entityplayer.isRespawnForced(); @@ -0,0 +0,0 @@ public abstract class PlayerList { if (!entityplayer.playerConnection.isDisconnected()) { worldserver.getPlayerChunkMap().addPlayer(entityplayer1); worldserver.addEntity(entityplayer1); - this.players.add(entityplayer1); -+ // this.players.add(entityplayer1); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094 ++ //this.players.add(entityplayer1); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094 + this.f.put(entityplayer1.getUniqueID(), entityplayer1); } // Added from changeDimension - this.updateClient(entityplayer1); // Update health, etc... -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Drop-falling-block-entities-that-are-above-the-speci.patch b/Spigot-Server-Patches/Drop-falling-block-entities-that-are-above-the-speci.patch index 8937864e94..00d1809e9e 100644 --- a/Spigot-Server-Patches/Drop-falling-block-entities-that-are-above-the-speci.patch +++ b/Spigot-Server-Patches/Drop-falling-block-entities-that-are-above-the-speci.patch @@ -1,7 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 5 Aug 2014 18:39:57 -0500 +Date: Fri, 28 Nov 2014 02:03:43 -0600 Subject: [PATCH] Drop falling block entities that are above the specified + height diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -9,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - ++this.ticksLived; + this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); + + // PaperSpigot start - Drop falling blocks above the specified height + if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { + if (this.dropItem) { -+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); ++ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F); + } + + this.die(); diff --git a/Spigot-Server-Patches/Fix-random-position-generator-tendency-to-move-north.patch b/Spigot-Server-Patches/Fix-random-position-generator-tendency-to-move-north.patch deleted file mode 100644 index 177e57c144..0000000000 --- a/Spigot-Server-Patches/Fix-random-position-generator-tendency-to-move-north.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 22 Jul 2014 21:52:19 -0500 -Subject: [PATCH] Fix random position generator tendency to move north west - -Fixes mobs sticking to one side of pens and "migrating" to the north west constantly -Backported fix from 1.8 - -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -0,0 +0,0 @@ public class RandomPositionGenerator { - private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { - Random random = entitycreature.aI(); - boolean flag = false; -- int k = 0; -- int l = 0; -- int i1 = 0; -+ // PaperSpigot start - int -> double -+ double k = 0; -+ double l = 0; -+ double i1 = 0; -+ // PaperSpigot end - float f = -99999.0F; - boolean flag1; - -@@ -0,0 +0,0 @@ public class RandomPositionGenerator { - } - - for (int j1 = 0; j1 < 10; ++j1) { -- int k1 = random.nextInt(2 * i) - i; -- int l1 = random.nextInt(2 * j) - j; -- int i2 = random.nextInt(2 * i) - i; -+ // PaperSpigot start - Even distribution and average of 0 -+ int k1 = random.nextInt(2 * i + 1) - i; -+ int l1 = random.nextInt(2 * j + 1) - j; -+ int i2 = random.nextInt(2 * i + 1) - i; -+ // PaperSpigot end - - if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) { -- k1 += MathHelper.floor(entitycreature.locX); -- l1 += MathHelper.floor(entitycreature.locY); -- i2 += MathHelper.floor(entitycreature.locZ); -- if (!flag1 || entitycreature.b(k1, l1, i2)) { -- float f1 = entitycreature.a(k1, l1, i2); -+ // PaperSpigot start - Use truncated absolute destination position for checking things -+ int k1Mod = k1 + MathHelper.floor(entitycreature.locX); -+ int l1Mod = l1 + MathHelper.floor(entitycreature.locY); -+ int i2Mod = i2 + MathHelper.floor(entitycreature.locZ); -+ if (!flag1 || entitycreature.b(k1Mod, l1Mod, i2Mod)) { -+ float f1 = entitycreature.a(k1Mod, l1Mod, i2Mod); - - if (f1 > f) { - f = f1; -- k = k1; -- l = l1; -- i1 = i2; -+ // but then the full value to set where to move -+ k = entitycreature.locX + k1; -+ l = entitycreature.locY + l1; -+ i1 = entitycreature.locZ + i2; -+ // PaperSpigot end - flag = true; - } - } -@@ -0,0 +0,0 @@ public class RandomPositionGenerator { - } - - if (flag) { -- return Vec3D.a((double) k, (double) l, (double) i1); -+ return Vec3D.a(k, l, i1); // PaperSpigot remove unnecessary cast - } else { - return null; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch index b44e1d0b57..ae70ac392b 100644 --- a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch +++ b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Thu, 12 Jun 2014 13:37:35 -0500 +Date: Fri, 28 Nov 2014 01:21:27 -0600 Subject: [PATCH] Fix redstone lag issues @@ -8,25 +8,23 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { - if (i != this.M.size()) { - throw new IllegalStateException("TickNextTick list out of synch"); - } else { -+ /* PaperSpigot start - Fix redstone lag issues - if (i > 1000) { - // CraftBukkit start - If the server has too much to process over time, try to alleviate that - if (i > 20 * 1000) { -@@ -0,0 +0,0 @@ public class WorldServer extends World { - i = 1000; - } - // CraftBukkit end -+ } */ -+ -+ if (i > 10000) { -+ i = 10000; - } -+ // PaperSpigot end +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + if (i != this.L.size()) { + throw new IllegalStateException("TickNextTick list out of synch"); + } else { ++ // PaperSpigot start - Fix redstone lag issues ++ /* + if (i > 1000) { + // CraftBukkit start - If the server has too much to process over time, try to alleviate that + if (i > 20 * 1000) { +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + i = 1000; + } + // CraftBukkit end +- } ++ } */ ++ // PaperSpigot end - this.methodProfiler.a("cleaning"); + this.methodProfiler.a("cleaning"); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-zombie-sieges-and-their-spawn-mechanics.patch b/Spigot-Server-Patches/Fix-zombie-sieges-and-their-spawn-mechanics.patch deleted file mode 100644 index f788a770f3..0000000000 --- a/Spigot-Server-Patches/Fix-zombie-sieges-and-their-spawn-mechanics.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 24 Jun 2014 22:55:30 -0500 -Subject: [PATCH] Fix zombie sieges and their spawn mechanics - - -diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java -@@ -0,0 +0,0 @@ public class VillageSiege { - return; - } - } -+ -+ // PaperSpigot start - Siege manager initial state is -1 -+ if (this.c == -1) { -+ return; -+ } -+ // PaperSpigot end - } - - if (!this.b) { -@@ -0,0 +0,0 @@ public class VillageSiege { - - while (true) { - if (i < 10) { -- this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D); -+ // PaperSpigot start - Zombies should spawn near the perimeter of the village not in the center of it -+ float angle = this.world.random.nextFloat() * (float) Math.PI * 2.0F; -+ this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(angle) * f) * 0.9D); - this.h = chunkcoordinates.y; -- this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D); -+ this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(angle) * f) * 0.9D); -+ // PaperSpigot end - flag = false; - Iterator iterator1 = this.world.villages.getVillages().iterator(); - -@@ -0,0 +0,0 @@ public class VillageSiege { - // CraftBukkit - add Return - return Vec3D.a((double) i1, (double) j1, (double) k1); - } -+ - } - - return null; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch index f050104d02..2c7e73ee99 100644 --- a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 19 Oct 2014 15:56:39 -0500 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Fri, 28 Nov 2014 12:48:26 -0600 Subject: [PATCH] Further improve server tick loop Improves how the catchup buffer is handled, allowing it to roll both ways @@ -15,7 +15,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public ConsoleReader reader; @@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public final double[] recentTps = new double[ 3 ]; - // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet - net.minecraft.util.io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.isRunning = false; } @@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; + private static final int SAMPLE_INTERVAL = 20; + public final RollingAverage tps1 = new RollingAverage(60); -+ public final RollingAverage tps5 = new RollingAverage(60*5); -+ public final RollingAverage tps15 = new RollingAverage(60*15); ++ public final RollingAverage tps5 = new RollingAverage(60 * 5); ++ public final RollingAverage tps15 = new RollingAverage(60 * 15); + + public static class RollingAverage { + private final int size; @@ -74,11 +74,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public void add(double x, long t) { + time -= times[index]; -+ total -= samples[index]*times[index]; ++ total -= samples[index] * times[index]; + samples[index] = x; + times[index] = t; + time += t; -+ total += x*t; ++ total += x * t; + if (++index == size) { + index = 0; + } @@ -93,8 +93,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void run() { try { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.a(this.q); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.a(this.r); // Spigot start - Arrays.fill( recentTps, 20 ); @@ -132,15 +132,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait); -+ // Paperspigot end + -+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) // PaperSpigot - Further improve tick loop ++ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) { - double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL; - recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) - recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) - recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) -+ // PaperSpigot start - Further improve tick loop + final long diff = curTime - tickSection; + double currentTps = 1E9 / diff * SAMPLE_INTERVAL; + tps1.add(currentTps, diff); @@ -156,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - return org.spigotmc.SpigotConfig.config; - } + private final Spigot spigot = new Spigot() + { + // PaperSpigot start - Add getTPS (Further improve tick loop) + @Override @@ -171,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot end + @Override - public void broadcast( BaseComponent component ) + public YamlConfiguration getConfig() { diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -182,9 +180,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -import com.google.common.base.Joiner; -import net.minecraft.server.MinecraftServer; --import net.minecraft.util.com.google.common.collect.Iterables; -+import org.apache.commons.lang.StringUtils; -+import org.bukkit.Bukkit; +-import com.google.common.collect.Iterables; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -198,16 +194,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - sb.append( format( tps ) ); - sb.append( ", " ); + // PaperSpigot start - Further improve tick handling -+ double[] tps = Bukkit.spigot().getTPS(); ++ double[] tps = org.bukkit.Bukkit.spigot().getTPS(); + String[] tpsAvg = new String[tps.length]; + -+ for ( int i = 0; i < tps.length; i++) { -+ tpsAvg[i] = format( tps[i] ); ++ for ( int i = 0; i < tps.length; i++) { ++ tpsAvg[i] = format( tps[i] ); } - sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); -+ -+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + StringUtils.join(tpsAvg, ", ")); -+ // PaperSpigot end ++ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); return true; } diff --git a/Spigot-Server-Patches/Improve-Network-Manager-packet-handling.patch b/Spigot-Server-Patches/Improve-Network-Manager-packet-handling.patch index d62d9e8074..55e949d6bc 100644 --- a/Spigot-Server-Patches/Improve-Network-Manager-packet-handling.patch +++ b/Spigot-Server-Patches/Improve-Network-Manager-packet-handling.patch @@ -1,10 +1,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:01:51 -0500 +Date: Fri, 28 Nov 2014 13:12:00 -0600 Subject: [PATCH] Improve Network Manager packet handling -Removes an unnecessary "peek at head of queue", and also makes the number of packets -processed per player per tick configurable, so larger servers can slow down incoming processing. +Removes an unnecessary "peek at head of queue" diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -12,46 +11,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private void i() { - if (this.m != null && this.m.isOpen()) { -- while (!this.l.isEmpty()) { -- QueuedPacket queuedpacket = (QueuedPacket) this.l.poll(); + private void m() { + if (this.i != null && this.i.isOpen()) { +- while (!this.h.isEmpty()) { +- QueuedPacket queuedpacket = (QueuedPacket) this.h.poll(); - + // PaperSpigot start - Improve Network Manager packet handling + QueuedPacket queuedpacket; -+ while ((queuedpacket = (QueuedPacket) this.l.poll()) != null) { - this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket)); - } -+ // PaperSpigot end - } - } - -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler { - } - - if (this.o != null) { -- for (int i = 1000; !this.k.isEmpty() && i >= 0; --i) { -- Packet packet = (Packet) this.k.poll(); -+ // PaperSpigot start - Improve Network Manager packet handling - Configurable packets per player per tick processing -+ Packet packet; -+ for (int i = org.github.paperspigot.PaperSpigotConfig.maxPacketsPerPlayer; (packet = (Packet) this.k.poll()) != null && i >= 0; --i) { ++ while ((queuedpacket = (QueuedPacket) this.h.poll()) != null) { + // PaperSpigot end + this.a(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket)); + } - // CraftBukkit start - if (!this.isConnected() || !this.m.config().isAutoRead()) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotConfig - strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D ); - weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D ); - } -+ -+ public static int maxPacketsPerPlayer; -+ private static void maxPacketsPerPlayer() -+ { -+ maxPacketsPerPlayer = getInt( "max-packets-per-player", 1000 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Improve-autosave-mechanism.patch b/Spigot-Server-Patches/Improve-autosave-mechanism.patch index f9e52a5566..2475fda588 100644 --- a/Spigot-Server-Patches/Improve-autosave-mechanism.patch +++ b/Spigot-Server-Patches/Improve-autosave-mechanism.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:30:48 -0500 +Date: Fri, 28 Nov 2014 13:47:24 -0600 Subject: [PATCH] Improve autosave mechanism Only save modified chunks, or chunks with entities after 4 auto save passes @@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - if (this.o && this.world.getTime() != this.lastSaved || this.n) { + if (this.r && this.world.getTime() != this.lastSaved || this.q) { return true; } -- } else if (this.o && this.world.getTime() >= this.lastSaved + 600L) { -+ } else if (this.o && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification +- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) { ++ } else if (this.r && this.world.getTime() >= + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification return true; } @@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs // Spigot Start // We replace this with saving each individual world as this.saveChunks(...) is broken, // and causes the main thread to sleep for random amounts of time depending on chunk activity @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.savingDisabled = false; - world.save(true, null); -+ world.save(forceSave, null); // PaperSpigot ++ world.save(forceSave, null); world.savingDisabled = oldSave; } catch (ExceptionWorldConflict ex) { diff --git a/Spigot-Server-Patches/Inverted-Daylight-Detector-Toggle.patch b/Spigot-Server-Patches/Inverted-Daylight-Detector-Toggle.patch deleted file mode 100644 index dadad335b4..0000000000 --- a/Spigot-Server-Patches/Inverted-Daylight-Detector-Toggle.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: gsand -Date: Tue, 5 Aug 2014 17:31:07 -0500 -Subject: [PATCH] Inverted Daylight Detector Toggle - - -diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java -+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java -@@ -0,0 +0,0 @@ public class BlockDaylightDetector extends BlockContainer { - f += (6.2831855F - f) * 0.2F; - } - -- i1 = Math.round((float) i1 * MathHelper.cos(f)); -- if (i1 < 0) { -- i1 = 0; -- } -- -- if (i1 > 15) { -- i1 = 15; -+ // PaperSpigot start - Configurable "inversion" for daylight detectors -+ if (world.paperSpigotConfig.invertedDaylightDetectors) { -+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15); -+ if (i1 < 10) { -+ i1 = 0; -+ } -+ -+ if (i1 > 9) { -+ i1 = 15; -+ } -+ } else { -+ i1 = Math.round((float) i1 * MathHelper.cos(f)); -+ if (i1 < 0) { -+ i1 = 0; -+ } -+ -+ if (i1 > 15) { -+ i1 = 15; -+ } - } -+ // PaperSpigot end - - if (l != i1) { - i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); - log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); - } -+ -+ public boolean invertedDaylightDetectors; -+ private void invertedDaylightDetectors() -+ { -+ invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false ); -+ log( "Inverted Redstone Lamps: " + invertedDaylightDetectors ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Invisible-players-don-t-have-rights.patch b/Spigot-Server-Patches/Invisible-players-don-t-have-rights.patch index 4982251ef6..97b92723ae 100644 --- a/Spigot-Server-Patches/Invisible-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Invisible-players-don-t-have-rights.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 21 Jul 2014 18:46:53 -0500 +Date: Fri, 28 Nov 2014 00:35:56 -0600 Subject: [PATCH] Invisible players don't have rights @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { - float f2; float f3; + float f4; + // PaperSpigot start - Allow arrows to fly through players + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (movingobjectposition != null) { org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event - + diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java @@ -40,16 +40,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot end + if (movingobjectposition != null) { - if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) { - this.ah(); + if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) { + this.aq(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); + + // PaperSpigot start - Allow block placement if the placer cannot see the blocker + if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) { + if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) { @@ -57,7 +57,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // PaperSpigot end - - if (!entity1.dead && entity1.k && entity1 != entity) { ++ + if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) { return false; + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Move-sound-handling-out-of-the-chest-tick-loop.patch b/Spigot-Server-Patches/Move-sound-handling-out-of-the-chest-tick-loop.patch index f554c466f8..0650034d2a 100644 --- a/Spigot-Server-Patches/Move-sound-handling-out-of-the-chest-tick-loop.patch +++ b/Spigot-Server-Patches/Move-sound-handling-out-of-the-chest-tick-loop.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Mon, 11 Aug 2014 23:03:47 -0500 +Date: Fri, 28 Nov 2014 11:56:55 -0600 Subject: [PATCH] Move sound handling out of the chest tick loop This allows us to disable ticking chests and enderchests without any @@ -10,140 +10,207 @@ diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory { - } +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye - this.n = this.m; -+ -+ // PaperSpigot start - Move chest sound handling out of the tick loop + private ItemStack[] items = new ItemStack[27]; + public boolean a; +- public TileEntityChest f; +- public TileEntityChest g; +- public TileEntityChest h; +- public TileEntityChest i; +- public float j; ++ public TileEntityChest f; // PaperSpigot - adjacentChestZNeg ++ public TileEntityChest g; // PaperSpigot - adjacentChestXPos ++ public TileEntityChest h; // PaperSpigot - adjacentChestXNeg ++ public TileEntityChest i; // PaperSpigot - adjacentChestZPos ++ public float j; // PaperSpigot - lidAngle + public float k; +- public int l; ++ public int l; // PaperSpigot - playersUsing + private int n; + private int o = -1; + private String p; +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + } + + public void c() { ++ // PaperSpigot start - Move chest sounds out of tick loop - TileEntity Tick Improvements + /* - f = 0.1F; - double d0; - -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory { - this.m = 0.0F; + this.m(); + int i = this.position.getX(); + int j = this.position.getY(); +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + this.j = 0.0F; } } + */ + // PaperSpigot end + } - public boolean c(int i, int j) { -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory { - if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o); +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye -+ // PaperSpigot start - Move chest open sound handling down to here -+ this.i(); -+ double d0; -+ -+ if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) { -+ double d1 = (double) this.x + 0.5D; -+ -+ d0 = (double) this.z + 0.5D; -+ if (this.l != null) { -+ d0 += 0.5D; -+ } -+ -+ if (this.j != null) { -+ d1 += 0.5D; -+ } -+ -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end -+ - // CraftBukkit start - Call redstone event - if (this.q() == Blocks.TRAPPED_CHEST) { - int newPower = Math.max(0, Math.min(15, this.o)); -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory { + ++this.l; if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o); - -+ // PaperSpigot start - Move chest close sound handling down to here -+ this.i(); -+ double d0; + -+ if (this.o == 0 && this.i == null && this.k == null) { -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; ++ // PaperSpigot - Move chest open sound out of the tick loop ++ if (this.l > 1 && this.j == 0.0F && this.f == null && this.h == null) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); + -+ if (this.l != null) { -+ d2 += 0.5D; -+ } ++ double d0 = (double) locZ + 0.5D; ++ double d1 = (double) locX + 0.5D; + -+ if (this.j != null) { ++ if (this.i != null) { + d0 += 0.5D; + } + -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ if (this.g != null) { ++ d1 += 0.5D; ++ } ++ ++ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ + this.world.playBlockAction(this.position, this.w(), 1, this.l); + + // CraftBukkit start - Call redstone event +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + + --this.l; + if (this.world == null) return; // CraftBukkit ++ ++ // PaperSpigot start - Move chest close sound handling out of the tick loop ++ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ float f1 = this.j; ++ ++ float f = 0.1F; ++ ++ if (this.l > 0) { ++ this.j += f; ++ } else { ++ this.j -= f; ++ } ++ ++ double d0 = (double) locX + 0.5D; ++ double d2 = (double) locZ + 0.5D; ++ ++ if (this.i != null) { ++ d2 += 0.5D; ++ } ++ ++ if (this.g != null) { ++ d0 += 0.5D; ++ } ++ ++ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ ++ if (this.j < 0.0F) { ++ this.j = 0.0F; ++ } + } + // PaperSpigot end + + this.world.playBlockAction(this.position, this.w(), 1, this.l); + // CraftBukkit start - Call redstone event - if (this.q() == Blocks.TRAPPED_CHEST) { - int newPower = Math.max(0, Math.min(15, this.o)); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { - } +@@ -0,0 +0,0 @@ package net.minecraft.server; - this.i = this.a; -+ -+ // PaperSpigot start - Move chest sound handling out of the tick loop + public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { + +- public float a; ++ public float a; // PaperSpigot - lidAngle + public float f; +- public int g; ++ public int g; // PaperSpigot - numPlayersUsing + private int h; + + public TileEntityEnderChest() {} + + public void c() { ++ // PaperSpigot - Move enderchest sound handling out of the tick loop + /* - float f = 0.1F; - double d0; - -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { + if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis this.a = 0.0F; } } + */ + // PaperSpigot end + } - public boolean c(int i, int j) { -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { - public void a() { - ++this.j; - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); -+ -+ // PaperSpigot start - Move chest open sound handling down to here -+ double d0; -+ -+ if (this.j > 0 && this.a == 0.0F) { -+ double d1 = (double) this.x + 0.5D; -+ -+ d0 = (double) this.z + 0.5D; -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end - } +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis public void b() { - --this.j; - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); + ++this.g; + -+ // PaperSpigot start - Move chest close sound handling down to here -+ float f = 0.1F; -+ double d0; ++ // PaperSpigot start - Move enderchest open sounds out of the tick loop ++ if (this.g > 0 && this.a == 0.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ ++ double d1 = (double) locX + 0.5D; ++ double d0 = (double) locZ + 0.5D; ++ ++ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ ++ this.a = 0.7F; ++ } ++ // PaperSpigot end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + + public void d() { + --this.g; ++ ++ // PaperSpigot start - Move enderchest close sounds out of the tick loop ++ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ ++ float f = 0.1F; ++ ++ if (this.g > 0) { ++ this.a += f; ++ } else { ++ this.a -= f; ++ } ++ ++ if (this.a > 1.0F) { ++ this.a = 1.0F; ++ } + -+ if (this.j == 0 && this.a == 0.0F || this.j > 0 && this.a < 1.0F) { + float f1 = this.a; -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; ++ float f2 = 0.5F; + -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ if (this.a < f2 && f1 >= f2) { ++ double d0 = (double) locX + 0.5D; ++ double d2 = (double) locZ + 0.5D; ++ ++ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } + + if (this.a < 0.0F) { + this.a = 0.0F; + } + } + // PaperSpigot end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); } - public boolean a(EntityHuman entityhuman) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch index a17caa773b..f9a19daca8 100644 --- a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:04:28 -0500 +Date: Fri, 28 Nov 2014 13:20:22 -0600 Subject: [PATCH] Only refresh abilities if needed @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } + @Override public void setFlying(boolean value) { + boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed if (!getAllowFlight() && value) { @@ -22,5 +22,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed } - public boolean getAllowFlight() { + @Override -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index 66c5b6a880..f21b437a8a 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -1,119 +1,119 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 24 Aug 2014 21:35:11 -0400 +Date: Fri, 28 Nov 2014 04:14:14 -0600 Subject: [PATCH] Optimize TileEntity Ticking -Re-organizes the servers TileEntity Tick List to be bucketed based on their tick interval. - -We now will not even store a Tile Entity that is known to not have any tick function -(half of them), skipping time spent iterating them and checking if they are valid -and in a loaded chunk. In other words, a lot of "meta" time wasted on tile entities -that would never do anything anyways. - -Then by reducing chests to 1 in 20 ticks, we cut out 95% of isLoaded checks and findPlayer -calls on chests, and 100% of the checks for Signs, the 2 most popular Tile Entities. - -This cuts out a massive amount of checks revolving around TileEntity ticking. -Servers with large amounts of TileEntities should see significant improvement. - -Finally, this then spreads out the ticking of reduced-rate TileEntities so that they -do not all tick on the same tick, distributing the load of some TileEntities like Chest. diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ public class TileEntity { - } - } +@@ -0,0 +0,0 @@ public abstract class TileEntity { } -+ -+ // Optimized TileEntity Tick changes + // Spigot end + ++ // PaperSpigot start - Optimized TileEntity Tick changes + private static int tileEntityCounter = 0; + public boolean isAdded = false; + public int tileId = tileEntityCounter++; ++ // PaperSpigot end + - // Spigot end - - public TileEntity() {} + public TileEntity() { + this.position = BlockPosition.ZERO; + this.h = -1; diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements IInventory { +@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay public TileEntityBeacon() {} - public void h() { + public void c() { - if (this.world.getTime() % 80L == 0L) { -+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick handling - this.y(); - this.x(); ++ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick Handling + this.m(); } + diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntity implements IInventory { - ++this.ticks; +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + ++this.n; float f; -- if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) { -+ if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling - this.o = 0; +- if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 200 == 0) { ++ if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling + this.l = 0; f = 5.0F; - List list = this.world.a(EntityHuman.class, AxisAlignedBB.a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f))); + List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - f), (double) ((float) j - f), (double) ((float) k - f), (double) ((float) (i + 1) + f), (double) ((float) (j + 1) + f), (double) ((float) (k + 1) + f))); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity { +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis + public TileEntityEnderChest() {} - public void h() { - super.h(); -- if (++this.k % 20 * 4 == 0) { -+ if (++this.k % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); + public void c() { +- if (++this.h % 20 * 4 == 0) { ++ if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); } diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityLightDetector.java +++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java -@@ -0,0 +0,0 @@ public class TileEntityLightDetector extends TileEntity { +@@ -0,0 +0,0 @@ public class TileEntityLightDetector extends TileEntity implements IUpdatePlayer public TileEntityLightDetector() {} - public void h() { + public void c() { - if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) { + if (this.world != null && !this.world.isStatic /*&& this.world.getTime() % 20L == 0L*/) { // PaperSpigot - interval controlled by Improved Tick Handling - this.h = this.q(); - if (this.h instanceof BlockDaylightDetector) { - ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z); + this.e = this.w(); + if (this.e instanceof BlockDaylightDetector) { + ((BlockDaylightDetector) this.e).d(this.world, this.position); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ package net.minecraft.server; + import com.google.common.base.Predicate; + import com.google.common.collect.Lists; + +-import java.util.ArrayList; +-import java.util.Calendar; +-import java.util.Collection; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Random; +-import java.util.UUID; ++import java.util.*; + import java.util.concurrent.Callable; + + // CraftBukkit start @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - }; // Spigot end - protected List f = new ArrayList(); -- public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet -+ public Set tileEntityList = new org.spigotmc.WorldTileEntityList(this); // CraftBukkit - ArrayList -> HashSet - private List a = new ArrayList(); - private List b = new ArrayList(); - public List players = new ArrayList(); -diff --git a/src/main/java/org/spigotmc/WorldTileEntityList.java b/src/main/java/org/spigotmc/WorldTileEntityList.java + protected final List g = Lists.newArrayList(); + public final List h = Lists.newArrayList(); +- public final List tileEntityList = Lists.newArrayList(); ++ public final Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot + private final List a = Lists.newArrayList(); + private final List b = Lists.newArrayList(); + public final List players = Lists.newArrayList(); +diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/org/spigotmc/WorldTileEntityList.java ++++ b/src/main/java/org/github/paperspigot/WorldTileEntityList.java @@ -0,0 +0,0 @@ -+package org.spigotmc; ++package org.github.paperspigot; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import net.minecraft.server.*; -+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; ++import gnu.trove.map.hash.TObjectIntHashMap; + +import java.util.Collection; +import java.util.HashSet; @@ -122,39 +122,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class WorldTileEntityList extends HashSet { + private static final TObjectIntHashMap> tileEntityTickIntervals = -+ new TObjectIntHashMap>() {{ -+ // Use -1 for no ticking -+ // These TE's have empty tick methods, doing nothing. Never bother ticking them. -+ for (Class ignored : new Class[]{ -+ TileEntityChest.class, // PaperSpigot - Don't tick chests either -+ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either -+ TileEntityRecordPlayer.class, -+ TileEntityDispenser.class, -+ TileEntityDropper.class, -+ TileEntitySign.class, -+ TileEntityNote.class, -+ TileEntityEnderPortal.class, -+ TileEntityCommand.class, -+ TileEntitySkull.class, -+ TileEntityComparator.class, -+ TileEntityFlowerPot.class -+ }) { -+ put(ignored, -1); -+ } ++ new TObjectIntHashMap>() {{ ++ // Use -1 for no ticking ++ // These TE's have empty tick methods, doing nothing. Never bother ticking them. ++ for (Class ignored : new Class[]{ ++ TileEntityChest.class, // PaperSpigot - Don't tick chests either ++ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either ++ TileEntityRecordPlayer.class, ++ TileEntityDispenser.class, ++ TileEntityDropper.class, ++ TileEntitySign.class, ++ TileEntityNote.class, ++ TileEntityEnderPortal.class, ++ TileEntityCommand.class, ++ TileEntitySkull.class, ++ TileEntityComparator.class, ++ TileEntityFlowerPot.class ++ }) { ++ put(ignored, -1); ++ } + -+ // does findPlayer lookup, so this helps performance to slow down -+ put(TileEntityEnchantTable.class, 20); ++ // does findPlayer lookup, so this helps performance to slow down ++ put(TileEntityEnchantTable.class, 20); + -+ // Slow things down that players won't notice due to craftbukkit "wall time" patches. -+ // These need to be investigated further before they can be safely used here -+ //put(TileEntityFurnace.class, 20); -+ //put(TileEntityBrewingStand.class, 10); ++ // Slow things down that players won't notice due to craftbukkit "wall time" patches. ++ // These need to be investigated further before they can be safely used here ++ //put(TileEntityFurnace.class, 20); ++ //put(TileEntityBrewingStand.class, 10); ++ ++ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know ++ // won't do anything anyways ++ put(TileEntityBeacon.class, 80); ++ put(TileEntityLightDetector.class, 20); ++ }}; + -+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know -+ // won't do anything anyways -+ put(TileEntityBeacon.class, 80); -+ put(TileEntityLightDetector.class, 20); -+ }}; + private static int getInterval(Class cls) { + int tickInterval = tileEntityTickIntervals.get(cls); + return tickInterval != 0 ? tickInterval : 1; @@ -281,4 +282,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} +\ No newline at end of file -- \ No newline at end of file diff --git a/Spigot-Server-Patches/POM-changes.patch b/Spigot-Server-Patches/POM-changes.patch index 1f44007ef3..223640336f 100644 --- a/Spigot-Server-Patches/POM-changes.patch +++ b/Spigot-Server-Patches/POM-changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 21 Jul 2014 15:36:01 -0500 +Date: Thu, 27 Nov 2014 22:43:08 -0800 Subject: [PATCH] POM changes @@ -17,11 +17,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.github.paperspigot + paperspigot jar - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Spigot - http://www.spigotmc.org + PaperSpigot -+ https://github.com/PaperSpigot/Spigot ++ https://github.com/PaperSpigot/Paper UTF-8 @@ -47,13 +47,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ${project.version} jar compile - - -- org.spigotmc -+ org.github.paperspigot - minecraft-server - ${minecraft.version}-SNAPSHOT - jar @@ -0,0 +0,0 @@ gitdescribe-maven-plugin 1.3 diff --git a/Spigot-Server-Patches/PaperSpigot-config-files.patch b/Spigot-Server-Patches/PaperSpigot-config-files.patch index b58e4bf938..7650459481 100644 --- a/Spigot-Server-Patches/PaperSpigot-config-files.patch +++ b/Spigot-Server-Patches/PaperSpigot-config-files.patch @@ -15,27 +15,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot start + org.github.paperspigot.PaperSpigotConfig.init(); + org.github.paperspigot.PaperSpigotConfig.registerCommands(); -+ // PaperSpigot stop ++ // PaperSpigot end - i.info("Generating keypair"); + DedicatedServer.LOGGER.info("Generating keypair"); this.a(MinecraftEncryption.b()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public boolean keepSpawnInMemory = true; - public ChunkGenerator generator; - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot -+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + ++ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot ++ public final SpigotTimings.WorldTimingsHandler timings; // Spigot + public CraftWorld getWorld() { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - // Changed signature - added gen and env - public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot -+ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( s ); // PaperSpigot + + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot ++ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( worlddata.getName() ); // PaperSpigot this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -49,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.spigotmc.SpigotConfig.init(); // Spigot + org.github.paperspigot.PaperSpigotConfig.init(); // PaperSpigot for (WorldServer world : console.worlds) { - world.difficulty = difficulty; + world.worldData.setDifficulty(difficulty); world.setSpawnFlags(monsters, animals); @@ -0,0 +0,0 @@ public final class CraftServer implements Server { world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); diff --git a/Spigot-Server-Patches/PaperSpigot-protocol-warning.patch b/Spigot-Server-Patches/PaperSpigot-protocol-warning.patch deleted file mode 100644 index 783355d1d1..0000000000 --- a/Spigot-Server-Patches/PaperSpigot-protocol-warning.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 21 Sep 2014 22:10:16 -0500 -Subject: [PATCH] PaperSpigot protocol warning - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - } - } - -- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" -+ System.err.println( "This PaperSpigot build only supports Minecraft 1.7.x and 1.8.x clients!\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" ); -+ + "Please report issues directly to Paper, and always ensure you're up-to-date!\n" -+ + "*** Any bug reports not running the very latest version of the software will be ignored ***\n\n" ); - - // Spigot end - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch index e797a3d488..e897f0d36c 100644 --- a/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch +++ b/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: gsand -Date: Sun, 17 Aug 2014 16:40:54 -0500 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Fri, 28 Nov 2014 01:41:54 -0600 Subject: [PATCH] Player Exhaustion Multipliers @@ -10,32 +10,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block { - public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { - entityhuman.a(StatisticList.MINE_BLOCK_COUNT[getId(this)], 1); + public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) { + entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]); - entityhuman.applyExhaustion(0.025F); + entityhuman.applyExhaustion(world.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion - if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { - ItemStack itemstack = this.j(l); + if (this.G() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { + ItemStack itemstack = this.i(iblockdata); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.m, i); + this.a(StatisticList.p, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); + this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion } - } else if (this.M()) { + } else if (this.V()) { i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.i, i); + this.a(StatisticList.l, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); + this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion } - } else if (this.h_()) { + } else if (this.j_()) { if (d1 > 0.0D) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index 934bb1ab8c..b6992fa5b9 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Sun, 21 Sep 2014 22:02:02 -0500 +Date: Fri, 28 Nov 2014 03:31:21 -0600 Subject: [PATCH] Player affects spawning API @@ -8,24 +8,24 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - public boolean sleeping; // protected -> public - public boolean fauxSleeping; - public String spawnWorld = ""; +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + private final GameProfile bF; + private boolean bG = false; + public EntityFishingHook hookedFish; + public boolean affectsSpawning = true; // PaperSpigot - - @Override - public CraftHumanEntity getBukkitEntity() { + + // CraftBukkit start + public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { if (this.persistent) { - this.aU = 0; + this.aO = 0; } else { - EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); -+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot ++ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - Affects Spawning API if (entityhuman != null) { double d0 = entityhuman.locX - this.locX; @@ -34,47 +34,87 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { + private boolean g() { + BlockPosition blockposition = this.b(); + +- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); ++ // PaperSpigot - Affects Spawning API ++ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); } - public boolean f() { -- return this.a().findNearbyPlayer((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; -+ return this.a().findNearbyPlayerWhoAffectsSpawning((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; // PaperSpigot - } - - public void g() { + public void c() { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); - for (i = 0; i < worldserver.players.size(); ++i) { - EntityHuman entityhuman = (EntityHuman) worldserver.players.get(i); -+ // PaperSpigot start - Affects spawning API -+ if (!entityhuman.affectsSpawning) -+ continue; -+ // PaperSpigot end - int k = MathHelper.floor(entityhuman.locX / 16.0D); +- if (!entityhuman.v()) { ++ if (!entityhuman.v() || !entityhuman.affectsSpawning) { // PaperSpigot + int l = MathHelper.floor(entityhuman.locX / 16.0D); - j = MathHelper.floor(entityhuman.locZ / 16.0D); + j = MathHelper.floor(entityhuman.locZ / 16.0D); @@ -0,0 +0,0 @@ public final class SpawnerCreature { - float f1 = (float) i3; - float f2 = (float) j3 + 0.5F; + float f = (float) j3 + 0.5F; + float f1 = (float) l3 + 0.5F; -- if (worldserver.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) { -+ if (worldserver.findNearbyPlayerWhoAffectsSpawning((double) f, (double) f1, (double) f2, 24.0D) == null) { // PaperSpigot - float f3 = f - (float) chunkcoordinates.x; - float f4 = f1 - (float) chunkcoordinates.y; - float f5 = f2 - (float) chunkcoordinates.z; +- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { ++ // PaperSpigot - Affects Spawning API ++ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { + if (biomemeta == null) { + biomemeta = worldserver.a(enumcreaturetype, blockposition2); + if (biomemeta == null) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ package net.minecraft.server; + + import com.google.common.base.Predicate; + import com.google.common.collect.Lists; +-import com.google.common.collect.Sets; ++ + import java.util.ArrayList; + import java.util.Calendar; + import java.util.Collection; + import java.util.Iterator; + import java.util.List; + import java.util.Random; +-import java.util.Set; + import java.util.UUID; + import java.util.concurrent.Callable; + +@@ -0,0 +0,0 @@ import java.util.concurrent.Callable; + import org.bukkit.Bukkit; + import org.bukkit.block.BlockState; + import org.bukkit.craftbukkit.util.CraftMagicNumbers; +-import org.bukkit.craftbukkit.util.LongHashSet; + import org.bukkit.craftbukkit.SpigotTimings; // Spigot + import org.bukkit.generator.ChunkGenerator; + import org.bukkit.craftbukkit.CraftServer; @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return entityhuman; + return false; } -+ // PaperSpigot start - Find players with the spawning flag ++ // PaperSpigot start - Affects spawning API ++ public boolean isPlayerNearbyWhoAffectsSpawning(double d0, double d1, double d2, double d3) { ++ for (int i = 0; i < this.players.size(); ++i) { ++ EntityHuman entityhuman = (EntityHuman) this.players.get(i); ++ ++ if (IEntitySelector.d.apply(entityhuman)) { ++ double d4 = entityhuman.e(d0, d1, d2); ++ ++ if (d3 < 0.0D || d4 < d3 * d3 && entityhuman.affectsSpawning) { ++ return true; ++ } ++ } ++ } ++ ++ return false; ++ } ++ + public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double radius) { + return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, radius); + } @@ -110,8 +150,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - packet.components = components; - getHandle().playerConnection.sendPacket( packet ); + + return java.util.Collections.unmodifiableSet( ret ); } + + // PaperSpigot start - Add affects spawning API @@ -123,7 +163,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return getHandle().affectsSpawning; + } + // PaperSpigot end -+ }; public Player.Spigot spigot() diff --git a/Spigot-Server-Patches/Player-lookup-improvements.patch b/Spigot-Server-Patches/Player-lookup-improvements.patch index 35d77e84dc..823887b14e 100644 --- a/Spigot-Server-Patches/Player-lookup-improvements.patch +++ b/Spigot-Server-Patches/Player-lookup-improvements.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:26:55 -0500 +Date: Fri, 28 Nov 2014 13:43:11 -0600 Subject: [PATCH] Player lookup improvements Minecraft and CraftBukkit both use Arrays to store online players, @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - private static final SimpleDateFormat h = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); + private static final SimpleDateFormat i = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety + // PaperSpigot start - Player lookup improvements @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public EntityPlayer get(Object key) { + // put the .playerConnection check done in other places here -+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key); ++ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key); + return (player != null && player.playerConnection != null) ? player : null; + } + @@ -41,44 +41,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public EntityPlayer remove(Object key) { -+ return super.remove(key instanceof String ? ((String)key).toLowerCase() : key); ++ return super.remove(key instanceof String ? ((String) key).toLowerCase() : key); + } + }; + public final Map uuidMap = new java.util.HashMap() { + @Override + public EntityPlayer get(Object key) { + // put the .playerConnection check done in other places here -+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key); ++ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key); + return (player != null && player.playerConnection != null) ? player : null; + } + }; + // PaperSpigot end - private final GameProfileBanList j; - private final IpBanList k; - private final OpList operators; + public final Map f = Maps.newHashMap(); + private final GameProfileBanList k; + private final IpBanList l; @@ -0,0 +0,0 @@ public abstract class PlayerList { - cserver.detectListNameConflict(entityplayer); // CraftBukkit - // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below + + public void onPlayerJoin(EntityPlayer entityplayer) { this.players.add(entityplayer); + this.playerMap.put(entityplayer.getName(), entityplayer); // PaperSpigot + this.uuidMap.put(entityplayer.getUniqueID(), entityplayer); // PaperSpigot + this.f.put(entityplayer.getUniqueID(), entityplayer); + // this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); - - // CraftBukkit start @@ -0,0 +0,0 @@ public abstract class PlayerList { worldserver.kill(entityplayer); worldserver.getPlayerChunkMap().removePlayer(entityplayer); this.players.remove(entityplayer); + this.uuidMap.remove(entityplayer.getUniqueID()); // PaperSpigot + this.playerMap.remove(entityplayer.getName()); // PaperSpigot - this.n.remove(entityplayer.getUniqueID()); - ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit - + this.f.remove(entityplayer.getUniqueID()); + this.o.remove(entityplayer.getUniqueID()); + // CraftBukkit start @@ -0,0 +0,0 @@ public abstract class PlayerList { EntityPlayer entityplayer; -+ /* // PaperSpigot start - Use exact lookup below ++ // PaperSpigot - Use exact lookup below ++ /* for (int i = 0; i < this.players.size(); ++i) { entityplayer = (EntityPlayer) this.players.get(i); if (entityplayer.getUniqueID().equals(uuid)) { @@ -88,7 +89,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityplayer = (EntityPlayer) iterator.next(); + */ + if ((entityplayer = uuidMap.get(uuid)) != null) { -+ // PaperSpigot end entityplayer.playerConnection.disconnect("You logged in from another location"); } @@ -142,11 +142,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int delta = Integer.MAX_VALUE; for (Player player : getOnlinePlayers()) { @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - @Override - @Deprecated public Player getPlayerExact(String name) { -- Validate.notNull(name, "Name cannot be null"); -- + Validate.notNull(name, "Name cannot be null"); + - String lname = name.toLowerCase(); - - for (Player player : getOnlinePlayers()) { @@ -159,10 +157,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot start - Improved player lookup, replace whole method + EntityPlayer player = playerList.playerMap.get(name); + return player != null ? player.getBukkitEntity() : null; -+ // PaperSpigot end ++ // PaperSpigot end } // TODO: In 1.8+ this should use the server's UUID->EntityPlayer map + @Override + public Player getPlayer(UUID id) { +- for (Player player : getOnlinePlayers()) { +- if (player.getUniqueId().equals(id)) { +- return player; +- } +- } +- +- return null; ++ // PaperSpigot start - Improved player lookup, replace whole method ++ EntityPlayer player = playerList.uuidMap.get(id); ++ return player != null ? player.getBukkitEntity() : null; ++ // PaperSpigot end + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index 3e751f88d6..ae493c9d0c 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 19 Aug 2014 14:51:28 -0500 +Date: Fri, 28 Nov 2014 03:43:14 -0600 Subject: [PATCH] Remove invalid mob spawner tile entities @@ -14,19 +14,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot end + // PaperSpigot start - Remove invalid mob spawner Tile Entities + } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner && -+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(i, j, k)) != org.bukkit.Material.MOB_SPAWNER) { -+ this.tileEntities.remove(chunkposition); ++ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) { ++ this.tileEntities.remove(blockposition); + // PaperSpigot end // CraftBukkit start } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java @@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); - log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); + log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); } + + public boolean removeInvalidMobSpawnerTEs; diff --git a/Spigot-Server-Patches/Remove-specific-entities-that-fly-through-an-unloade.patch b/Spigot-Server-Patches/Remove-specific-entities-that-fly-through-an-unloade.patch index 97fcfb22db..b2666054fa 100644 --- a/Spigot-Server-Patches/Remove-specific-entities-that-fly-through-an-unloade.patch +++ b/Spigot-Server-Patches/Remove-specific-entities-that-fly-through-an-unloade.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Fri, 29 Aug 2014 20:33:52 -0500 +Date: Fri, 28 Nov 2014 12:11:03 -0600 Subject: [PATCH] Remove specific entities that fly through an unloaded chunk @@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { - public EnumEntitySize as; +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + private final CommandObjectiveExecutor as; public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only + public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java @@ -0,0 +0,0 @@ public class EntityEnderPearl extends EntityProjectile { - movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F); + movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F); } + // PaperSpigot start - Remove entities in unloaded chunks @@ -31,24 +31,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot end + for (int i = 0; i < 32; ++i) { - this.world.addParticle("portal", this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian()); + this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]); } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - ++this.ticksLived; this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); + + // PaperSpigot start - Remove entities in unloaded chunks + if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) { + this.die(); + } + // PaperSpigot end - ++ // PaperSpigot start - Drop falling blocks above the specified height if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { + if (this.dropItem) { diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -57,12 +58,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastZ = this.locZ; this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); ++ + // PaperSpigot start - Remove entities in unloaded chunks + if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) { + this.die(); + this.fuseTicks = 2; + } + // PaperSpigot end ++ this.motX *= 0.9800000190734863D; this.motY *= 0.9800000190734863D; this.motZ *= 0.9800000190734863D; @@ -72,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { { - if ( !this.isChunkLoaded( chunkx, chunkz ) ) + if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) { + entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks continue; @@ -83,10 +86,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.ticksLived++; entity.inactiveTick(); + // PaperSpigot start - Remove entities in unloaded chunks -+ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j) && ++ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j, true) && + (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) || + (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) { -+ entity.inUnloadedChunk = true; ++ entity.inUnloadedChunk = true; + entity.die(); + } + // PaperSpigot end diff --git a/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch b/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch index ec6e9322d0..40aa69c883 100644 --- a/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch +++ b/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } public String getServerModName() { diff --git a/Spigot-Server-Patches/Teleport-passenger-vehicle-with-player.patch b/Spigot-Server-Patches/Teleport-passenger-vehicle-with-player.patch index 2cddb14905..952ac17476 100644 --- a/Spigot-Server-Patches/Teleport-passenger-vehicle-with-player.patch +++ b/Spigot-Server-Patches/Teleport-passenger-vehicle-with-player.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 17 May 2014 02:12:39 -0500 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Fri, 28 Nov 2014 00:24:18 -0600 Subject: [PATCH] Teleport passenger/vehicle with player @@ -8,22 +8,22 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity { - static boolean isLevelAtLeast(NBTTagCompound tag, int level) { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } -+ // PaperSpigot start + // CraftBukikt end ++ // PaperSpigot start - Teleport passenger vehicle with player + public void retrack() { + final EntityTracker entityTracker = ((WorldServer) world).getTracker(); + entityTracker.untrackEntity(this); + entityTracker.track(this); + } + // PaperSpigot end - // CraftBukkit end + private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static int entityCount; -@@ -0,0 +0,0 @@ public abstract class Entity { - // minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1); +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { + // minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1); boolean before = worldserver1.chunkProviderServer.forceChunkLoad; worldserver1.chunkProviderServer.forceChunkLoad = true; - worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal); @@ -31,17 +31,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 worldserver1.chunkProviderServer.forceChunkLoad = before; // CraftBukkit end this.world.methodProfiler.c("reloading"); -@@ -0,0 +0,0 @@ public abstract class Entity { +@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { if (entity != null) { - entity.a(this, true); + entity.n(this); + // PaperSpigot start - move entity to new location + exit.getBlock(); // force load + entity.setLocation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + // PaperSpigot end /* CraftBukkit start - We need to do this... if (j == 1 && i == 1) { - ChunkCoordinates chunkcoordinates = worldserver1.getSpawn(); + BlockPosition blockposition = this.world.r(worldserver1.getSpawn()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + vehicle.teleportTo(location, false); + vehicle = vehicle.getBukkitEntity().getHandle(); + entity.vehicle = vehicle; -+ vehicle.passenger = entity; ++ entity.passenger = entity; + } + + if (passenger != null) { @@ -81,12 +81,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // PaperSpigot start + if (vehicle != null) { + vehicle.retrack(); -+ //entity.retrack(); + } ++ + if (passenger != null) { + passenger.retrack(); + } + // PaperSpigot end ++ return true; } diff --git a/Spigot-Server-Patches/Temporary-fix-for-rails-dupe.patch b/Spigot-Server-Patches/Temporary-fix-for-rails-dupe.patch index 520c0c6038..96392b5d39 100644 --- a/Spigot-Server-Patches/Temporary-fix-for-rails-dupe.patch +++ b/Spigot-Server-Patches/Temporary-fix-for-rails-dupe.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmck2b -Date: Sun, 31 Aug 2014 18:12:10 +0100 +Date: Fri, 28 Nov 2014 12:30:47 -0600 Subject: [PATCH] Temporary fix for rails dupe @@ -12,15 +12,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (flag) { -- this.b(world, i, j, k, world.getData(i, j, k), 0); -- world.setAir(i, j, k); +- this.b(world, blockposition, iblockdata, 0); +- world.setAir(blockposition); + // PaperSpigot start - Rails dupe workaround -+ if (world.getType(i, j, k).getMaterial() != Material.AIR) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); ++ if (world.getType(blockposition).getBlock().getMaterial() != Material.AIR) { ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); + } + // PaperSpigot end } else { - this.a(world, i, j, k, l, i1, block); + this.b(world, blockposition, iblockdata, block); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch index d23455cb32..bf11ed59b2 100644 --- a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch +++ b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 5 Aug 2014 17:56:02 -0500 +Date: Fri, 28 Nov 2014 01:33:25 -0600 Subject: [PATCH] Toggle for player interact limiter @@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { - - public void a(PacketPlayInBlockPlace packetplayinblockplace) { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); boolean throttled = false; - if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + // PaperSpigot - Allow disabling the player interaction limiter diff --git a/Spigot-Server-Patches/mc-dev-imports.patch b/Spigot-Server-Patches/mc-dev-imports.patch index b60197cce9..ba77792528 100644 --- a/Spigot-Server-Patches/mc-dev-imports.patch +++ b/Spigot-Server-Patches/mc-dev-imports.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 22 Jul 2014 21:05:53 -0500 +Date: Thu, 27 Nov 2014 23:53:56 -0600 Subject: [PATCH] mc-dev imports @@ -12,18 +12,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import java.util.Random; -+ +public abstract class BlockMinecartTrackAbstract extends Block { + + protected final boolean a; + -+ public static final boolean b_(World world, int i, int j, int k) { -+ return a(world.getType(i, j, k)); ++ public static boolean d(World world, BlockPosition blockposition) { ++ return d(world.getType(blockposition)); + } + -+ public static final boolean a(Block block) { -+ return block == Blocks.RAILS || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL; ++ public static boolean d(IBlockData iblockdata) { ++ Block block = iblockdata.getBlock(); ++ ++ return block == Blocks.RAIL || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL; + } + + protected BlockMinecartTrackAbstract(boolean flag) { @@ -33,11 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.a(CreativeModeTab.e); + } + -+ public boolean e() { -+ return this.a; -+ } -+ -+ public AxisAlignedBB a(World world, int i, int j, int k) { ++ public AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) { + return null; + } + @@ -45,288 +41,94 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + -+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { -+ this.updateShape(world, i, j, k); -+ return super.a(world, i, j, k, vec3d, vec3d1); ++ public MovingObjectPosition a(World world, BlockPosition blockposition, Vec3D vec3d, Vec3D vec3d1) { ++ this.updateShape(world, blockposition); ++ return super.a(world, blockposition, vec3d, vec3d1); + } + -+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { -+ int l = iblockaccess.getData(i, j, k); ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ IBlockData iblockdata = iblockaccess.getType(blockposition); ++ EnumTrackPosition enumtrackposition = iblockdata.getBlock() == this ? (EnumTrackPosition) iblockdata.get(this.l()) : null; + -+ if (l >= 2 && l <= 5) { ++ if (enumtrackposition != null && enumtrackposition.c()) { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + } else { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } ++ + } + + public boolean d() { + return false; + } + -+ public int b() { -+ return 9; ++ public boolean canPlace(World world, BlockPosition blockposition) { ++ return World.a((IBlockAccess) world, blockposition.down()); + } + -+ public int a(Random random) { -+ return 1; -+ } -+ -+ public boolean canPlace(World world, int i, int j, int k) { -+ return World.a((IBlockAccess) world, i, j - 1, k); -+ } -+ -+ public void onPlace(World world, int i, int j, int k) { ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + if (!world.isStatic) { -+ this.a(world, i, j, k, true); ++ iblockdata = this.a(world, blockposition, iblockdata, true); + if (this.a) { -+ this.doPhysics(world, i, j, k, this); ++ this.doPhysics(world, blockposition, iblockdata, this); + } + } ++ + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { + if (!world.isStatic) { -+ int l = world.getData(i, j, k); -+ int i1 = l; -+ -+ if (this.a) { -+ i1 = l & 7; -+ } -+ ++ EnumTrackPosition enumtrackposition = (EnumTrackPosition) iblockdata.get(this.l()); + boolean flag = false; + -+ if (!World.a((IBlockAccess) world, i, j - 1, k)) { ++ if (!World.a((IBlockAccess) world, blockposition.down())) { + flag = true; + } + -+ if (i1 == 2 && !World.a((IBlockAccess) world, i + 1, j, k)) { ++ if (enumtrackposition == EnumTrackPosition.ASCENDING_EAST && !World.a((IBlockAccess) world, blockposition.east())) { + flag = true; -+ } -+ -+ if (i1 == 3 && !World.a((IBlockAccess) world, i - 1, j, k)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_WEST && !World.a((IBlockAccess) world, blockposition.west())) { + flag = true; -+ } -+ -+ if (i1 == 4 && !World.a((IBlockAccess) world, i, j, k - 1)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_NORTH && !World.a((IBlockAccess) world, blockposition.north())) { + flag = true; -+ } -+ -+ if (i1 == 5 && !World.a((IBlockAccess) world, i, j, k + 1)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_SOUTH && !World.a((IBlockAccess) world, blockposition.south())) { + flag = true; + } + + if (flag) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); + } else { -+ this.a(world, i, j, k, l, i1, block); ++ this.b(world, blockposition, iblockdata, block); + } ++ + } + } + -+ protected void a(World world, int i, int j, int k, int l, int i1, Block block) {} ++ protected void b(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {} + -+ protected void a(World world, int i, int j, int k, boolean flag) { -+ if (!world.isStatic) { -+ (new MinecartTrackLogic(this, world, i, j, k)).a(world.isBlockIndirectlyPowered(i, j, k), flag); -+ } ++ protected IBlockData a(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) { ++ return world.isStatic ? iblockdata : (new MinecartTrackLogic(this, world, blockposition, iblockdata)).a(world.isBlockIndirectlyPowered(blockposition), flag).b(); + } + -+ public int h() { ++ public int i() { + return 0; + } + -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ int i1 = l; -+ -+ if (this.a) { -+ i1 = l & 7; -+ } -+ -+ super.remove(world, i, j, k, block, l); -+ if (i1 == 2 || i1 == 3 || i1 == 4 || i1 == 5) { -+ world.applyPhysics(i, j + 1, k, block); ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ super.remove(world, blockposition, iblockdata); ++ if (((EnumTrackPosition) iblockdata.get(this.l())).c()) { ++ world.applyPhysics(blockposition.up(), this); + } + + if (this.a) { -+ world.applyPhysics(i, j, k, block); -+ world.applyPhysics(i, j - 1, k, block); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockTorch.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class BlockTorch extends Block { -+ -+ protected BlockTorch() { -+ super(Material.ORIENTABLE); -+ this.a(true); -+ this.a(CreativeModeTab.c); -+ } -+ -+ public AxisAlignedBB a(World world, int i, int j, int k) { -+ return null; -+ } -+ -+ public boolean c() { -+ return false; -+ } -+ -+ public boolean d() { -+ return false; -+ } -+ -+ public int b() { -+ return 2; -+ } -+ -+ private boolean m(World world, int i, int j, int k) { -+ if (World.a((IBlockAccess) world, i, j, k)) { -+ return true; -+ } else { -+ Block block = world.getType(i, j, k); -+ -+ return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; -+ } -+ } -+ -+ public boolean canPlace(World world, int i, int j, int k) { -+ return world.c(i - 1, j, k, true) ? true : (world.c(i + 1, j, k, true) ? true : (world.c(i, j, k - 1, true) ? true : (world.c(i, j, k + 1, true) ? true : this.m(world, i, j - 1, k)))); -+ } -+ -+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) { -+ int j1 = i1; -+ -+ if (l == 1 && this.m(world, i, j - 1, k)) { -+ j1 = 5; ++ world.applyPhysics(blockposition, this); ++ world.applyPhysics(blockposition.down(), this); + } + -+ if (l == 2 && world.c(i, j, k + 1, true)) { -+ j1 = 4; -+ } -+ -+ if (l == 3 && world.c(i, j, k - 1, true)) { -+ j1 = 3; -+ } -+ -+ if (l == 4 && world.c(i + 1, j, k, true)) { -+ j1 = 2; -+ } -+ -+ if (l == 5 && world.c(i - 1, j, k, true)) { -+ j1 = 1; -+ } -+ -+ return j1; + } + -+ public void a(World world, int i, int j, int k, Random random) { -+ super.a(world, i, j, k, random); -+ if (world.getData(i, j, k) == 0) { -+ this.onPlace(world, i, j, k); -+ } -+ } -+ -+ public void onPlace(World world, int i, int j, int k) { -+ if (world.getData(i, j, k) == 0) { -+ if (world.c(i - 1, j, k, true)) { -+ world.setData(i, j, k, 1, 2); -+ } else if (world.c(i + 1, j, k, true)) { -+ world.setData(i, j, k, 2, 2); -+ } else if (world.c(i, j, k - 1, true)) { -+ world.setData(i, j, k, 3, 2); -+ } else if (world.c(i, j, k + 1, true)) { -+ world.setData(i, j, k, 4, 2); -+ } else if (this.m(world, i, j - 1, k)) { -+ world.setData(i, j, k, 5, 2); -+ } -+ } -+ -+ this.e(world, i, j, k); -+ } -+ -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ this.b(world, i, j, k, block); -+ } -+ -+ protected boolean b(World world, int i, int j, int k, Block block) { -+ if (this.e(world, i, j, k)) { -+ int l = world.getData(i, j, k); -+ boolean flag = false; -+ -+ if (!world.c(i - 1, j, k, true) && l == 1) { -+ flag = true; -+ } -+ -+ if (!world.c(i + 1, j, k, true) && l == 2) { -+ flag = true; -+ } -+ -+ if (!world.c(i, j, k - 1, true) && l == 3) { -+ flag = true; -+ } -+ -+ if (!world.c(i, j, k + 1, true) && l == 4) { -+ flag = true; -+ } -+ -+ if (!this.m(world, i, j - 1, k) && l == 5) { -+ flag = true; -+ } -+ -+ if (flag) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ return true; -+ } else { -+ return false; -+ } -+ } else { -+ return true; -+ } -+ } -+ -+ protected boolean e(World world, int i, int j, int k) { -+ if (!this.canPlace(world, i, j, k)) { -+ if (world.getType(i, j, k) == this) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ } -+ -+ return false; -+ } else { -+ return true; -+ } -+ } -+ -+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { -+ int l = world.getData(i, j, k) & 7; -+ float f = 0.15F; -+ -+ if (l == 1) { -+ this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); -+ } else if (l == 2) { -+ this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); -+ } else if (l == 3) { -+ this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); -+ } else if (l == 4) { -+ this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); -+ } else { -+ f = 0.1F; -+ this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); -+ } -+ -+ return super.a(world, i, j, k, vec3d, vec3d1); -+ } ++ public abstract IBlockState l(); +} diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java new file mode 100644 @@ -338,94 +140,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +public class MobEffectAttackDamage extends MobEffectList { + -+ protected MobEffectAttackDamage(int i, boolean flag, int j) { -+ super(i, flag, j); ++ protected MobEffectAttackDamage(int i, MinecraftKey minecraftkey, boolean flag, int j) { ++ super(i, minecraftkey, flag, j); + } + + public double a(int i, AttributeModifier attributemodifier) { + return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); + } +} -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class RandomPositionGenerator { -+ -+ private static Vec3D a = Vec3D.a(0.0D, 0.0D, 0.0D); -+ -+ public static Vec3D a(EntityCreature entitycreature, int i, int j) { -+ return c(entitycreature, i, j, (Vec3D) null); -+ } -+ -+ public static Vec3D a(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ a.a = vec3d.a - entitycreature.locX; -+ a.b = vec3d.b - entitycreature.locY; -+ a.c = vec3d.c - entitycreature.locZ; -+ return c(entitycreature, i, j, a); -+ } -+ -+ public static Vec3D b(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ a.a = entitycreature.locX - vec3d.a; -+ a.b = entitycreature.locY - vec3d.b; -+ a.c = entitycreature.locZ - vec3d.c; -+ return c(entitycreature, i, j, a); -+ } -+ -+ private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ Random random = entitycreature.aI(); -+ boolean flag = false; -+ int k = 0; -+ int l = 0; -+ int i1 = 0; -+ float f = -99999.0F; -+ boolean flag1; -+ -+ if (entitycreature.bY()) { -+ double d0 = (double) (entitycreature.bV().e(MathHelper.floor(entitycreature.locX), MathHelper.floor(entitycreature.locY), MathHelper.floor(entitycreature.locZ)) + 4.0F); -+ double d1 = (double) (entitycreature.bW() + (float) i); -+ -+ flag1 = d0 < d1 * d1; -+ } else { -+ flag1 = false; -+ } -+ -+ for (int j1 = 0; j1 < 10; ++j1) { -+ int k1 = random.nextInt(2 * i) - i; -+ int l1 = random.nextInt(2 * j) - j; -+ int i2 = random.nextInt(2 * i) - i; -+ -+ if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) { -+ k1 += MathHelper.floor(entitycreature.locX); -+ l1 += MathHelper.floor(entitycreature.locY); -+ i2 += MathHelper.floor(entitycreature.locZ); -+ if (!flag1 || entitycreature.b(k1, l1, i2)) { -+ float f1 = entitycreature.a(k1, l1, i2); -+ -+ if (f1 > f) { -+ f = f1; -+ k = k1; -+ l = l1; -+ i1 = i2; -+ flag = true; -+ } -+ } -+ } -+ } -+ -+ if (flag) { -+ return Vec3D.a((double) k, (double) l, (double) i1); -+ } else { -+ return null; -+ } -+ } -+} diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -434,36 +156,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class TileEntityEnderChest extends TileEntity { ++public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { + + public float a; -+ public float i; -+ public int j; -+ private int k; ++ public float f; ++ public int g; ++ private int h; + + public TileEntityEnderChest() {} + -+ public void h() { -+ super.h(); -+ if (++this.k % 20 * 4 == 0) { -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ public void c() { ++ if (++this.h % 20 * 4 == 0) { ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + -+ this.i = this.a; ++ this.f = this.a; ++ int i = this.position.getX(); ++ int j = this.position.getY(); ++ int k = this.position.getZ(); + float f = 0.1F; + double d0; + -+ if (this.j > 0 && this.a == 0.0F) { -+ double d1 = (double) this.x + 0.5D; ++ if (this.g > 0 && this.a == 0.0F) { ++ double d1 = (double) i + 0.5D; + -+ d0 = (double) this.z + 0.5D; -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ d0 = (double) k + 0.5D; ++ this.world.makeSound(d1, (double) j + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + -+ if (this.j == 0 && this.a > 0.0F || this.j > 0 && this.a < 1.0F) { ++ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { + float f1 = this.a; + -+ if (this.j > 0) { ++ if (this.g > 0) { + this.a += f; + } else { + this.a -= f; @@ -476,44 +200,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + float f2 = 0.5F; + + if (this.a < f2 && f1 >= f2) { -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; ++ d0 = (double) i + 0.5D; ++ double d2 = (double) k + 0.5D; + -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.world.makeSound(d0, (double) j + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + + if (this.a < 0.0F) { + this.a = 0.0F; + } + } ++ + } + + public boolean c(int i, int j) { + if (i == 1) { -+ this.j = j; ++ this.g = j; + return true; + } else { + return super.c(i, j); + } + } + -+ public void s() { -+ this.u(); -+ super.s(); -+ } -+ -+ public void a() { -+ ++this.j; -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ public void y() { ++ this.E(); ++ super.y(); + } + + public void b() { -+ --this.j; -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ ++this.g; ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); ++ } ++ ++ public void d() { ++ --this.g; ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + + public boolean a(EntityHuman entityhuman) { -+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; ++ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; + } +} diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java @@ -524,17 +249,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+public class TileEntityLightDetector extends TileEntity { ++public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox { + + public TileEntityLightDetector() {} + -+ public void h() { ++ public void c() { + if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) { -+ this.h = this.q(); -+ if (this.h instanceof BlockDaylightDetector) { -+ ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z); ++ this.e = this.w(); ++ if (this.e instanceof BlockDaylightDetector) { ++ ((BlockDaylightDetector) this.e).d(this.world, this.position); + } + } ++ + } +} -- \ No newline at end of file diff --git a/applyPatches.sh b/applyPatches.sh index df1518c3fc..fa5c3d0e08 100755 --- a/applyPatches.sh +++ b/applyPatches.sh @@ -8,6 +8,8 @@ function applyPatch { what=$1 target=$2 cd "$basedir/$what" + git fetch + git reset --hard origin/patched git branch -f upstream >/dev/null cd "$basedir" @@ -33,6 +35,7 @@ function applyPatch { echo " Patches applied cleanly to $target" fi } + echo echo "Applying SpigotMC patches to CraftBukkit and Bukkit" echo @@ -40,4 +43,4 @@ applyPatch Bukkit Spigot-API && applyPatch CraftBukkit Spigot-Server echo echo "Applying PaperSpigot patches to Spigot-Server and Spigot-API" echo -applyPatch Spigot-API PaperSpigot-API && applyPatch Spigot-Server PaperSpigot-Server \ No newline at end of file +applyPatch Spigot-API PaperSpigot-API && applyPatch Spigot-Server PaperSpigot-Server diff --git a/pom.xml b/pom.xml index e6529e2c66..807e4a8db8 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,6 @@ https://github.com/PaperSpigot/Spigot - MinecraftServer - MinecraftRelocate PaperSpigot-Server PaperSpigot-API