From 067458bdc0f0d050e59b9881313e6557c7728937 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 21 Oct 2012 10:21:39 -0700 Subject: [PATCH] Patches removing forge spawn protection, now a vanilla feature. --- .../minecraft/src/NetServerHandler.java.patch | 20 ++++----- .../minecraft/src/IntegratedServer.java.patch | 42 ++++++++----------- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/patches/common/net/minecraft/src/NetServerHandler.java.patch b/patches/common/net/minecraft/src/NetServerHandler.java.patch index 2f931547f..10666f859 100644 --- a/patches/common/net/minecraft/src/NetServerHandler.java.patch +++ b/patches/common/net/minecraft/src/NetServerHandler.java.patch @@ -85,19 +85,15 @@ { return; } -@@ -417,8 +444,9 @@ - - if (par1Packet14BlockDig.status == 0) +@@ -419,6 +446,7 @@ { -- if (var20 <= 16 && !var3) -- { -+ if (var20 <= mcServer.spawnProtectionSize && !var3) -+ { + if (var20 <= this.mcServer.func_82357_ak() && !var3) + { + ForgeEventFactory.onPlayerInteract(playerEntity, Action.LEFT_CLICK_BLOCK, var5, var6, var7, 0); this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var5, var6, var7, var2)); } else -@@ -479,7 +507,11 @@ +@@ -477,7 +505,11 @@ return; } @@ -110,18 +106,18 @@ } else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) { -@@ -497,7 +529,9 @@ +@@ -495,7 +527,9 @@ var12 = var11; } -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && (var12 > 16 || var9)) +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && (var12 > this.mcServer.func_82357_ak() || var9)) + double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; + dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < dist && (var12 > mcServer.spawnProtectionSize || var9)) ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < dist && (var12 > this.mcServer.func_82357_ak() || var9)) { this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } -@@ -798,7 +832,7 @@ +@@ -794,7 +828,7 @@ return; } diff --git a/patches/minecraft/net/minecraft/src/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/src/IntegratedServer.java.patch index 9f89dc7d6..78a8f2c7f 100644 --- a/patches/minecraft/net/minecraft/src/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/src/IntegratedServer.java.patch @@ -10,52 +10,52 @@ @SideOnly(Side.CLIENT) public class IntegratedServer extends MinecraftServer -@@ -48,44 +51,21 @@ - protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType) +@@ -48,44 +51,22 @@ + protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); - this.worldServers = new WorldServer[3]; - this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler var6 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); + ISaveHandler var7 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); -- for (int var7 = 0; var7 < this.worldServers.length; ++var7) +- for (int var8 = 0; var8 < this.worldServers.length; ++var8) - { -- byte var8 = 0; +- byte var9 = 0; - -- if (var7 == 1) -+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var6, par2Str, 0, theProfiler) : new WorldServer(this, var6, par2Str, 0, theWorldSettings, theProfiler)); +- if (var8 == 1) ++ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var7, par2Str, 0, theProfiler) : new WorldServer(this, var7, par2Str, 0, theWorldSettings, theProfiler)); + for (int dim : DimensionManager.getStaticDimensionIDs()) + { -+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, theWorldSettings, overWorld, theProfiler)); ++ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var7, par2Str, dim, theWorldSettings, overWorld, theProfiler)); + world.addWorldAccess(new WorldManager(this, world)); + if (!this.isSinglePlayer()) { -- var8 = -1; +- var9 = -1; + world.getWorldInfo().setGameType(this.getGameType()); } -- -- if (var7 == 2) + +- if (var8 == 2) - { -- var8 = 1; +- var9 = 1; - } - -- if (var7 == 0) +- if (var8 == 0) - { - if (this.isDemo()) - { -- this.worldServers[var7] = new DemoWorldServer(this, var6, par2Str, var8, this.theProfiler); +- this.worldServers[var8] = new DemoWorldServer(this, var7, par2Str, var9, this.theProfiler); - } - else - { -- this.worldServers[var7] = new WorldServer(this, var6, par2Str, var8, this.theWorldSettings, this.theProfiler); +- this.worldServers[var8] = new WorldServer(this, var7, par2Str, var9, this.theWorldSettings, this.theProfiler); - } - } - else - { -- this.worldServers[var7] = new WorldServerMulti(this, var6, par2Str, var8, this.theWorldSettings, this.worldServers[0], this.theProfiler); +- this.worldServers[var8] = new WorldServerMulti(this, var7, par2Str, var9, this.theWorldSettings, this.worldServers[0], this.theProfiler); - } - -- this.worldServers[var7].addWorldAccess(new WorldManager(this, this.worldServers[var7])); +- this.worldServers[var8].addWorldAccess(new WorldManager(this, this.worldServers[var8])); - this.getConfigurationManager().setPlayerManager(this.worldServers); - } - @@ -66,11 +66,3 @@ this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); } -@@ -106,6 +86,7 @@ - this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType()); - this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); - FMLCommonHandler.instance().handleServerStarting(this); -+ spawnProtectionSize = 0; - return true; - } -