Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Let Forge do !isDead heavylifting
Browse files Browse the repository at this point in the history
  • Loading branch information
robotia committed Mar 3, 2016
1 parent ae249f2 commit f088b4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
3 changes: 2 additions & 1 deletion patches/net/minecraft/entity/Entity.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
private UUID persistentID;

- protected HashMap<String, IExtendedEntityProperties> extendedProperties;
+ // Spigot start
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
+ public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
Expand All @@ -92,7 +93,7 @@
+ public boolean fromMobSpawner;
+ public void inactiveTick() { }
+ // Spigot end
protected HashMap<String, IExtendedEntityProperties> extendedProperties;
+ public HashMap<String, IExtendedEntityProperties> extendedProperties;
+ public String spawnReason; // Cauldron - used to handle CraftBukkit's SpawnReason with CustomSpawners

public int getEntityId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@
public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_)
{
UUID uuid = EntityPlayer.func_146094_a(p_148545_1_);
@@ -410,80 +621,262 @@
@@ -410,80 +621,275 @@
return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object);
}

Expand Down Expand Up @@ -533,15 +533,28 @@
+ entityplayermp1.playerNetServerHandler.playerEntity = entityplayermp1;
+ if(!isdeath)
+ {
+ entityplayermp1.inventory.copyInventory(par1EntityPlayerMP.inventory);
+ entityplayermp1.clonePlayer(par1EntityPlayerMP, true);
+ entityplayermp1.activePotionsMap.clear();
+ entityplayermp1.activePotionsMap.putAll(par1EntityPlayerMP.activePotionsMap);
+ //Let Forge do the heavy lifting...
+ /*entityplayermp1.inventory.copyInventory(par1EntityPlayerMP.inventory);
+ entityplayermp1.experienceLevel = par1EntityPlayerMP.experienceLevel;
+ entityplayermp1.experienceTotal = par1EntityPlayerMP.experienceTotal;
+ entityplayermp1.experience = par1EntityPlayerMP.experience;
+ entityplayermp1.setHealth(par1EntityPlayerMP.getHealth());
+ entityplayermp1.foodStats = par1EntityPlayerMP.foodStats;
+ entityplayermp1.setScore(par1EntityPlayerMP.getScore());
+ entityplayermp1.teleportDirection = par1EntityPlayerMP.teleportDirection;
+ //Copy and re-init ExtendedProperties when switching dimensions.
+ entityplayermp1.extendedProperties = par1EntityPlayerMP.extendedProperties;
+ for (net.minecraftforge.common.IExtendedEntityProperties p : par1EntityPlayerMP.extendedProperties.values())
+ p.init(this, this.worldObj);
+
+ entityplayermp1.activePotionsMap.clear();
+ entityplayermp1.activePotionsMap.putAll(par1EntityPlayerMP.activePotionsMap);
+ entityplayermp1.setScore(par1EntityPlayerMP.getScore());
+ entityplayermp1.setScore(par1EntityPlayerMP.getScore());*/
+ }
+ entityplayermp1.clonePlayer(par1EntityPlayerMP, returnFromEnd);
+ else entityplayermp1.clonePlayer(par1EntityPlayerMP, returnFromEnd);
+ // entityplayermp1.dimension = targetDimension; Thermos move this call to later when actualDimension is found
+ // HEY don't setWorld here either, that has to down to the bottom
+ entityplayermp1.setEntityId(par1EntityPlayerMP.getEntityId());
Expand Down Expand Up @@ -690,7 +703,7 @@
return entityplayermp1;
}

@@ -492,34 +885,112 @@
@@ -492,34 +898,112 @@
transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter());
}

Expand Down Expand Up @@ -822,7 +835,7 @@
}

public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter)
@@ -605,6 +1076,109 @@
@@ -605,6 +1089,109 @@
p_82448_1_.setWorld(p_82448_4_);
}

Expand Down Expand Up @@ -932,7 +945,7 @@
public void sendPlayerInfoToAllPlayers()
{
if (++this.playerPingIndex > 600)
@@ -612,11 +1186,13 @@
@@ -612,11 +1199,13 @@
this.playerPingIndex = 0;
}

Expand All @@ -946,7 +959,7 @@
}

public void sendPacketToAllPlayers(Packet p_148540_1_)
@@ -877,13 +1453,24 @@
@@ -877,13 +1466,24 @@
for (int j = 0; j < this.playerEntityList.size(); ++j)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j);
Expand All @@ -973,7 +986,7 @@
if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_)
{
entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_);
@@ -941,13 +1528,16 @@
@@ -941,13 +1541,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)));
Expand All @@ -991,7 +1004,7 @@
p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
}

@@ -961,9 +1551,17 @@
@@ -961,9 +1564,17 @@
return this.maxPlayers;
}

Expand All @@ -1010,7 +1023,7 @@
}

public void setWhiteListEnabled(boolean p_72371_1_)
@@ -1032,12 +1630,30 @@
@@ -1032,12 +1643,30 @@

public void removeAllPlayers()
{
Expand Down

0 comments on commit f088b4f

Please sign in to comment.