diff --git a/build.gradle b/build.gradle index 5be9547..fece83f 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 = "1291" +ext.forgeVersion = "1343" ext.bukkitVersion = "01" 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.2.1291', + 'Forge-Version': '10.13.2.1343', 'Specification-Vendor': 'Bukkit Team', 'Specification-Title': 'Bukkit', 'Specification-Version': '1.7.10-R0.1-SNAPSHOT' diff --git a/patches/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java.patch b/patches/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java.patch index 18ee8eb..3c0abdb 100644 --- a/patches/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java.patch +++ b/patches/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java +++ ../src-work/minecraft/cpw/mods/fml/common/network/handshake/NetworkDispatcher.java -@@ -72,7 +72,7 @@ +@@ -76,7 +76,7 @@ public static final AttributeKey IS_LOCAL = new AttributeKey("fml:isLocal"); public final NetworkManager manager; private final ServerConfigurationManager scm; @@ -9,16 +9,16 @@ private ConnectionState state; private ConnectionType connectionType; private final Side side; -@@ -202,7 +202,7 @@ +@@ -219,7 +219,7 @@ } else { - FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); -+ //FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); // Cauldron - unneeded spam ++ // FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName()); } return false; } -@@ -287,6 +287,7 @@ +@@ -304,6 +304,7 @@ state = ConnectionState.HANDSHAKING; } String channelName = msg.func_149559_c(); @@ -26,7 +26,7 @@ if ("FML|HS".equals(channelName) || "REGISTER".equals(channelName) || "UNREGISTER".equals(channelName)) { FMLProxyPacket proxy = new FMLProxyPacket(msg); -@@ -308,6 +309,7 @@ +@@ -325,6 +326,7 @@ else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.SERVER)) { FMLProxyPacket proxy = new FMLProxyPacket(msg); @@ -34,12 +34,12 @@ proxy.setDispatcher(this); context.fireChannelRead(proxy); return true; -@@ -465,7 +467,7 @@ +@@ -482,7 +484,7 @@ // Stop the epic channel closed spam at close if (!(cause instanceof ClosedChannelException)) { - FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); -+ //FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); // Cauldron - disable unneeded spam ++ // FMLLog.log(Level.ERROR, cause, "NetworkDispatcher exception"); } super.exceptionCaught(ctx, cause); } diff --git a/patches/cpw/mods/fml/common/registry/GameData.java.patch b/patches/cpw/mods/fml/common/registry/GameData.java.patch index 0536ee0..275154d 100644 --- a/patches/cpw/mods/fml/common/registry/GameData.java.patch +++ b/patches/cpw/mods/fml/common/registry/GameData.java.patch @@ -10,7 +10,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -@@ -1024,4 +1026,56 @@ +@@ -1025,4 +1027,56 @@ throw new RuntimeException("WHAT?"); } } diff --git a/patches/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/net/minecraft/entity/player/EntityPlayer.java.patch index adf0e59..9b3a121 100644 --- a/patches/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/net/minecraft/entity/player/EntityPlayer.java.patch @@ -219,7 +219,7 @@ score.func_96648_a(); } } -@@ -777,6 +861,19 @@ +@@ -777,6 +861,36 @@ entityitem.motionZ += Math.sin((double)f1) * (double)f; } @@ -231,7 +231,24 @@ + + if (event.isCancelled()) + { -+ player.getInventory().addItem(drop.getItemStack()); ++ // player.getInventory().addItem(drop.getItemStack()); ++ org.bukkit.inventory.ItemStack cur = player.getInventory().getItemInHand(); ++ if (p_146097_3_ && (cur == null || cur.getAmount() == 0)) ++ { ++ // The complete stack was dropped ++ player.getInventory().setItemInHand(drop.getItemStack()); ++ } ++ else if (p_146097_3_ && cur.isSimilar(drop.getItemStack()) && drop.getItemStack().getAmount() == 1) ++ { ++ // Only one item is dropped ++ cur.setAmount(cur.getAmount() + 1); ++ player.getInventory().setItemInHand(cur); ++ } ++ else ++ { ++ // Fallback ++ player.getInventory().addItem(drop.getItemStack()); ++ } + return null; + } + // CraftBukkit end @@ -239,7 +256,7 @@ this.joinEntityItemWithWorld(entityitem); this.addStat(StatList.dropStat, 1); return entityitem; -@@ -881,6 +978,15 @@ +@@ -881,6 +995,15 @@ this.wakeUpPlayer(true, true, false); } @@ -255,7 +272,7 @@ if (p_70037_1_.hasKey("SpawnX", 99) && p_70037_1_.hasKey("SpawnY", 99) && p_70037_1_.hasKey("SpawnZ", 99)) { this.spawnChunk = new ChunkCoordinates(p_70037_1_.getInteger("SpawnX"), p_70037_1_.getInteger("SpawnY"), p_70037_1_.getInteger("SpawnZ")); -@@ -925,6 +1031,7 @@ +@@ -925,6 +1048,7 @@ p_70014_1_.setInteger("SpawnY", this.spawnChunk.posY); p_70014_1_.setInteger("SpawnZ", this.spawnChunk.posZ); p_70014_1_.setBoolean("SpawnForced", this.spawnForced); @@ -263,7 +280,7 @@ } NBTTagList spawnlist = new NBTTagList(); -@@ -1003,7 +1110,7 @@ +@@ -1003,7 +1127,7 @@ { if (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { @@ -272,7 +289,7 @@ } if (this.worldObj.difficultySetting == EnumDifficulty.EASY) -@@ -1017,7 +1124,7 @@ +@@ -1017,7 +1141,7 @@ } } @@ -281,7 +298,7 @@ { return false; } -@@ -1039,9 +1146,40 @@ +@@ -1039,9 +1163,40 @@ public boolean canAttackPlayer(EntityPlayer p_96122_1_) { @@ -325,7 +342,7 @@ } protected void damageArmor(float p_70675_1_) -@@ -1073,19 +1211,34 @@ +@@ -1073,19 +1228,34 @@ return (float)i / (float)this.inventory.armorInventory.length; } @@ -362,7 +379,7 @@ p_70665_2_ = this.applyPotionDamageCalculations(p_70665_1_, p_70665_2_); float f1 = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F); -@@ -1099,6 +1252,7 @@ +@@ -1099,6 +1269,7 @@ this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_); } } @@ -370,7 +387,7 @@ } public void func_146101_a(TileEntityFurnace p_146101_1_) {} -@@ -1134,7 +1288,8 @@ +@@ -1134,7 +1305,8 @@ if (itemstack.interactWithEntity(this, (EntityLivingBase)p_70998_1_)) { @@ -380,7 +397,7 @@ { this.destroyCurrentEquippedItem(); } -@@ -1281,7 +1436,8 @@ +@@ -1281,7 +1453,8 @@ { itemstack.hitEntity((EntityLivingBase)object, this); @@ -390,7 +407,7 @@ { this.destroyCurrentEquippedItem(); } -@@ -1293,7 +1449,17 @@ +@@ -1293,7 +1466,17 @@ if (j > 0) { @@ -409,7 +426,7 @@ } } -@@ -1322,6 +1488,10 @@ +@@ -1322,6 +1505,10 @@ if (this.openContainer != null) { @@ -420,7 +437,7 @@ this.openContainer.onContainerClosed(this); } } -@@ -1381,6 +1551,20 @@ +@@ -1381,6 +1568,20 @@ this.mountEntity((Entity)null); } @@ -441,7 +458,7 @@ this.setSize(0.2F, 0.2F); this.yOffset = 0.2F; -@@ -1476,6 +1660,26 @@ +@@ -1476,6 +1677,26 @@ this.worldObj.updateAllPlayersSleepingFlag(); } @@ -468,7 +485,7 @@ if (p_70999_1_) { this.sleepTimer = 0; -@@ -1606,11 +1810,13 @@ +@@ -1606,11 +1827,13 @@ { this.spawnChunk = new ChunkCoordinates(p_71063_1_); this.spawnForced = p_71063_2_; diff --git a/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch index 5f889d7..2f72840 100644 --- a/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -284,7 +284,7 @@ + IChatComponent chatmessage = this.func_110142_aN().func_151521_b(); + String deathmessage = chatmessage.getUnformattedText(); -+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage); ++ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); + String deathMessage = event.getDeathMessage(); + + if (deathMessage != null && deathMessage.length() > 0) @@ -299,7 +299,7 @@ + } + } + -+ if (!keepInventory) ++ if (!event.getKeepInventory()) + { + // Cauldron start - rework CraftBukkit logic to support Forge better + this.inventory.clearInventory(null, -1); // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. diff --git a/patches/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/net/minecraft/entity/projectile/EntityFishHook.java.patch index 09da7c4..293eb25 100644 --- a/patches/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ b/patches/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -31,7 +31,7 @@ if (movingobjectposition.entityHit != null) { if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.field_146042_b), 0.0F)) -@@ -509,6 +517,18 @@ +@@ -509,6 +517,16 @@ if (this.field_146043_c != null) { @@ -41,8 +41,6 @@ + + if (playerFishEvent.isCancelled()) + { -+ this.setDead(); -+ this.field_146042_b.fishEntity = null; + return 0; + } + @@ -50,7 +48,7 @@ double d0 = this.field_146042_b.posX - this.posX; double d2 = this.field_146042_b.posY - this.posY; double d4 = this.field_146042_b.posZ - this.posZ; -@@ -522,6 +542,19 @@ +@@ -522,6 +540,17 @@ else if (this.field_146045_ax > 0) { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.func_146033_f()); @@ -61,8 +59,6 @@ + + if (playerFishEvent.isCancelled()) + { -+ this.setDead(); -+ this.field_146042_b.fishEntity = null; + return 0; + } + @@ -70,7 +66,7 @@ double d1 = this.field_146042_b.posX - this.posX; double d3 = this.field_146042_b.posY - this.posY; double d5 = this.field_146042_b.posZ - this.posZ; -@@ -531,15 +564,36 @@ +@@ -531,15 +560,37 @@ entityitem.motionY = d3 * d9 + (double)MathHelper.sqrt_double(d7) * 0.08D; entityitem.motionZ = d5 * d9; this.worldObj.spawnEntityInWorld(entityitem); @@ -88,11 +84,8 @@ + + if (playerFishEvent.isCancelled()) + { -+ this.setDead(); -+ this.field_146042_b.fishEntity = null; + return 0; + } -+ + // CraftBukkit end b0 = 2; } @@ -102,13 +95,17 @@ + { + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.field_146042_b.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT); + this.worldObj.getServer().getPluginManager().callEvent(playerFishEvent); -+ } + ++ if (playerFishEvent.isCancelled()) ++ { ++ return 0; ++ } ++ } + // CraftBukkit end this.setDead(); this.field_146042_b.fishEntity = null; return b0; -@@ -580,7 +634,7 @@ +@@ -580,7 +631,7 @@ { float f3 = f - f2; this.field_146042_b.addStat(StatList.fishCaughtStat, 1); diff --git a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch index 2b49260..a4cd406 100644 --- a/patches/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -156,7 +156,7 @@ + } + + private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, -+ 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after every update. ++ 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 140, 141, 142, 144)); // TODO: Check after every update. + // CraftBukkit end + public void onNetworkTick() diff --git a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch index 8838153..b67c6f2 100644 --- a/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -19,10 +19,10 @@ 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.chunkio.ChunkIOExecutor; +import net.minecraftforge.common.network.ForgeMessage; +import net.minecraftforge.common.network.ForgeNetworkHandler; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -135,19 +135,16 @@ { HashSet hashset = new HashSet(); Iterator iterator = p_96456_1_.getTeams().iterator(); -@@ -225,6 +280,11 @@ +@@ -225,6 +280,8 @@ public void setPlayerManager(WorldServer[] p_72364_1_) { -+ if (this.playerNBTManagerObj != null) -+ { -+ return; // CraftBukkit -+ } ++ if (this.playerNBTManagerObj != null) return; // CraftBukkit + this.playerNBTManagerObj = p_72364_1_[0].getSaveHandler().getSaveHandler(); } -@@ -248,7 +308,7 @@ +@@ -248,7 +305,7 @@ public NBTTagCompound readPlayerDataFromFile(EntityPlayerMP p_72380_1_) { @@ -156,7 +153,7 @@ NBTTagCompound nbttagcompound1; if (p_72380_1_.getCommandSenderName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -@@ -281,18 +341,61 @@ +@@ -294,18 +351,61 @@ public void playerLoggedIn(EntityPlayerMP p_72377_1_) { @@ -196,9 +193,8 @@ for (int i = 0; i < this.playerEntityList.size(); ++i) { -- EntityPlayerMP entityplayermp1 = (EntityPlayerMP)this.playerEntityList.get(i); + EntityPlayerMP entityplayermp1 = (EntityPlayerMP)this.playerEntityList.get(i); - p_72377_1_.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(entityplayermp1.getCommandSenderName(), true, entityplayermp1.ping)); -+ EntityPlayerMP entityplayermp1 = (EntityPlayerMP) this.playerEntityList.get(i); + + if (entityplayermp1.getBukkitEntity().canSee(p_72377_1_.getBukkitEntity())) + { @@ -218,12 +214,12 @@ + + // .name -> .listName + p_72377_1_.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(entityplayermp1.listName, true, entityplayermp1.ping)); -+ // CraftBukkit end + } ++ // CraftBukkit end } public void updatePlayerPertinentChunks(EntityPlayerMP p_72358_1_) -@@ -300,14 +403,33 @@ +@@ -313,14 +413,33 @@ p_72358_1_.getServerForPlayer().getPlayerManager().updatePlayerPertinentChunks(p_72358_1_); } @@ -259,7 +255,7 @@ { worldserver.removePlayerEntityDangerously(p_72367_1_.ridingEntity); logger.debug("removing player mount"); -@@ -316,9 +438,35 @@ +@@ -329,9 +448,35 @@ worldserver.removeEntity(p_72367_1_); worldserver.getPlayerManager().removePlayer(p_72367_1_); this.playerEntityList.remove(p_72367_1_); @@ -298,7 +294,7 @@ } public String allowUserToConnect(SocketAddress p_148542_1_, GameProfile p_148542_2_) -@@ -359,6 +507,71 @@ +@@ -372,6 +517,71 @@ } } @@ -364,13 +360,13 @@ + } + + return entity; -+ // CraftBukkit end + } ++ // CraftBukkit end + public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_) { UUID uuid = EntityPlayer.func_146094_a(p_148545_1_); -@@ -397,116 +610,316 @@ +@@ -410,80 +620,200 @@ return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); } @@ -416,12 +412,12 @@ if (this.mcServer.isDemo()) { - object = new DemoWorldManager(this.mcServer.worldServerForDimension(p_72368_1_.dimension)); -+ object = new DemoWorldManager(this.mcServer.worldServerForDimension(0)); ++ object = new DemoWorldManager(this.mcServer.worldServerForDimension(0)); } else { - object = new ItemInWorldManager(this.mcServer.worldServerForDimension(p_72368_1_.dimension)); -+ object = new ItemInWorldManager(this.mcServer.worldServerForDimension(0)); ++ object = new ItemInWorldManager(this.mcServer.worldServerForDimension(0)); } - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(p_72368_1_.dimension), p_72368_1_.getGameProfile(), (ItemInWorldManager)object); @@ -544,7 +540,6 @@ - entityplayermp1.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(0, 0.0F)); + location = respawnEvent.getRespawnLocation(); } -+ + par1EntityPlayerMP.reset(); } + else @@ -605,19 +600,14 @@ - FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + // If world changed then fire the appropriate change world event else respawn + if (fromWorld != location.getWorld()) -+ { + FMLCommonHandler.instance().firePlayerChangedDimensionEvent(entityplayermp1, ((CraftWorld) fromWorld).getHandle().provider.dimensionId, + ((CraftWorld) location.getWorld()).getHandle().provider.dimensionId, (CraftWorld) fromWorld); // Cauldron - fire forge changed dimension event -+ } + else + FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); return entityplayermp1; } -- public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_) -+ // Cauldron start - refactor transferPlayerToDimension to be compatible with Bukkit. These methods are to be used when a player comes in contact with a portal -+ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_) // wrapper for vanilla compatibility - { +@@ -492,34 +822,110 @@ transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter()); } @@ -740,13 +730,13 @@ { - transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); + // CraftBukkit start - Split into modular functions -+ //transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); ++ // 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); } public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) -@@ -592,6 +1005,197 @@ +@@ -605,6 +1011,109 @@ p_82448_1_.setWorld(p_82448_4_); } @@ -763,35 +753,15 @@ + double d1 = enter.getZ(); + double d2 = 8.0D; + -+ /* -+ double d3 = entity.locX; -+ double d4 = entity.locY; -+ double d5 = entity.locZ; -+ float f = entity.yaw; -+ -+ worldserver.methodProfiler.a("moving"); -+ */ + if (worldserver1.dimension == -1) + { + d0 /= d2; + d1 /= d2; -+ /* -+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ */ + } + else if (worldserver1.dimension == 0) + { + d0 *= d2; + d1 *= d2; -+ /* -+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ */ + } + else + { @@ -817,34 +787,14 @@ + yaw = 90.0F; + pitch = 0.0F; + } -+ // Cauldron end -+ /* -+ entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ */ + } + -+ // worldserver.methodProfiler.b(); + if (i != 1) + { -+ // worldserver.methodProfiler.a("placing"); + d0 = (double) MathHelper.clamp_int((int) d0, -29999872, 29999872); + d1 = (double) MathHelper.clamp_int((int) d1, -29999872, 29999872); -+ /* -+ if (entity.isAlive()) { -+ worldserver1.addEntity(entity); -+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); -+ worldserver1.entityJoinedWorld(entity, false); -+ worldserver1.t().a(entity, d3, d4, d5, f); -+ } -+ -+ worldserver.methodProfiler.b(); -+ */ + } + -+ // entity.spawnIn(worldserver1); + return new Location(worldserver1.getWorld(), d0, y, d1, yaw, pitch); + } + @@ -854,15 +804,6 @@ + int i = entity.dimension; + WorldServer worldserver = (WorldServer) entity.worldObj; + WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle(); -+ /* -+ double d0 = entity.locX; -+ double d1 = entity.locZ; -+ double d2 = 8.0D; -+ double d3 = entity.locX; -+ double d4 = entity.locY; -+ double d5 = entity.locZ; -+ float f = entity.yaw; -+ */ + worldserver.theProfiler.startSection("moving"); + entity.setLocationAndAngles(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + @@ -871,53 +812,14 @@ + worldserver.updateEntityWithOptionalForce(entity, false); + } + -+ /* -+ if (entity.dimension == -1) { -+ d0 /= d2; -+ d1 /= d2; -+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ } else if (entity.dimension == 0) { -+ d0 *= d2; -+ d1 *= d2; -+ entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ } else { -+ ChunkCoordinates chunkcoordinates; -+ -+ if (i == 1) { -+ chunkcoordinates = worldserver1.getSpawn(); -+ } else { -+ chunkcoordinates = worldserver1.getDimensionSpawn(); -+ } -+ -+ d0 = (double) chunkcoordinates.x; -+ entity.locY = (double) chunkcoordinates.y; -+ d1 = (double) chunkcoordinates.z; -+ entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F); -+ if (entity.isAlive()) { -+ worldserver.entityJoinedWorld(entity, false); -+ } -+ } -+ */ + worldserver.theProfiler.endSection(); + + if (i != 1) + { + worldserver.theProfiler.startSection("placing"); + -+ /* -+ d0 = (double) MathHelper.a((int) d0, -29999872, 29999872); -+ d1 = (double) MathHelper.a((int) d1, -29999872, 29999872); -+ */ + if (entity.isEntityAlive()) + { -+ // entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch) -+ // worldserver1.s().a(entity, d3, d4, d5, f); + if (portal) + { + Vector velocity = entity.getBukkitEntity().getVelocity(); @@ -938,13 +840,13 @@ + } + + entity.setWorld(worldserver1); -+ // CraftBukkit end + } ++ // CraftBukkit end + public void sendPlayerInfoToAllPlayers() { if (++this.playerPingIndex > 600) -@@ -599,11 +1203,13 @@ +@@ -612,11 +1121,13 @@ this.playerPingIndex = 0; } @@ -958,7 +860,7 @@ } public void sendPacketToAllPlayers(Packet p_148540_1_) -@@ -864,13 +1470,24 @@ +@@ -877,13 +1388,24 @@ for (int j = 0; j < this.playerEntityList.size(); ++j) { EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j); @@ -985,14 +887,11 @@ if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_) { entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); -@@ -925,16 +1542,19 @@ - - if (p_72354_2_.isRaining()) - { -+ // CraftBukkit start - handle player weather +@@ -941,13 +1463,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))); ++ // CraftBukkit start - handle player weather + p_72354_1_.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); + // CraftBukkit end } @@ -1006,7 +905,7 @@ p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); } -@@ -950,7 +1570,10 @@ +@@ -963,7 +1488,10 @@ public String[] getAvailablePlayerDat() { @@ -1018,7 +917,7 @@ } public void setWhiteListEnabled(boolean p_72371_1_) -@@ -1019,12 +1642,30 @@ +@@ -1032,12 +1560,30 @@ public void removeAllPlayers() { diff --git a/patches/net/minecraft/world/storage/SaveHandler.java.patch b/patches/net/minecraft/world/storage/SaveHandler.java.patch index 51ec1a6..eff76d6 100644 --- a/patches/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -10,6 +10,7 @@ - import cpw.mods.fml.common.FMLCommonHandler; - import cpw.mods.fml.common.StartupQuery; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.entity.player.EntityPlayerMP; - import net.minecraft.nbt.CompressedStreamTools; - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.server.MinecraftServer; -@@ -19,6 +20,13 @@ +@@ -21,6 +21,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,7 +14,7 @@ public class SaveHandler implements ISaveHandler, IPlayerFileData { private static final Logger logger = LogManager.getLogger(); -@@ -27,6 +35,8 @@ +@@ -29,6 +36,8 @@ private final File mapDataDir; private final long initializationTime = MinecraftServer.getSystemTimeMillis(); private final String saveDirectoryName; @@ -31,7 +23,7 @@ private static final String __OBFID = "CL_00000585"; public SaveHandler(File p_i2146_1_, String p_i2146_2_, boolean p_i2146_3_) -@@ -65,7 +75,7 @@ +@@ -67,7 +76,7 @@ catch (IOException ioexception) { ioexception.printStackTrace(); @@ -40,7 +32,7 @@ } } -@@ -85,7 +95,7 @@ +@@ -87,7 +96,7 @@ { if (datainputstream.readLong() != this.initializationTime) { @@ -49,7 +41,7 @@ } } finally -@@ -95,7 +105,10 @@ +@@ -97,7 +106,10 @@ } catch (IOException ioexception) { @@ -61,7 +53,7 @@ } } -@@ -120,6 +133,7 @@ +@@ -122,6 +134,7 @@ nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); worldInfo = new WorldInfo(nbttagcompound1); FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); @@ -69,7 +61,7 @@ return worldInfo; } catch (StartupQuery.AbortedException e) -@@ -143,6 +157,7 @@ +@@ -145,6 +158,7 @@ nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); worldInfo = new WorldInfo(nbttagcompound1); FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); @@ -77,16 +69,15 @@ return worldInfo; } catch (StartupQuery.AbortedException e) -@@ -154,7 +169,7 @@ - exception.printStackTrace(); +@@ -157,6 +171,7 @@ } } -- + + this.initBukkitData(worldInfo); // Cauldron return null; } -@@ -282,6 +297,18 @@ +@@ -284,6 +299,18 @@ if (nbttagcompound != null) { @@ -96,16 +87,16 @@ + CraftPlayer player = (CraftPlayer) p_75752_1_.getBukkitEntity(); // Cauldron + // Only update first played if it is older than the one we have + long modified = new File(playersDirectory, p_75752_1_.getCommandSenderName() + ".dat").lastModified(); -+ if (modified < player.getFirstPlayed()) { ++ if (modified < player.getFirstPlayed()) ++ { + player.setFirstPlayed(modified); + } + } + // CraftBukkit end -+ p_75752_1_.readFromNBT(nbttagcompound); } -@@ -289,6 +316,27 @@ +@@ -291,6 +318,27 @@ return nbttagcompound; } @@ -133,11 +124,10 @@ public IPlayerFileData getSaveHandler() { return this; -@@ -320,4 +368,97 @@ - { +@@ -323,6 +371,99 @@ return this.saveDirectoryName; } -+ + + // CraftBukkit start + public UUID getUUID() + { @@ -230,4 +220,7 @@ + } + } + // Cauldron end - } ++ + public NBTTagCompound getPlayerNBT(EntityPlayerMP player) + { + try diff --git a/patches/net/minecraftforge/common/ForgeVersion.java.patch b/patches/net/minecraftforge/common/ForgeVersion.java.patch index e3b4c01..7caefc7 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 = 2; //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 = 1291; // Cauldron ++ public static final int buildVersion = 1343; // Cauldron private static Status status = PENDING; private static String target = null; diff --git a/patches/net/minecraftforge/fluids/BlockFluidClassic.java.patch b/patches/net/minecraftforge/fluids/BlockFluidClassic.java.patch new file mode 100644 index 0000000..f715c5e --- /dev/null +++ b/patches/net/minecraftforge/fluids/BlockFluidClassic.java.patch @@ -0,0 +1,65 @@ +--- ../src-base/minecraft/net/minecraftforge/fluids/BlockFluidClassic.java ++++ ../src-work/minecraft/net/minecraftforge/fluids/BlockFluidClassic.java +@@ -133,9 +133,21 @@ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + ++ // Cauldron start ++ org.bukkit.Server server = world.getServer(); ++ org.bukkit.World bworld = world.getWorld(); ++ org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(x, y, z); ++ // Cauldron end ++ + // Flow vertically if possible + if (canDisplace(world, x, y + densityDir, z)) + { ++ // Cauldron start ++ org.bukkit.block.BlockFace face = densityDir < 0 ? org.bukkit.block.BlockFace.DOWN : org.bukkit.block.BlockFace.UP; ++ org.bukkit.event.block.BlockFromToEvent event = new org.bukkit.event.block.BlockFromToEvent(source, face); ++ if (server != null) server.getPluginManager().callEvent(event); ++ if (event.isCancelled()) return; ++ // Cauldron end + flowIntoBlock(world, x, y + densityDir, z, 1); + return; + } +@@ -155,10 +167,38 @@ + } + boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); + +- if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta); ++ // Cauldron start ++ /*if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta); + if (flowTo[1]) flowIntoBlock(world, x + 1, y, z, flowMeta); + if (flowTo[2]) flowIntoBlock(world, x, y, z - 1, flowMeta); +- if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta); ++ if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta);*/ ++ org.bukkit.block.BlockFace[] faces = new org.bukkit.block.BlockFace[] { org.bukkit.block.BlockFace.NORTH, org.bukkit.block.BlockFace.SOUTH, ++ org.bukkit.block.BlockFace.EAST, org.bukkit.block.BlockFace.WEST }; ++ for (int i = 0; i < 4; i++) ++ { ++ if (flowTo[i]) ++ { ++ org.bukkit.event.block.BlockFromToEvent event = new org.bukkit.event.block.BlockFromToEvent(source, faces[i]); ++ if (server != null) server.getPluginManager().callEvent(event); ++ if (event.isCancelled()) continue; ++ switch (i) ++ { ++ case 0: ++ flowIntoBlock(world, x - 1, y, z, flowMeta); ++ break; ++ case 1: ++ flowIntoBlock(world, x + 1, y, z, flowMeta); ++ break; ++ case 2: ++ flowIntoBlock(world, x, y, z - 1, flowMeta); ++ break; ++ case 3: ++ flowIntoBlock(world, x, y, z + 1, flowMeta); ++ break; ++ } ++ } ++ } ++ // Cauldron end + } + } + diff --git a/patches/org/bukkit/Effect.java.patch b/patches/org/bukkit/Effect.java.patch index 0de855a..81c3d46 100644 --- a/patches/org/bukkit/Effect.java.patch +++ b/patches/org/bukkit/Effect.java.patch @@ -8,7 +8,7 @@ import org.bukkit.potion.Potion; /** -@@ -79,27 +80,183 @@ +@@ -79,27 +80,188 @@ /** * The flames seen on a mobspawner; a visual effect. */ @@ -139,6 +139,11 @@ + */ + HAPPY_VILLAGER("happyVillager", Type.PARTICLE), + /** ++ * The smoke particles that appears on blazes, minecarts ++ * with furnaces and fire ++ */ ++ LARGE_SMOKE("largesmoke", Type.PARTICLE), ++ /** + * The particles generated when a tool breaks. + * This particle requires a Material so that the client can select the correct texture. + */ @@ -196,7 +201,7 @@ * @deprecated Magic value */ @Deprecated -@@ -108,6 +265,15 @@ +@@ -108,6 +270,15 @@ } /** @@ -212,7 +217,7 @@ * @return The type of the effect. */ public Type getType() { -@@ -115,8 +281,7 @@ +@@ -115,8 +286,7 @@ } /** @@ -222,7 +227,7 @@ */ public Class getData() { return this.data; -@@ -136,12 +301,32 @@ +@@ -136,12 +306,32 @@ static { for (Effect effect : values()) { diff --git a/patches/org/bukkit/command/defaults/DeopCommand.java.patch b/patches/org/bukkit/command/defaults/DeopCommand.java.patch new file mode 100644 index 0000000..365607a --- /dev/null +++ b/patches/org/bukkit/command/defaults/DeopCommand.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/org/bukkit/command/defaults/DeopCommand.java ++++ ../src-work/minecraft/org/bukkit/command/defaults/DeopCommand.java +@@ -49,9 +49,9 @@ + + if (args.length == 1) { + List completions = new ArrayList(); +- for (OfflinePlayer player : Bukkit.getOfflinePlayers()) { ++ for (OfflinePlayer player : Bukkit.getOperators()) { + String playerName = player.getName(); +- if (player.isOp() && StringUtil.startsWithIgnoreCase(playerName, args[0])) { ++ if (StringUtil.startsWithIgnoreCase(playerName, args[0])) { + completions.add(playerName); + } + } diff --git a/patches/org/bukkit/command/defaults/WhitelistCommand.java.patch b/patches/org/bukkit/command/defaults/WhitelistCommand.java.patch new file mode 100644 index 0000000..7fa5cff --- /dev/null +++ b/patches/org/bukkit/command/defaults/WhitelistCommand.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/org/bukkit/command/defaults/WhitelistCommand.java ++++ ../src-work/minecraft/org/bukkit/command/defaults/WhitelistCommand.java +@@ -104,7 +104,7 @@ + } else if (args.length == 2) { + if (args[0].equalsIgnoreCase("add")) { + List completions = new ArrayList(); +- for (OfflinePlayer player : Bukkit.getOfflinePlayers()) { ++ for (OfflinePlayer player : Bukkit.getOnlinePlayers()) { + String name = player.getName(); + if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) { + completions.add(name); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index a1e5579..6b5b9ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -375,9 +375,10 @@ public class CraftEventFactory { return event; } - public static PlayerDeathEvent callPlayerDeathEvent(net.minecraft.entity.player.EntityPlayerMP victim, List drops, String deathMessage) { + public static PlayerDeathEvent callPlayerDeathEvent(net.minecraft.entity.player.EntityPlayerMP victim, List drops, String deathMessage, boolean keepInventory) { CraftPlayer entity = victim.getBukkitEntity(); PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage); + event.setKeepInventory(keepInventory); //org.bukkit.World world = entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); @@ -386,6 +387,7 @@ public class CraftEventFactory { victim.newTotalExp = event.getNewTotalExp(); victim.expToDrop = event.getDroppedExp(); victim.newExp = event.getNewExp(); + if (event.getKeepInventory()) return event; victim.capturedDrops.clear(); // Cauldron - we must clear pre-capture to avoid duplicates for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { diff --git a/src/main/resources/fmlversion.properties b/src/main/resources/fmlversion.properties index 15a49da..273de10 100644 --- a/src/main/resources/fmlversion.properties +++ b/src/main/resources/fmlversion.properties @@ -1,6 +1,6 @@ fmlbuild.major.number=7 fmlbuild.minor.number=10 -fmlbuild.revision.number=85 -fmlbuild.build.number=1291 +fmlbuild.revision.number=97 +fmlbuild.build.number=1343 fmlbuild.mcversion=1.7.10 fmlbuild.mcpversion=9.05