diff --git a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch index 229f2ace09..6a6e8287df 100644 --- a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch @@ -1,4 +1,4 @@ -From 27be6c4e1c2e911cd92968c1a58b16e5ee7302a0 Mon Sep 17 00:00:00 2001 +From 31c2cbada240f1ffe7e4d5bee414fba7da33def0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:17:20 +1000 Subject: [PATCH] Crop Growth Rates @@ -26,22 +26,20 @@ index dca832f..ad4e3a2 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 421af04..5c7910d 100644 +index 421af04..183fb43 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -23,8 +23,8 @@ public class BlockCactus extends Block { +@@ -23,7 +23,7 @@ public class BlockCactus extends Block { if (l < 3) { int i1 = world.getData(i, j, k); - if (i1 == 15) { -- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit + if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit + org.bukkit.craftbukkit.event.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); - } else { diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index 942d6ab..ef670e8 100644 +index 942d6ab..c46879c 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java @@ -27,9 +27,8 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement @@ -52,7 +50,7 @@ index 942d6ab..ef670e8 100644 - ++l; - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit + if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, ++l); // CraftBukkit } } } @@ -98,27 +96,18 @@ index 6ac6d94..a401f65 100644 int j1 = j + random.nextInt(5) - 3; int k1 = k + random.nextInt(3) - 1; diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index a1350f6..246b951 100644 +index a1350f6..6c04ad2 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -24,12 +24,11 @@ public class BlockReed extends Block { +@@ -24,7 +24,7 @@ public class BlockReed extends Block { if (l < 3) { int i1 = world.getData(i, j, k); - if (i1 == 15) { -- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit -- world.setData(i, j, k, 0, 4); -- } else { -- world.setData(i, j, k, i1 + 1, 4); -- } -+ 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.id, 0); // CraftBukkit -+ world.setData(i, j, k, 0, 4); -+ } else { -+ world.setData(i, j, k, i1 + 1, 4); - } - } - } ++ 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 { diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 830eb65..24c95ef 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java @@ -133,7 +122,7 @@ index 830eb65..24c95ef 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index 4fae805..9c8e816 100644 +index 4fae805..a90fab1 100644 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java @@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { @@ -141,7 +130,7 @@ index 4fae805..9c8e816 100644 float f = this.n(world, i, j, k); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) (world.growthOdds / (this.id == Block.PUMPKIN_STEM.id ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot ++ 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); if (l < 7) { diff --git a/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch index 0fd3050874..01f44965ba 100644 --- a/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch +++ b/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch @@ -1,14 +1,14 @@ -From 4aa2e37f77d90bcae16a89d4aff9727bd4a1fcab Mon Sep 17 00:00:00 2001 +From 525c6917d05ab948ff62e430b5f383f6541fae9c Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 12:17:37 +1000 Subject: [PATCH] More Efficient GetCubes diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f0a8024..a8dbc44 100644 +index 9a2da15..7bf2225 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1015,16 +1015,42 @@ public abstract class World implements IBlockAccess { +@@ -1015,23 +1015,42 @@ public abstract class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); @@ -47,21 +47,15 @@ index f0a8024..a8dbc44 100644 + { + for ( int y = ystart; y < l; y++ ) + { -+ int blkid = chunk.getTypeId( x - cx, y, z - cz ); -+ if ( blkid > 0 ) ++ Block block = chunk.getType(x - cx, y, z - cz ); ++ if ( block != null ) + { -+ Block block = Block.byId[blkid]; -+ -+ if ( block != null ) -+ { -+ block.a( this, x, y, z, axisalignedbb, this.M, entity ); -+ // SPIGOT TODO: THIS DIFF -+ } ++ block.a( this, x, y, z, axisalignedbb, this.M, entity ); + } } - - block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); -@@ -1032,6 +1058,7 @@ public abstract class World implements IBlockAccess { +- +- block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); + } } } } diff --git a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch b/CraftBukkit-Patches/0011-Async-Operation-Catching.patch index b557ba05ad..69a75480a0 100644 --- a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0011-Async-Operation-Catching.patch @@ -1,4 +1,4 @@ -From d4776c8e08161059f62919e41423f47216e7db43 Mon Sep 17 00:00:00 2001 +From 2e44ad82193e6afedb8f43093e8c68eab962ef79 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 7 Mar 2013 20:12:46 +1100 Subject: [PATCH] Async Operation Catching @@ -6,7 +6,7 @@ Subject: [PATCH] Async Operation Catching Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index ad4e3a2..32f8c3f 100644 +index ad4e3a2..c063ca1 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -433,9 +433,13 @@ public class Block { @@ -19,7 +19,7 @@ index ad4e3a2..32f8c3f 100644 + } - 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, int l, int i1) { ++ public void remove(World world, int i, int j, int k, Block block, int l) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block remove!"); // Spigot + } @@ -66,7 +66,7 @@ index 9f818cf..8052ea6 100644 this.trackedPlayers.remove(entityplayer); entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId())); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c91ae63..967565b 100644 +index 3f9eb56..b21bff3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -896,6 +896,7 @@ public abstract class World implements IBlockAccess { @@ -85,7 +85,7 @@ index c91ae63..967565b 100644 entity.die(); if (entity instanceof EntityHuman) { this.players.remove(entity); -@@ -2398,6 +2400,7 @@ public abstract class World implements IBlockAccess { +@@ -2390,6 +2392,7 @@ public abstract class World implements IBlockAccess { } public void a(List list) { diff --git a/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch b/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch index d73bc19f35..3388f1cafe 100644 --- a/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch +++ b/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch @@ -1,11 +1,11 @@ -From 5778aaae32fd276df37a9941ec8c281431bd3803 Mon Sep 17 00:00:00 2001 +From ee9e6ca1ffb8d21f7ba22952c3949e15f3ab3ef3 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 16 Jan 2013 15:27:22 -0600 Subject: [PATCH] Sync Free Chunk Reference Cache diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 967565b..93c476c 100644 +index b21bff3..f7fa2fe 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -290,20 +290,18 @@ public abstract class World implements IBlockAccess { @@ -25,7 +25,7 @@ index 967565b..93c476c 100644 - result = this.lastChunkAccessed; + //synchronized (this.chunkLock) { + Chunk result = this.lastChunkAccessed; // Exploit fact that read is atomic -+ if (result == null || result.x != i || result.z != j) { ++ if (result == null || result.locX != i || result.locZ != j) { + result = this.chunkProvider.getOrCreateChunk(i, j); + this.lastChunkAccessed = result; // Exploit fact that write is atomic } diff --git a/CraftBukkit-Patches/0016-Improved-Timings-System.patch b/CraftBukkit-Patches/0016-Improved-Timings-System.patch index 469f3a9aaf..70fd08cd7b 100644 --- a/CraftBukkit-Patches/0016-Improved-Timings-System.patch +++ b/CraftBukkit-Patches/0016-Improved-Timings-System.patch @@ -1,4 +1,4 @@ -From 75e5b9146eb945a1f5418ebab5da804264db3067 Mon Sep 17 00:00:00 2001 +From ec7ff8fd9912318adb6bbb213fd478c7cde5f1ed Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Improved Timings System @@ -198,7 +198,7 @@ index 811f1a4..3de32fe 100644 private static Map i = new HashMap(); private static Map j = new HashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 93c476c..b1f294d 100644 +index f7fa2fe..4a9d48b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -13,6 +13,7 @@ import java.util.concurrent.Callable; @@ -226,7 +226,7 @@ index 93c476c..b1f294d 100644 } protected abstract IChunkProvider j(); -@@ -1250,6 +1254,7 @@ public abstract class World implements IBlockAccess { +@@ -1242,6 +1246,7 @@ public abstract class World implements IBlockAccess { this.f.clear(); this.methodProfiler.c("regular"); @@ -234,7 +234,7 @@ index 93c476c..b1f294d 100644 for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); -@@ -1272,7 +1277,9 @@ public abstract class World implements IBlockAccess { +@@ -1264,7 +1269,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); if (!entity.dead) { try { @@ -244,7 +244,7 @@ index 93c476c..b1f294d 100644 } catch (Throwable throwable1) { crashreport = CrashReport.a(throwable1, "Ticking entity"); crashreportsystemdetails = crashreport.a("Entity being ticked"); -@@ -1297,7 +1304,9 @@ public abstract class World implements IBlockAccess { +@@ -1289,7 +1296,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); } @@ -254,7 +254,7 @@ index 93c476c..b1f294d 100644 this.N = true; Iterator iterator = this.tileEntityList.iterator(); -@@ -1312,8 +1321,11 @@ public abstract class World implements IBlockAccess { +@@ -1304,8 +1313,11 @@ public abstract class World implements IBlockAccess { if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { try { @@ -266,7 +266,7 @@ index 93c476c..b1f294d 100644 crashreport = CrashReport.a(throwable2, "Ticking block entity"); crashreportsystemdetails = crashreport.a("Block entity being ticked"); tileentity.a(crashreportsystemdetails); -@@ -1333,6 +1345,8 @@ public abstract class World implements IBlockAccess { +@@ -1325,6 +1337,8 @@ public abstract class World implements IBlockAccess { } } @@ -275,7 +275,7 @@ index 93c476c..b1f294d 100644 this.N = false; if (!this.b.isEmpty()) { this.tileEntityList.removeAll(this.b); -@@ -1371,6 +1385,7 @@ public abstract class World implements IBlockAccess { +@@ -1363,6 +1377,7 @@ public abstract class World implements IBlockAccess { this.a.clear(); } @@ -283,7 +283,7 @@ index 93c476c..b1f294d 100644 this.methodProfiler.b(); this.methodProfiler.b(); } -@@ -1393,6 +1408,7 @@ public abstract class World implements IBlockAccess { +@@ -1385,6 +1400,7 @@ public abstract class World implements IBlockAccess { byte b0 = 32; if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) { @@ -291,7 +291,7 @@ index 93c476c..b1f294d 100644 entity.T = entity.locX; entity.U = entity.locY; entity.V = entity.locZ; -@@ -1454,6 +1470,7 @@ public abstract class World implements IBlockAccess { +@@ -1446,6 +1462,7 @@ public abstract class World implements IBlockAccess { entity.passenger = null; } } diff --git a/CraftBukkit-Patches/0017-Orebfuscator.patch b/CraftBukkit-Patches/0017-Orebfuscator.patch index 7feb23c5a9..93e982cd46 100644 --- a/CraftBukkit-Patches/0017-Orebfuscator.patch +++ b/CraftBukkit-Patches/0017-Orebfuscator.patch @@ -1,4 +1,4 @@ -From 9ab09589f7ca0433a1c6aac5b6f6cc847e82995d Mon Sep 17 00:00:00 2001 +From b6377ce207cad41a8ff913d19889573b70a245ff Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 16 May 2013 18:51:05 +1000 Subject: [PATCH] Orebfuscator @@ -103,7 +103,7 @@ index 3028404..e24d4b5 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b276a3d..57511c8 100644 +index 4a9d48b..7f8d224 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -464,6 +464,7 @@ public abstract class World implements IBlockAccess { @@ -116,7 +116,7 @@ index b276a3d..57511c8 100644 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 0000000..c165304 +index 0000000..6413ac0 --- /dev/null +++ b/src/main/java/org/spigotmc/AntiXray.java @@ -0,0 +1,204 @@ @@ -153,9 +153,9 @@ index 0000000..c165304 + // If we are obfuscating it + if ( obfuscateBlocks[i] ) + { -+ Block block = Block.byId[i]; ++ Block block = Block.e(i); + // Check it exists and is not a tile entity -+ if ( block != null && !block.t() /* isTileEntity */ ) ++ if ( block != null && !block.isTileEntity() ) + { + // Add it to the set of replacement blocks + blocks.add( (byte) i ); @@ -249,7 +249,7 @@ index 0000000..c165304 + { + case 1: + // Replace with stone -+ buffer[index] = (byte) Block.STONE.id; ++ buffer[index] = 1; + break; + case 2: + // Replace with random ore. @@ -278,10 +278,10 @@ index 0000000..c165304 + if ( world.isLoaded( x, y, z ) ) + { + // Get block id -+ int id = world.getTypeId( x, y, z ); ++ Block block = world.getType(x, y, z); + + // See if it needs update -+ if ( updateSelf && obfuscateBlocks[id] ) ++ if ( updateSelf && obfuscateBlocks[Block.b(block)] ) + { + // Send the update + world.notify( x, y, z ); @@ -314,7 +314,7 @@ index 0000000..c165304 + + private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) + { -+ return !Block.l( world.getTypeId( x, y, z ) ) /* isSolidBlock */ ++ return !world.getType(x, y, z).r() /* isSolidBlock */ + || ( radius > 0 + && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )