diff --git a/build.gradle b/build.gradle index 8655b0d..b23d78d 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ minecraft { group = 'net.minecraftforge' ext.mcVersion = "1.7.10" ext.cauldronVersion = "1" -ext.forgeVersion = "1370" +ext.forgeVersion = "1388" ext.bukkitVersion = "1" version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${bukkitVersion}.0" @@ -65,7 +65,7 @@ tasks.packageUniversal.manifest { 'Implementation-Vendor': 'Cauldron', 'Implementation-Title': 'Cauldron', 'Implementation-Version': 'git-Cauldron-Reloaded-'+project.version, - 'Forge-Version': '10.13.3.1370', + 'Forge-Version': '10.13.3.1388', 'Specification-Vendor': 'Bukkit Team', 'Specification-Title': 'Bukkit', 'Specification-Version': '1.7.10-R0.1-SNAPSHOT' diff --git a/patches/cpw/mods/fml/common/registry/EntityRegistry.java.patch b/patches/cpw/mods/fml/common/registry/EntityRegistry.java.patch index 5cf25ea..091b2fe 100644 --- a/patches/cpw/mods/fml/common/registry/EntityRegistry.java.patch +++ b/patches/cpw/mods/fml/common/registry/EntityRegistry.java.patch @@ -56,9 +56,9 @@ + if ((entityName.indexOf(".") + 1) < entityName.length()) + entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length()); + } -+ entityName.replace("entity", ""); ++ entityName = entityName.replace("entity", ""); + if (entityName.startsWith("ent")) -+ entityName.replace("ent", ""); ++ entityName = entityName.replace("ent", ""); + entityName = entityName.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric + if (activeModContainer != null) + modId = activeModContainer.getModId(); diff --git a/patches/cpw/mods/fml/common/registry/GameRegistry.java.patch b/patches/cpw/mods/fml/common/registry/GameRegistry.java.patch index 541f43a..5f73669 100644 --- a/patches/cpw/mods/fml/common/registry/GameRegistry.java.patch +++ b/patches/cpw/mods/fml/common/registry/GameRegistry.java.patch @@ -27,7 +27,7 @@ + // Cauldron start - mod id's are not available during generateWorld so we must capture them here + String modId = Loader.instance().activeModContainer().getModId(); + modId = modId.replaceAll("[^A-Za-z0-9]", ""); // remove all non-digits/alphanumeric -+ modId.replace(" ", "_"); ++ modId = modId.replace(" ", "_"); worldGenerators.add(generator); worldGeneratorIndex.put(generator, modGenerationWeight); if (sortedGeneratorList != null) diff --git a/patches/net/minecraft/block/BlockFarmland.java.patch b/patches/net/minecraft/block/BlockFarmland.java.patch index d548dc6..57ee0dd 100644 --- a/patches/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/net/minecraft/block/BlockFarmland.java.patch @@ -40,7 +40,7 @@ + { + cancellable = CraftEventFactory.callPlayerInteractEvent((EntityPlayer) p_149746_5_, org.bukkit.event.block.Action.PHYSICAL, p_149746_2_, p_149746_3_, p_149746_4_, -1, null); + } -+ else if (p_149746_1_ != null && p_149746_1_.getWorld() != null && p_149746_5_ != null) ++ else if (p_149746_1_.getWorld() != null && p_149746_5_ != null) + { + cancellable = new EntityInteractEvent(p_149746_5_.getBukkitEntity(), p_149746_1_.getWorld().getBlockAt(p_149746_2_, p_149746_3_, p_149746_4_)); + p_149746_1_.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable); diff --git a/patches/net/minecraft/item/ItemHangingEntity.java.patch b/patches/net/minecraft/item/ItemHangingEntity.java.patch index 284e620..8f7cd31 100644 --- a/patches/net/minecraft/item/ItemHangingEntity.java.patch +++ b/patches/net/minecraft/item/ItemHangingEntity.java.patch @@ -18,7 +18,7 @@ if (!p_77648_3_.isRemote) { + // CraftBukkit start -+ Player who = (p_77648_2_ == null) ? null : (Player) p_77648_2_.getBukkitEntity(); ++ Player who = (Player) p_77648_2_.getBukkitEntity(); + org.bukkit.block.Block blockClicked = p_77648_3_.getWorld().getBlockAt(p_77648_4_, p_77648_5_, p_77648_6_); + org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(p_77648_7_); + HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityhanging.getBukkitEntity(), who, blockClicked, blockFace); diff --git a/patches/net/minecraft/item/ItemMap.java.patch b/patches/net/minecraft/item/ItemMap.java.patch index fc882d1..2a9aaee 100644 --- a/patches/net/minecraft/item/ItemMap.java.patch +++ b/patches/net/minecraft/item/ItemMap.java.patch @@ -12,7 +12,12 @@ public class ItemMap extends ItemMapBase { private static final String __OBFID = "CL_00000047"; -@@ -60,6 +65,10 @@ +@@ -56,10 +61,14 @@ + mapdata.scale = 3; + int i = 128 * (1 << mapdata.scale); + mapdata.xCenter = Math.round((float)p_77873_2_.getWorldInfo().getSpawnX() / (float)i) * i; +- mapdata.zCenter = Math.round((float)(p_77873_2_.getWorldInfo().getSpawnZ() / i)) * i; ++ mapdata.zCenter = Math.round((float) p_77873_2_.getWorldInfo().getSpawnZ() / (float)i) * i; mapdata.dimension = p_77873_2_.provider.dimensionId; mapdata.markDirty(); p_77873_2_.setItemData(s, mapdata); diff --git a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch index a4cd406..968d519 100644 --- a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -231,7 +231,7 @@ WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); this.field_147366_g = true; -@@ -199,8 +323,78 @@ +@@ -199,8 +323,70 @@ } } @@ -268,40 +268,32 @@ + this.lastYaw = to.getYaw(); + this.lastPitch = to.getPitch(); + -+ // Skip the first time we do this -+ if (hasMoved) // Spigot - Better Check! ++ PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); ++ this.server.getPluginManager().callEvent(event); ++ ++ // If the event is cancelled we move the player back to their old location. ++ if (event.isCancelled()) + { -+ PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); -+ this.server.getPluginManager().callEvent(event); -+ -+ // If the event is cancelled we move the player back to their old location. -+ if (event.isCancelled()) -+ { -+ this.playerEntity.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(from.getX(), from.getY() + 1.6200000047683716D, from -+ .getZ(), from.getYaw(), from.getPitch(), false)); -+ return; -+ } -+ -+ /* If a Plugin has changed the To destination then we teleport the Player -+ there to avoid any 'Moved wrongly' or 'Moved too quickly' errors. -+ We only do this if the Event was not cancelled. */ -+ if (!to.equals(event.getTo()) && !event.isCancelled()) -+ { -+ this.playerEntity.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); -+ return; -+ } -+ -+ /* Check to see if the Players Location has some how changed during the call of the event. -+ This can happen due to a plugin teleporting the player instead of using .setTo() */ -+ if (!from.equals(this.getPlayerB().getLocation()) && this.justTeleported) -+ { -+ this.justTeleported = false; -+ return; -+ } ++ this.playerEntity.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(from.getX(), from.getY() + 1.6200000047683716D, from ++ .getZ(), from.getYaw(), from.getPitch(), false)); ++ return; + } -+ else ++ ++ /* If a Plugin has changed the To destination then we teleport the Player ++ there to avoid any 'Moved wrongly' or 'Moved too quickly' errors. ++ We only do this if the Event was not cancelled. */ ++ if (!to.equals(event.getTo()) && !event.isCancelled()) + { -+ hasMoved = true; // Spigot - Better Check! ++ this.playerEntity.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); ++ return; ++ } ++ ++ /* Check to see if the Players Location has some how changed during the call of the event. ++ This can happen due to a plugin teleporting the player instead of using .setTo() */ ++ if (!from.equals(this.getPlayerB().getLocation()) && this.justTeleported) ++ { ++ this.justTeleported = false; ++ return; + } + } + @@ -311,7 +303,7 @@ double d1; double d2; double d3; -@@ -280,13 +474,6 @@ +@@ -280,13 +466,6 @@ d3 = p_147347_1_.func_149472_e(); d4 = p_147347_1_.func_149471_f() - p_147347_1_.func_149467_d(); @@ -325,7 +317,7 @@ if (Math.abs(p_147347_1_.func_149464_c()) > 3.2E7D || Math.abs(p_147347_1_.func_149472_e()) > 3.2E7D) { this.kickPlayerFromServer("Illegal position"); -@@ -318,7 +505,7 @@ +@@ -318,7 +497,7 @@ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); double d10 = d7 * d7 + d8 * d8 + d9 * d9; @@ -334,7 +326,7 @@ { logger.warn(this.playerEntity.getCommandSenderName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")"); this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); -@@ -413,21 +600,85 @@ +@@ -413,21 +592,85 @@ public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_) { @@ -425,7 +417,7 @@ this.playerEntity.dropOneItem(false); } else if (p_147345_1_.func_149506_g() == 3) -@@ -490,7 +741,17 @@ +@@ -490,7 +733,17 @@ } else { @@ -443,7 +435,7 @@ } } else if (p_147345_1_.func_149506_g() == 2) -@@ -517,6 +778,34 @@ +@@ -517,6 +770,34 @@ public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement p_147346_1_) { WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); @@ -478,7 +470,7 @@ ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); boolean flag = false; boolean placeResult = true; -@@ -533,11 +822,21 @@ +@@ -533,11 +814,21 @@ return; } @@ -502,7 +494,7 @@ } else if (p_147346_1_.func_149571_d() >= this.serverController.getBuildLimit() - 1 && (p_147346_1_.func_149568_f() == 1 || p_147346_1_.func_149571_d() >= this.serverController.getBuildLimit())) { -@@ -548,17 +847,24 @@ +@@ -548,17 +839,24 @@ } else { @@ -535,7 +527,7 @@ flag = true; } -@@ -615,7 +921,7 @@ +@@ -615,7 +913,7 @@ this.playerEntity.openContainer.detectAndSendChanges(); this.playerEntity.isChangingQuantityOnly = false; @@ -544,7 +536,7 @@ { this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); } -@@ -624,14 +930,34 @@ +@@ -624,14 +922,34 @@ public void onDisconnect(IChatComponent p_147231_1_) { @@ -584,7 +576,7 @@ if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner())) { logger.info("Stopping singleplayer server as player logged out"); -@@ -657,6 +983,18 @@ +@@ -657,6 +975,18 @@ } } @@ -603,7 +595,7 @@ try { this.netManager.scheduleOutboundPacket(p_147359_1_, new GenericFutureListener[0]); -@@ -679,20 +1017,37 @@ +@@ -679,20 +1009,37 @@ public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) { @@ -642,7 +634,7 @@ { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); -@@ -708,51 +1063,385 @@ +@@ -708,51 +1055,385 @@ { if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) { @@ -1040,7 +1032,7 @@ if (p_147357_1_.func_149513_d() == 1) { this.playerEntity.setSneaking(true); -@@ -772,7 +1461,7 @@ +@@ -772,7 +1453,7 @@ else if (p_147357_1_.func_149513_d() == 3) { this.playerEntity.wakeUpPlayer(false, true, true); @@ -1049,7 +1041,7 @@ } else if (p_147357_1_.func_149513_d() == 6) { -@@ -789,8 +1478,20 @@ +@@ -789,8 +1470,20 @@ public void processUseEntity(C02PacketUseEntity p_147340_1_) { @@ -1071,7 +1063,7 @@ this.playerEntity.func_143004_u(); if (entity != null) -@@ -805,9 +1506,53 @@ +@@ -805,9 +1498,53 @@ if (this.playerEntity.getDistanceSqToEntity(entity) < d0) { @@ -1125,7 +1117,7 @@ } else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK) { -@@ -819,6 +1564,13 @@ +@@ -819,6 +1556,13 @@ } this.playerEntity.attackTargetEntityWithCurrentItem(entity); @@ -1139,7 +1131,7 @@ } } } -@@ -834,8 +1586,19 @@ +@@ -834,8 +1578,19 @@ case 1: if (this.playerEntity.playerConqueredTheEnd) { @@ -1160,7 +1152,7 @@ else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) { if (this.serverController.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.serverController.getServerOwner())) -@@ -871,17 +1634,461 @@ +@@ -871,17 +1626,461 @@ public void processCloseWindow(C0DPacketCloseWindow p_147356_1_) { @@ -1623,7 +1615,7 @@ if (ItemStack.areItemStacksEqual(p_147351_1_.func_149546_g(), itemstack)) { this.playerEntity.playerNetServerHandler.sendPacket(new S32PacketConfirmTransaction(p_147351_1_.func_149548_c(), p_147351_1_.func_149547_f(), true)); -@@ -903,6 +2110,12 @@ +@@ -903,6 +2102,12 @@ } this.playerEntity.sendContainerAndContentsToPlayer(this.playerEntity.openContainer, arraylist); @@ -1636,7 +1628,7 @@ } } } -@@ -925,9 +2138,61 @@ +@@ -925,9 +2130,61 @@ boolean flag = p_147344_1_.func_149627_c() < 0; ItemStack itemstack = p_147344_1_.func_149625_d(); boolean flag1 = p_147344_1_.func_149627_c() >= 1 && p_147344_1_.func_149627_c() < 36 + InventoryPlayer.getHotbarSize(); @@ -1699,7 +1691,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) -@@ -956,6 +2221,11 @@ +@@ -956,6 +2213,11 @@ public void processConfirmTransaction(C0FPacketConfirmTransaction p_147339_1_) { @@ -1711,7 +1703,7 @@ Short oshort = (Short)this.field_147372_n.lookup(this.playerEntity.openContainer.windowId); if (oshort != null && p_147339_1_.func_149533_d() == oshort.shortValue() && this.playerEntity.openContainer.windowId == p_147339_1_.func_149532_c() && !this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) -@@ -966,6 +2236,11 @@ +@@ -966,6 +2228,11 @@ public void processUpdateSign(C12PacketUpdateSign p_147343_1_) { @@ -1723,7 +1715,7 @@ this.playerEntity.func_143004_u(); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); -@@ -980,6 +2255,7 @@ +@@ -980,6 +2247,7 @@ if (!tileentitysign.func_145914_a() || tileentitysign.func_145911_b() != this.playerEntity) { this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " just tried to change non-editable sign"); @@ -1731,7 +1723,7 @@ return; } } -@@ -990,6 +2266,7 @@ +@@ -990,6 +2258,7 @@ for (j = 0; j < 4; ++j) { boolean flag = true; @@ -1739,7 +1731,7 @@ if (p_147343_1_.func_149589_f()[j].length() > 15) { -@@ -1018,7 +2295,29 @@ +@@ -1018,7 +2287,29 @@ int k = p_147343_1_.func_149586_d(); i = p_147343_1_.func_149585_e(); TileEntitySign tileentitysign1 = (TileEntitySign)tileentity; @@ -1770,7 +1762,7 @@ tileentitysign1.markDirty(); worldserver.markBlockForUpdate(j, k, i); } -@@ -1041,7 +2340,22 @@ +@@ -1041,7 +2332,22 @@ public void processPlayerAbilities(C13PacketPlayerAbilities p_147348_1_) { @@ -1794,7 +1786,7 @@ } public void processTabComplete(C14PacketTabComplete p_147341_1_) -@@ -1068,7 +2382,6 @@ +@@ -1068,7 +2374,6 @@ PacketBuffer packetbuffer; ItemStack itemstack; ItemStack itemstack1; @@ -1802,7 +1794,7 @@ if ("MC|BEdit".equals(p_147349_1_.func_149559_c())) { packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e())); -@@ -1093,16 +2406,18 @@ +@@ -1093,16 +2398,18 @@ if (itemstack.getItem() == Items.writable_book && itemstack.getItem() == itemstack1.getItem()) { @@ -1825,7 +1817,7 @@ } finally { -@@ -1135,19 +2450,18 @@ +@@ -1135,19 +2442,18 @@ { if (itemstack.getItem() == Items.written_book && itemstack1.getItem() == Items.writable_book) { @@ -1851,7 +1843,7 @@ } finally { -@@ -1174,9 +2488,12 @@ +@@ -1174,9 +2480,12 @@ ((ContainerMerchant)container).setCurrentRecipeIndex(i); } } @@ -1865,7 +1857,7 @@ } } else if ("MC|AdvCdm".equals(p_147349_1_.func_149559_c())) -@@ -1222,9 +2539,12 @@ +@@ -1222,9 +2531,12 @@ this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1})); } } @@ -1880,7 +1872,7 @@ } finally { -@@ -1257,9 +2577,12 @@ +@@ -1257,9 +2569,12 @@ tileentitybeacon.markDirty(); } } @@ -1895,7 +1887,7 @@ } } } -@@ -1281,6 +2604,13 @@ +@@ -1281,6 +2596,13 @@ containerrepair.updateItemName(""); } } @@ -1909,7 +1901,7 @@ } } -@@ -1292,6 +2622,21 @@ +@@ -1292,6 +2614,21 @@ } } diff --git a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch index cd70938..50ad690 100644 --- a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -29,7 +29,7 @@ private ServerEula field_154332_n; private boolean canSpawnStructures; private WorldSettings.GameType gameType; -@@ -52,9 +62,12 @@ +@@ -52,10 +62,13 @@ public static boolean allowPlayerLogins = false; private static final String __OBFID = "CL_00001784"; @@ -38,12 +38,14 @@ + public DedicatedServer(joptsimple.OptionSet options) { - super(p_i1508_1_, Proxy.NO_PROXY); +- Thread thread = new Thread("Server Infinisleeper") + super(options, Proxy.NO_PROXY); + // super(p_i1508_1_, Proxy.NO_PROXY); + // CraftBukkit end - Thread thread = new Thread("Server Infinisleeper") ++ new Thread("Server Infinisleeper") { private static final String __OBFID = "CL_00001787"; + { @@ -82,31 +95,77 @@ }; } diff --git a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch index b67c6f2..82b047b 100644 --- a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -18,8 +18,8 @@ import net.minecraft.world.WorldSettings; import net.minecraft.world.demo.DemoWorldManager; import net.minecraft.world.storage.IPlayerFileData; -+import net.minecraftforge.common.DimensionManager; import net.minecraft.world.storage.SaveHandler; ++import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.chunkio.ChunkIOExecutor; +import net.minecraftforge.common.network.ForgeMessage; +import net.minecraftforge.common.network.ForgeNetworkHandler; @@ -135,16 +135,15 @@ { HashSet hashset = new HashSet(); Iterator iterator = p_96456_1_.getTeams().iterator(); -@@ -225,6 +280,8 @@ +@@ -225,6 +280,7 @@ public void setPlayerManager(WorldServer[] p_72364_1_) { + if (this.playerNBTManagerObj != null) return; // CraftBukkit -+ this.playerNBTManagerObj = p_72364_1_[0].getSaveHandler().getSaveHandler(); } -@@ -248,7 +305,7 @@ +@@ -248,7 +304,7 @@ public NBTTagCompound readPlayerDataFromFile(EntityPlayerMP p_72380_1_) { @@ -153,7 +152,7 @@ NBTTagCompound nbttagcompound1; if (p_72380_1_.getCommandSenderName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -@@ -294,18 +351,61 @@ +@@ -294,18 +350,60 @@ public void playerLoggedIn(EntityPlayerMP p_72377_1_) { @@ -195,7 +194,6 @@ { EntityPlayerMP entityplayermp1 = (EntityPlayerMP)this.playerEntityList.get(i); - p_72377_1_.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(entityplayermp1.getCommandSenderName(), true, entityplayermp1.ping)); -+ + if (entityplayermp1.getBukkitEntity().canSee(p_72377_1_.getBukkitEntity())) + { + entityplayermp1.playerNetServerHandler.sendPacket(packet); @@ -219,7 +217,7 @@ } public void updatePlayerPertinentChunks(EntityPlayerMP p_72358_1_) -@@ -313,14 +413,33 @@ +@@ -313,14 +411,33 @@ p_72358_1_.getServerForPlayer().getPlayerManager().updatePlayerPertinentChunks(p_72358_1_); } @@ -229,8 +227,8 @@ - FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); + disconnect(p_72367_1_); + } -+ // Cauldron end + ++ // Cauldron end + public String disconnect(EntityPlayerMP p_72367_1_) // CraftBukkit - return string + { p_72367_1_.triggerAchievement(StatList.leaveGameStat); @@ -255,7 +253,7 @@ { worldserver.removePlayerEntityDangerously(p_72367_1_.ridingEntity); logger.debug("removing player mount"); -@@ -329,9 +448,35 @@ +@@ -329,9 +446,35 @@ worldserver.removeEntity(p_72367_1_); worldserver.getPlayerManager().removePlayer(p_72367_1_); this.playerEntityList.remove(p_72367_1_); @@ -294,7 +292,7 @@ } public String allowUserToConnect(SocketAddress p_148542_1_, GameProfile p_148542_2_) -@@ -372,6 +517,71 @@ +@@ -372,6 +515,71 @@ } } @@ -366,7 +364,7 @@ public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_) { UUID uuid = EntityPlayer.func_146094_a(p_148545_1_); -@@ -410,80 +620,200 @@ +@@ -410,80 +618,199 @@ return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); } @@ -428,7 +426,7 @@ - WorldServer worldserver = this.mcServer.worldServerForDimension(p_72368_1_.dimension); - this.func_72381_a(entityplayermp1, p_72368_1_, worldserver); + return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); -+ // */ ++ // */ + return player; + // CraftBukkit end + } @@ -436,7 +434,7 @@ + // Cauldron start - refactor entire method for sanity. + public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) + { -+ return this.respawnPlayer(par1EntityPlayerMP, par2, par3, null); ++ return this.respawnPlayer(par1EntityPlayerMP, par2, par3, null); + } + + public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int targetDimension, boolean returnFromEnd, Location location) @@ -530,7 +528,6 @@ + location = new Location(toWorld, toWorld.getSpawnLocation().getX(), toWorld.getSpawnLocation().getY(), toWorld.getSpawnLocation().getZ()); // use the world spawnpoint as default location } - else -+ + Player respawnPlayer = this.cserver.getPlayer(entityplayermp1); + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); + this.cserver.getPluginManager().callEvent(respawnEvent); @@ -607,7 +604,7 @@ return entityplayermp1; } -@@ -492,34 +822,110 @@ +@@ -492,34 +819,112 @@ transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter()); } @@ -718,11 +715,13 @@ + while (iterator.hasNext()) { - PotionEffect potioneffect = (PotionEffect)iterator.next(); +- PotionEffect potioneffect = (PotionEffect)iterator.next(); - p_72356_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(p_72356_1_.getEntityId(), potioneffect)); ++ PotionEffect potioneffect = (PotionEffect) iterator.next(); + par1EntityPlayerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(par1EntityPlayerMP.getEntityId(), potioneffect)); } - FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_); ++ + FMLCommonHandler.instance().firePlayerChangedDimensionEvent(par1EntityPlayerMP, fromWorld.dimension, targetDimension); } @@ -733,10 +732,11 @@ + // transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); + Location exit = this.calculateTarget(p_82448_1_.getBukkitEntity().getLocation(), p_82448_4_); + this.repositionEntity(p_82448_1_, exit, true); ++ // CraftBukkit end } public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) -@@ -605,6 +1011,109 @@ +@@ -605,6 +1010,109 @@ p_82448_1_.setWorld(p_82448_4_); } @@ -751,17 +751,16 @@ + float pitch = enter.getPitch(); + double d0 = enter.getX(); + double d1 = enter.getZ(); -+ double d2 = 8.0D; + + if (worldserver1.dimension == -1) + { -+ d0 /= d2; -+ d1 /= d2; ++ d0 /= 8.0D; ++ d1 /= 8.0D; + } + else if (worldserver1.dimension == 0) + { -+ d0 *= d2; -+ d1 *= d2; ++ d0 *= 8.0D; ++ d1 *= 8.0D; + } + else + { @@ -787,6 +786,7 @@ + yaw = 90.0F; + pitch = 0.0F; + } ++ // Cauldron end + } + + if (i != 1) @@ -846,7 +846,7 @@ public void sendPlayerInfoToAllPlayers() { if (++this.playerPingIndex > 600) -@@ -612,11 +1121,13 @@ +@@ -612,11 +1120,13 @@ this.playerPingIndex = 0; } @@ -860,7 +860,7 @@ } public void sendPacketToAllPlayers(Packet p_148540_1_) -@@ -877,13 +1388,24 @@ +@@ -877,13 +1387,24 @@ for (int j = 0; j < this.playerEntityList.size(); ++j) { EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j); @@ -887,7 +887,7 @@ if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_) { entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); -@@ -941,13 +1463,16 @@ +@@ -941,13 +1462,16 @@ p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F)); p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, p_72354_2_.getRainStrength(1.0F))); p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F))); @@ -905,7 +905,7 @@ p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); } -@@ -963,7 +1488,10 @@ +@@ -963,7 +1487,10 @@ public String[] getAvailablePlayerDat() { @@ -917,7 +917,7 @@ } public void setWhiteListEnabled(boolean p_72371_1_) -@@ -1032,12 +1560,30 @@ +@@ -1032,12 +1559,30 @@ public void removeAllPlayers() { diff --git a/patches/net/minecraft/util/ChunkCoordinates.java.patch b/patches/net/minecraft/util/ChunkCoordinates.java.patch new file mode 100644 index 0000000..17b7ccc --- /dev/null +++ b/patches/net/minecraft/util/ChunkCoordinates.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/util/ChunkCoordinates.java ++++ ../src-work/minecraft/net/minecraft/util/ChunkCoordinates.java +@@ -38,7 +38,7 @@ + + public int hashCode() + { +- return this.posX + this.posZ << 8 + this.posY << 16; ++ return this.posX + (this.posZ << 8) + (this.posY << 16); + } + + public int compareTo(ChunkCoordinates p_compareTo_1_) diff --git a/patches/net/minecraft/world/World.java.patch b/patches/net/minecraft/world/World.java.patch index dd518bc..e8e027d 100644 --- a/patches/net/minecraft/world/World.java.patch +++ b/patches/net/minecraft/world/World.java.patch @@ -62,7 +62,7 @@ public abstract class World implements IBlockAccess { /** -@@ -83,10 +128,10 @@ +@@ -83,15 +128,14 @@ public boolean scheduledUpdatesAreImmediate; public List loadedEntityList = new ArrayList(); @@ -75,11 +75,17 @@ public List playerEntities = new ArrayList(); public List weatherEffects = new ArrayList(); private long cloudColour = 16777215L; -@@ -100,26 +145,87 @@ + public int skylightSubtracted; +- protected int updateLCG = (new Random()).nextInt(); + protected final int DIST_HASH_MAGIC = 1013904223; + public float prevRainingStrength; + public float rainingStrength; +@@ -100,26 +144,88 @@ public int lastLightningBolt; public EnumDifficulty difficultySetting; public Random rand = new Random(); - public final WorldProvider provider; ++ protected int updateLCG = this.rand.nextInt(); + public WorldProvider provider; // CraftBukkit - remove final protected List worldAccesses = new ArrayList(); - protected IChunkProvider chunkProvider; diff --git a/patches/net/minecraft/world/chunk/Chunk.java.patch b/patches/net/minecraft/world/chunk/Chunk.java.patch index 4a82f91..a34c8a6 100644 --- a/patches/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/net/minecraft/world/chunk/Chunk.java.patch @@ -204,6 +204,15 @@ this.worldObj.unloadEntities(this.entityLists[i]); } MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); +@@ -1025,7 +1139,7 @@ + + public Random getRandomWithSeed(long p_76617_1_) + { +- return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ p_76617_1_); ++ return new Random(this.worldObj.getSeed() + (4987142L * this.xPosition * this.xPosition) + (5947611L * this.xPosition) + (4392871L * this.zPosition * this.zPosition) + (389711L * this.zPosition) ^ p_76617_1_); + } + + public boolean isEmpty() @@ -1035,6 +1149,7 @@ public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_) diff --git a/patches/net/minecraft/world/chunk/EmptyChunk.java.patch b/patches/net/minecraft/world/chunk/EmptyChunk.java.patch new file mode 100644 index 0000000..abc30ac --- /dev/null +++ b/patches/net/minecraft/world/chunk/EmptyChunk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/EmptyChunk.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/EmptyChunk.java +@@ -113,7 +113,7 @@ + + public Random getRandomWithSeed(long p_76617_1_) + { +- return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ p_76617_1_); ++ return new Random(this.worldObj.getSeed() + (4987142L * this.xPosition * this.xPosition) + (5947611L * this.xPosition) + (4392871L * this.zPosition * this.zPosition) + (389711L * this.zPosition) ^ p_76617_1_); + } + + public boolean isEmpty() diff --git a/patches/net/minecraft/world/gen/FlatLayerInfo.java.patch b/patches/net/minecraft/world/gen/FlatLayerInfo.java.patch new file mode 100644 index 0000000..305f811 --- /dev/null +++ b/patches/net/minecraft/world/gen/FlatLayerInfo.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/FlatLayerInfo.java ++++ ../src-work/minecraft/net/minecraft/world/gen/FlatLayerInfo.java +@@ -12,7 +12,6 @@ + + public FlatLayerInfo(int p_i45467_1_, Block p_i45467_2_) + { +- this.layerCount = 1; + this.layerCount = p_i45467_1_; + this.field_151537_a = p_i45467_2_; + } diff --git a/patches/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 0000000..4255fa1 --- /dev/null +++ b/patches/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -50,7 +50,7 @@ + p_76484_1_.setBlock(i1, j1, k1, Blocks.chest, 0, 2); + TileEntityChest tileentitychest = (TileEntityChest)p_76484_1_.getTileEntity(i1, j1, k1); + +- if (tileentitychest != null && tileentitychest != null) ++ if (tileentitychest != null) + { + WeightedRandomChestContent.generateChestContents(p_76484_2_, this.theBonusChestGenerator, tileentitychest, this.itemsToGenerateInBonusChest); + } diff --git a/patches/net/minecraft/world/storage/SaveHandler.java.patch b/patches/net/minecraft/world/storage/SaveHandler.java.patch index eff76d6..747df5f 100644 --- a/patches/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/net/minecraft/world/storage/SaveHandler.java.patch @@ -124,7 +124,7 @@ public IPlayerFileData getSaveHandler() { return this; -@@ -323,6 +371,99 @@ +@@ -323,6 +371,100 @@ return this.saveDirectoryName; } @@ -202,6 +202,7 @@ + { + return playersDirectory; + } ++ + // CraftBukkit end + + // Cauldron start diff --git a/patches/net/minecraftforge/common/ForgeVersion.java.patch b/patches/net/minecraftforge/common/ForgeVersion.java.patch index 82458ea..91b0e74 100644 --- a/patches/net/minecraftforge/common/ForgeVersion.java.patch +++ b/patches/net/minecraftforge/common/ForgeVersion.java.patch @@ -5,7 +5,7 @@ public static final int revisionVersion = 3; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. - public static final int buildVersion = 0; -+ public static final int buildVersion = 1370; // Cauldron ++ public static final int buildVersion = 1388; // Cauldron private static Status status = PENDING; private static String target = null; diff --git a/patches/net/minecraftforge/common/chunkio/ChunkIOExecutor.java.patch b/patches/net/minecraftforge/common/chunkio/ChunkIOExecutor.java.patch new file mode 100644 index 0000000..abaf990 --- /dev/null +++ b/patches/net/minecraftforge/common/chunkio/ChunkIOExecutor.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraftforge/common/chunkio/ChunkIOExecutor.java ++++ ../src-work/minecraft/net/minecraftforge/common/chunkio/ChunkIOExecutor.java +@@ -22,7 +22,7 @@ + } + + public static void adjustPoolSize(int players) { +- int size = Math.max(BASE_THREADS, (int) Math.ceil(players / PLAYERS_PER_THREAD)); ++ int size = Math.max(BASE_THREADS, (int) Math.ceil((double) players / PLAYERS_PER_THREAD)); + instance.setActiveThreads(size); + } + diff --git a/patches/org/bukkit/command/defaults/BanIpCommand.java.patch b/patches/org/bukkit/command/defaults/BanIpCommand.java.patch new file mode 100644 index 0000000..eaa6e0c --- /dev/null +++ b/patches/org/bukkit/command/defaults/BanIpCommand.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/org/bukkit/command/defaults/BanIpCommand.java ++++ ../src-work/minecraft/org/bukkit/command/defaults/BanIpCommand.java +@@ -32,7 +32,7 @@ + return false; + } + +- String reason = args.length > 0 ? StringUtils.join(args, ' ', 1, args.length) : null; ++ String reason = StringUtils.join(args, ' ', 1, args.length); + + if (ipValidity.matcher(args[0]).matches()) { + processIPBan(args[0], sender, reason); diff --git a/patches/org/bukkit/command/defaults/SpreadPlayersCommand.java.patch b/patches/org/bukkit/command/defaults/SpreadPlayersCommand.java.patch new file mode 100644 index 0000000..1f5e91c --- /dev/null +++ b/patches/org/bukkit/command/defaults/SpreadPlayersCommand.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/org/bukkit/command/defaults/SpreadPlayersCommand.java ++++ ../src-work/minecraft/org/bukkit/command/defaults/SpreadPlayersCommand.java +@@ -92,7 +92,7 @@ + final int rangeSpread = range(world, distance, xRangeMin, zRangeMin, xRangeMax, zRangeMax, locations); + + if (rangeSpread == -1) { +- sender.sendMessage(String.format("Could not spread %d %s around %s,%s (too many players for space - try using spread of at most %s)", spreadSize, teams ? "teams" : "players", x, z)); ++ sender.sendMessage(String.format("Could not spread %d %s around %s,%s (too many players for space - try using spread of at most %s)", spreadSize, teams ? "teams" : "players", x, z, "TODO")); // TODO: Add latest argument + return false; + } + diff --git a/patches/org/bukkit/configuration/MemorySection.java.patch b/patches/org/bukkit/configuration/MemorySection.java.patch new file mode 100644 index 0000000..ad2d914 --- /dev/null +++ b/patches/org/bukkit/configuration/MemorySection.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/org/bukkit/configuration/MemorySection.java ++++ ../src-work/minecraft/org/bukkit/configuration/MemorySection.java +@@ -760,7 +760,8 @@ + * @return Full path of the section from its root. + */ + public static String createPath(ConfigurationSection section, String key) { +- return createPath(section, key, (section == null) ? null : section.getRoot()); ++ Validate.notNull(section, "Cannot create path without a section"); ++ return createPath(section, key, section.getRoot()); + } + + /** +@@ -784,17 +785,15 @@ + char separator = root.options().pathSeparator(); + + StringBuilder builder = new StringBuilder(); +- if (section != null) { +- for (ConfigurationSection parent = section; (parent != null) && (parent != relativeTo); parent = parent.getParent()) { +- if (builder.length() > 0) { +- builder.insert(0, separator); +- } +- +- builder.insert(0, parent.getName()); ++ for (ConfigurationSection parent = section; parent != null && parent != relativeTo; parent = parent.getParent()) { ++ if (builder.length() > 0) { ++ builder.insert(0, separator); + } ++ ++ builder.insert(0, parent.getName()); + } + +- if ((key != null) && (key.length() > 0)) { ++ if (key != null && key.length() > 0) { + if (builder.length() > 0) { + builder.append(separator); + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index c0b12f5..21674ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -247,11 +247,11 @@ public class CraftInventory implements Inventory { } private int firstPartial(ItemStack item) { - ItemStack[] inventory = getContents(); - ItemStack filteredItem = CraftItemStack.asCraftCopy(item); if (item == null) { return -1; } + ItemStack[] inventory = getContents(); + ItemStack filteredItem = CraftItemStack.asCraftCopy(item); for (int i = 0; i < inventory.length; i++) { ItemStack cItem = inventory[i]; if (cItem != null && cItem.getAmount() < cItem.getMaxStackSize() && cItem.isSimilar(filteredItem)) { diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java index 65067a4..f2ae2d5 100644 --- a/src/main/java/org/spigotmc/CustomTimingsHandler.java +++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java @@ -103,7 +103,7 @@ public class CustomTimingsHandler { if ( timings.curTickTotal > 50000000 ) { - timings.violations += Math.ceil( timings.curTickTotal / 50000000 ); + timings.violations += Math.ceil( (double) timings.curTickTotal / 50000000 ); } timings.curTickTotal = 0; timings.timingDepth = 0; // incase reset messes this up