Robotia 9 years ago
parent
commit
adbc0ead65
  1. 33
      patches/net/minecraft/server/management/ServerConfigurationManager.java.patch
  2. 22
      src/main/java/kcauldron/Coords.java

33
patches/net/minecraft/server/management/ServerConfigurationManager.java.patch

@ -380,7 +380,7 @@
public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_) public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_)
{ {
UUID uuid = EntityPlayer.func_146094_a(p_148545_1_); UUID uuid = EntityPlayer.func_146094_a(p_148545_1_);
@@ -410,80 +619,213 @@ @@ -410,80 +619,207 @@
return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object); return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object);
} }
@ -480,7 +480,7 @@
+ Bukkit.getServer().getPluginManager().callEvent(event); + Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled() || event.getTo() == null) + if (event.isCancelled() || event.getTo() == null)
+ { + {
+ return par1EntityPlayerMP; + return null;
+ } + }
} }
@ -501,18 +501,12 @@
+ // Phase 4 - handle bed spawn + // Phase 4 - handle bed spawn
+ ChunkCoordinates bedSpawnChunkCoords = par1EntityPlayerMP.getBedLocation(targetDimension); + ChunkCoordinates bedSpawnChunkCoords = par1EntityPlayerMP.getBedLocation(targetDimension);
+ boolean spawnForced = par1EntityPlayerMP.isSpawnForced(targetDimension); + boolean spawnForced = par1EntityPlayerMP.isSpawnForced(targetDimension);
+ // CraftBukkit start
+ par1EntityPlayerMP.dimension = targetDimension; + par1EntityPlayerMP.dimension = targetDimension;
+// EntityPlayerMP entityplayermp1 = par1EntityPlayerMP; + // CraftBukkit start
+ EntityPlayerMP entityplayermp1 = new EntityPlayerMP(mcServer, mcServer.worldServerForDimension(targetDimension), par1EntityPlayerMP.getGameProfile(), new ItemInWorldManager(mcServer.worldServerForDimension(targetDimension))); + EntityPlayerMP entityplayermp1 = par1EntityPlayerMP;
+ entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler;
+ entityplayermp1.playerNetServerHandler.playerEntity = entityplayermp1;
+ entityplayermp1.clonePlayer(par1EntityPlayerMP, cause != TeleportCause.DEATH); // KCauldron - clone player + entityplayermp1.clonePlayer(par1EntityPlayerMP, cause != TeleportCause.DEATH); // KCauldron - clone player
+ entityplayermp1.setWorld(this.mcServer.worldServerForDimension(targetDimension)); // make sure to update reference for bed spawn logic + entityplayermp1.setWorld(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension)); // make sure to update reference for bed spawn logic
+ entityplayermp1.playerConqueredTheEnd = false; + entityplayermp1.playerConqueredTheEnd = false;
+ entityplayermp1.setEntityId(par1EntityPlayerMP.getEntityId());
+ func_72381_a(entityplayermp1, par1EntityPlayerMP, mcServer.worldServerForDimension(targetDimension));
+
ChunkCoordinates chunkcoordinates1; ChunkCoordinates chunkcoordinates1;
+ boolean isBedSpawn = false; + boolean isBedSpawn = false;
+ org.bukkit.World toWorld = entityplayermp1.getBukkitEntity().getWorld(); + org.bukkit.World toWorld = entityplayermp1.getBukkitEntity().getWorld();
@ -634,7 +628,7 @@
return entityplayermp1; return entityplayermp1;
} }
@@ -492,34 +834,112 @@ @@ -492,34 +828,112 @@
transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter()); transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter());
} }
@ -766,7 +760,7 @@
} }
public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter) public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter)
@@ -605,6 +1025,109 @@ @@ -605,6 +1019,109 @@
p_82448_1_.setWorld(p_82448_4_); p_82448_1_.setWorld(p_82448_4_);
} }
@ -876,7 +870,7 @@
public void sendPlayerInfoToAllPlayers() public void sendPlayerInfoToAllPlayers()
{ {
if (++this.playerPingIndex > 600) if (++this.playerPingIndex > 600)
@@ -612,11 +1135,13 @@ @@ -612,11 +1129,13 @@
this.playerPingIndex = 0; this.playerPingIndex = 0;
} }
@ -890,7 +884,7 @@
} }
public void sendPacketToAllPlayers(Packet p_148540_1_) public void sendPacketToAllPlayers(Packet p_148540_1_)
@@ -877,13 +1402,24 @@ @@ -877,13 +1396,24 @@
for (int j = 0; j < this.playerEntityList.size(); ++j) for (int j = 0; j < this.playerEntityList.size(); ++j)
{ {
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j); EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j);
@ -917,7 +911,7 @@
if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_) if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_)
{ {
entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_);
@@ -941,13 +1477,16 @@ @@ -941,13 +1471,16 @@
p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F)); 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(7, p_72354_2_.getRainStrength(1.0F)));
p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F))); p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F)));
@ -935,7 +929,7 @@
p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
} }
@@ -961,9 +1500,17 @@ @@ -961,9 +1494,17 @@
return this.maxPlayers; return this.maxPlayers;
} }
@ -954,7 +948,7 @@
} }
public void setWhiteListEnabled(boolean p_72371_1_) public void setWhiteListEnabled(boolean p_72371_1_)
@@ -1032,11 +1579,29 @@ @@ -1032,11 +1573,29 @@
public void removeAllPlayers() public void removeAllPlayers()
{ {
@ -986,9 +980,10 @@
public void sendChatMsgImpl(IChatComponent p_148544_1_, boolean p_148544_2_) public void sendChatMsgImpl(IChatComponent p_148544_1_, boolean p_148544_2_)
{ {
@@ -1103,4 +1668,4 @@ @@ -1103,4 +1662,4 @@
{ {
return this.whiteListEnforced; return this.whiteListEnforced;
} }
-} -}
+} +}

22
src/main/java/kcauldron/Coords.java

@ -1,22 +0,0 @@
public class Coords
{
public final int[] c;
private final int hash;
public Coords (int x, int y, int z)
{
this.c = new int[] { x, y, z };
this.hash = ((y * 31 + x) * 31 + z) * 17 + y;
}
@Override
public int hashCode()
{
return this.hash;
}
@Override
public boolean equals(Object o)
{
if(!(o instanceof Coords))return false;
Coords c = (Coords)o;
return this.c[0] == c.c[0] && this.c[1] == c.c[1] && this.c[2] == c.c[2];
}
}
Loading…
Cancel
Save