From 2124e746b7eace1d5dc0a3ee6bf8a3197e681acc Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 28 Jan 2013 09:46:19 +1100 Subject: [PATCH] 10 years later... --- CraftBukkit-Patches/0001-Spigot-changes.patch | 40 +++++++++---------- .../0004-Update-item-merge-logic.patch | 8 ++-- ...-crop-growth-modifier-formula-issues.patch | 8 ++-- ...-free-but-safe-chunk-reference-cache.patch | 6 +-- ...Add-Custom-Timings-to-various-points.patch | 16 ++++---- ...tter-more-flexible-itemstack-merging.patch | 8 ++-- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/CraftBukkit-Patches/0001-Spigot-changes.patch b/CraftBukkit-Patches/0001-Spigot-changes.patch index 1bd96d44fa..73db77496b 100644 --- a/CraftBukkit-Patches/0001-Spigot-changes.patch +++ b/CraftBukkit-Patches/0001-Spigot-changes.patch @@ -1,4 +1,4 @@ -From 773d5d2e6c47548c120cb5c33619964136a384e5 Mon Sep 17 00:00:00 2001 +From 1f766e4a465e4eed65061fd7a908ea22e8c0d6fa Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 22 Jan 2013 15:56:54 +1100 Subject: [PATCH] Spigot changes. @@ -163,13 +163,13 @@ index 79a007c..0bc7882 100644 int j1 = j + random.nextInt(5) - 3; int k1 = k + random.nextInt(3) - 1; diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java -index 38fac4c..4ff3111 100644 +index db90874..9647bb2 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java -@@ -23,7 +23,7 @@ public class BlockMushroom extends BlockFlower { - } +@@ -24,7 +24,7 @@ public class BlockMushroom extends BlockFlower { public void b(World world, int i, int j, int k, Random random) { + final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit - if (random.nextInt(25) == 0) { + if (random.nextInt((int) (world.growthOdds * 100 / world.getWorld().mushroomGrowthModifier * 25)) == 0) { // Spigot byte b0 = 4; @@ -714,10 +714,10 @@ index 0686ba0..58d30eb 100644 URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e2fd0df..5a01944 100644 +index c3dc4a4..9906b9e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -64,7 +64,7 @@ public abstract class World implements IBlockAccess { +@@ -65,7 +65,7 @@ public abstract class World implements IBlockAccess { // CraftBukkit start - public, longhashset public boolean allowMonsters = true; public boolean allowAnimals = true; @@ -726,7 +726,7 @@ index e2fd0df..5a01944 100644 public long ticksPerAnimalSpawns; public long ticksPerMonsterSpawns; // CraftBukkit end -@@ -72,7 +72,20 @@ public abstract class World implements IBlockAccess { +@@ -73,7 +73,20 @@ public abstract class World implements IBlockAccess { int[] H; private List O; public boolean isStatic; @@ -747,7 +747,7 @@ index e2fd0df..5a01944 100644 public BiomeBase getBiome(int i, int j) { if (this.isLoaded(i, 0, j)) { Chunk chunk = this.getChunkAtWorldCoords(i, j); -@@ -98,6 +111,7 @@ public abstract class World implements IBlockAccess { +@@ -99,6 +112,7 @@ public abstract class World implements IBlockAccess { int lastXAccessed = Integer.MIN_VALUE; int lastZAccessed = Integer.MIN_VALUE; final Object chunkLock = new Object(); @@ -755,7 +755,7 @@ index e2fd0df..5a01944 100644 public CraftWorld getWorld() { return this.world; -@@ -110,11 +124,18 @@ public abstract class World implements IBlockAccess { +@@ -111,11 +125,18 @@ public abstract class World implements IBlockAccess { // Changed signature public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { this.generator = gen; @@ -774,7 +774,7 @@ index e2fd0df..5a01944 100644 this.N = this.random.nextInt(12000); this.H = new int['\u8000']; this.O = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList -@@ -122,7 +143,7 @@ public abstract class World implements IBlockAccess { +@@ -123,7 +144,7 @@ public abstract class World implements IBlockAccess { this.dataManager = idatamanager; this.methodProfiler = methodprofiler; this.worldMaps = new WorldMapCollection(idatamanager); @@ -783,7 +783,7 @@ index e2fd0df..5a01944 100644 if (worldprovider != null) { this.worldProvider = worldprovider; } else if (this.worldData != null && this.worldData.j() != 0) { -@@ -903,6 +924,47 @@ public abstract class World implements IBlockAccess { +@@ -901,6 +922,47 @@ public abstract class World implements IBlockAccess { event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason); } else if (entity instanceof EntityItem) { event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity); @@ -831,7 +831,7 @@ index e2fd0df..5a01944 100644 } else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Projectile) { // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead event = CraftEventFactory.callProjectileLaunchEvent(entity); -@@ -995,6 +1057,39 @@ public abstract class World implements IBlockAccess { +@@ -993,6 +1055,39 @@ public abstract class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); @@ -871,7 +871,7 @@ index e2fd0df..5a01944 100644 for (int k1 = i; k1 < j; ++k1) { for (int l1 = i1; l1 < j1; ++l1) { if (this.isLoaded(k1, 64, l1)) { -@@ -1008,6 +1103,7 @@ public abstract class World implements IBlockAccess { +@@ -1006,6 +1101,7 @@ public abstract class World implements IBlockAccess { } } } @@ -879,7 +879,7 @@ index e2fd0df..5a01944 100644 double d0 = 0.25D; List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); -@@ -1315,7 +1411,37 @@ public abstract class World implements IBlockAccess { +@@ -1313,7 +1409,37 @@ public abstract class World implements IBlockAccess { this.entityJoinedWorld(entity, true); } @@ -918,7 +918,7 @@ index e2fd0df..5a01944 100644 int i = MathHelper.floor(entity.locX); int j = MathHelper.floor(entity.locZ); byte b0 = 32; -@@ -1896,6 +2022,11 @@ public abstract class World implements IBlockAccess { +@@ -1894,6 +2020,11 @@ public abstract class World implements IBlockAccess { this.worldData.setWeatherDuration(1); } @@ -930,7 +930,7 @@ index e2fd0df..5a01944 100644 protected void z() { // this.chunkTickList.clear(); // CraftBukkit - removed this.methodProfiler.a("buildList"); -@@ -1905,25 +2036,42 @@ public abstract class World implements IBlockAccess { +@@ -1903,25 +2034,42 @@ public abstract class World implements IBlockAccess { int j; int k; @@ -987,7 +987,7 @@ index e2fd0df..5a01944 100644 this.methodProfiler.b(); if (this.N > 0) { -@@ -1931,7 +2079,7 @@ public abstract class World implements IBlockAccess { +@@ -1929,7 +2077,7 @@ public abstract class World implements IBlockAccess { } this.methodProfiler.a("playerCheckLight"); @@ -996,7 +996,7 @@ index e2fd0df..5a01944 100644 i = this.random.nextInt(this.players.size()); entityhuman = (EntityHuman) this.players.get(i); j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; -@@ -1970,9 +2118,16 @@ public abstract class World implements IBlockAccess { +@@ -1968,9 +2116,16 @@ public abstract class World implements IBlockAccess { chunk.o(); } @@ -1013,7 +1013,7 @@ index e2fd0df..5a01944 100644 public boolean w(int i, int j, int k) { return this.c(i, j, k, false); -@@ -2310,7 +2465,10 @@ public abstract class World implements IBlockAccess { +@@ -2308,7 +2463,10 @@ public abstract class World implements IBlockAccess { } public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) { @@ -1025,7 +1025,7 @@ index e2fd0df..5a01944 100644 int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D); int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D); -@@ -2319,12 +2477,12 @@ public abstract class World implements IBlockAccess { +@@ -2317,12 +2475,12 @@ public abstract class World implements IBlockAccess { for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.isChunkLoaded(i1, j1)) { diff --git a/CraftBukkit-Patches/0004-Update-item-merge-logic.patch b/CraftBukkit-Patches/0004-Update-item-merge-logic.patch index d9d4738783..3ac359f137 100644 --- a/CraftBukkit-Patches/0004-Update-item-merge-logic.patch +++ b/CraftBukkit-Patches/0004-Update-item-merge-logic.patch @@ -1,4 +1,4 @@ -From 41511c81fdae75c5daa04dca85051ddfa83a1b0c Mon Sep 17 00:00:00 2001 +From 5c745b48d2a4917947844408f63a581d5f626fb0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 23 Dec 2012 17:51:07 +1100 Subject: [PATCH] Update item merge logic @@ -8,10 +8,10 @@ Subject: [PATCH] Update item merge logic 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 5a01944..28ce1d7 100644 +index 9906b9e..1e36467 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -926,6 +926,7 @@ public abstract class World implements IBlockAccess { +@@ -924,6 +924,7 @@ public abstract class World implements IBlockAccess { event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity); // Spigot start ItemStack item = ((EntityItem) entity).getItemStack(); @@ -19,7 +19,7 @@ index 5a01944..28ce1d7 100644 int maxSize = item.getMaxStackSize(); if (item.count < maxSize) { double radius = this.getWorld().itemMergeRadius; -@@ -935,14 +936,12 @@ public abstract class World implements IBlockAccess { +@@ -933,14 +934,12 @@ public abstract class World implements IBlockAccess { if (e instanceof EntityItem) { EntityItem loopItem = (EntityItem) e; ItemStack loopStack = loopItem.getItemStack(); diff --git a/CraftBukkit-Patches/0010-Fix-various-crop-growth-modifier-formula-issues.patch b/CraftBukkit-Patches/0010-Fix-various-crop-growth-modifier-formula-issues.patch index edb0eb3b75..0da1275026 100644 --- a/CraftBukkit-Patches/0010-Fix-various-crop-growth-modifier-formula-issues.patch +++ b/CraftBukkit-Patches/0010-Fix-various-crop-growth-modifier-formula-issues.patch @@ -1,4 +1,4 @@ -From 383d4ee7388ec2e58dee08aa2338746459f82d15 Mon Sep 17 00:00:00 2001 +From 25d363d1f0fdc54987a6d6bc6f06eb53c6129637 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 11 Jan 2013 11:08:45 -0500 Subject: [PATCH] Fix various crop growth modifier formula issues @@ -55,13 +55,13 @@ index 0bc7882..bf117bc 100644 int j1 = j + random.nextInt(5) - 3; int k1 = k + random.nextInt(3) - 1; diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java -index 8fa8302..a172ba2 100644 +index 9647bb2..ffe9778 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java -@@ -23,7 +23,7 @@ public class BlockMushroom extends BlockFlower { - } +@@ -24,7 +24,7 @@ public class BlockMushroom extends BlockFlower { public void b(World world, int i, int j, int k, Random random) { + final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit - if (random.nextInt((int) (world.growthOdds * 100 / world.getWorld().mushroomGrowthModifier * 25)) == 0) { // Spigot + if (random.nextInt(Math.max(1, (int) world.growthOdds / world.getWorld().mushroomGrowthModifier * 25)) == 0) { // Spigot byte b0 = 4; diff --git a/CraftBukkit-Patches/0018-Alternate-sync-free-but-safe-chunk-reference-cache.patch b/CraftBukkit-Patches/0018-Alternate-sync-free-but-safe-chunk-reference-cache.patch index 0ed66efec5..73d36b51be 100644 --- a/CraftBukkit-Patches/0018-Alternate-sync-free-but-safe-chunk-reference-cache.patch +++ b/CraftBukkit-Patches/0018-Alternate-sync-free-but-safe-chunk-reference-cache.patch @@ -1,4 +1,4 @@ -From d1e42f45b53d9af605000319340b2a160e205e35 Mon Sep 17 00:00:00 2001 +From 3b1fe146746b93011b0a7bab56281160f6461cd1 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 16 Jan 2013 15:27:22 -0600 Subject: [PATCH] Alternate, sync-free-but-safe chunk reference cache @@ -8,10 +8,10 @@ Subject: [PATCH] Alternate, sync-free-but-safe chunk reference cache 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 28ce1d7..39e6110 100644 +index 1e36467..e2426bc 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -296,15 +296,13 @@ public abstract class World implements IBlockAccess { +@@ -297,15 +297,13 @@ public abstract class World implements IBlockAccess { // CraftBukkit start public Chunk getChunkAt(int i, int j) { diff --git a/CraftBukkit-Patches/0019-Add-Custom-Timings-to-various-points.patch b/CraftBukkit-Patches/0019-Add-Custom-Timings-to-various-points.patch index 16eb0bb972..29dbe3c543 100644 --- a/CraftBukkit-Patches/0019-Add-Custom-Timings-to-various-points.patch +++ b/CraftBukkit-Patches/0019-Add-Custom-Timings-to-various-points.patch @@ -1,4 +1,4 @@ -From 5cfd2fa15e41201cc36959046d6a1c5ac860b265 Mon Sep 17 00:00:00 2001 +From 8de0c8dfd462f4023fb85beb91afe4cf33d7ab30 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Add Custom Timings to various points @@ -210,7 +210,7 @@ index 43a24f5..7ca0acf 100644 /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 39e6110..46e8d11 100644 +index e2426bc..9b7bc02 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -14,6 +14,7 @@ import java.util.concurrent.Callable; @@ -221,7 +221,7 @@ index 39e6110..46e8d11 100644 import org.bukkit.generator.ChunkGenerator; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; -@@ -113,6 +114,7 @@ public abstract class World implements IBlockAccess { +@@ -114,6 +115,7 @@ public abstract class World implements IBlockAccess { final Object chunkLock = new Object(); private byte chunkTickRadius; @@ -229,7 +229,7 @@ index 39e6110..46e8d11 100644 public CraftWorld getWorld() { return this.world; } -@@ -192,6 +194,7 @@ public abstract class World implements IBlockAccess { +@@ -193,6 +195,7 @@ public abstract class World implements IBlockAccess { this.a(); this.getServer().addWorld(this.world); // CraftBukkit @@ -237,7 +237,7 @@ index 39e6110..46e8d11 100644 } protected abstract IChunkProvider j(); -@@ -1206,6 +1209,7 @@ public abstract class World implements IBlockAccess { +@@ -1204,6 +1207,7 @@ public abstract class World implements IBlockAccess { CrashReport crashreport; CrashReportSystemDetails crashreportsystemdetails; @@ -245,7 +245,7 @@ index 39e6110..46e8d11 100644 for (i = 0; i < this.i.size(); ++i) { entity = (Entity) this.i.get(i); // CraftBukkit start - fixed an NPE, don't process entities in chunks queued for unload -@@ -1260,7 +1264,9 @@ public abstract class World implements IBlockAccess { +@@ -1258,7 +1262,9 @@ public abstract class World implements IBlockAccess { this.f.clear(); this.methodProfiler.c("regular"); @@ -255,7 +255,7 @@ index 39e6110..46e8d11 100644 for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); -@@ -1313,7 +1319,9 @@ public abstract class World implements IBlockAccess { +@@ -1311,7 +1317,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); } @@ -265,7 +265,7 @@ index 39e6110..46e8d11 100644 this.M = true; Iterator iterator = this.tileEntityList.iterator(); -@@ -1392,6 +1400,7 @@ public abstract class World implements IBlockAccess { +@@ -1390,6 +1398,7 @@ public abstract class World implements IBlockAccess { this.a.clear(); } diff --git a/CraftBukkit-Patches/0020-Better-more-flexible-itemstack-merging.patch b/CraftBukkit-Patches/0020-Better-more-flexible-itemstack-merging.patch index 22b0f46c42..18be194e60 100644 --- a/CraftBukkit-Patches/0020-Better-more-flexible-itemstack-merging.patch +++ b/CraftBukkit-Patches/0020-Better-more-flexible-itemstack-merging.patch @@ -1,4 +1,4 @@ -From 91a71bd3c047776b164cd9e6cd205cbd9519adb6 Mon Sep 17 00:00:00 2001 +From 36b9793a096db8f3a5f726b8792ddd1315a88081 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 25 Jan 2013 18:24:54 +1100 Subject: [PATCH] Better + more flexible itemstack merging @@ -40,10 +40,10 @@ index a7baa0f..5e3ac84 100644 } } else { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 46e8d11..b300766 100644 +index 9b7bc02..262290f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -925,31 +925,8 @@ public abstract class World implements IBlockAccess { +@@ -923,31 +923,8 @@ public abstract class World implements IBlockAccess { event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason); } else if (entity instanceof EntityItem) { event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity); @@ -77,7 +77,7 @@ index 46e8d11..b300766 100644 EntityExperienceOrb xp = (EntityExperienceOrb) entity; double radius = this.getWorld().expMergeRadius; if (radius > 0) { -@@ -964,8 +941,8 @@ public abstract class World implements IBlockAccess { +@@ -962,8 +939,8 @@ public abstract class World implements IBlockAccess { } } }