diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 4ad85e0a1..e7f1c0f41 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -509,7 +509,7 @@ } else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { -@@ -1876,6 +2024,17 @@ +@@ -1876,6 +2024,18 @@ } this.field_71078_a = p_71049_1_.field_71078_a; @@ -524,10 +524,11 @@ + { + getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74775_l(PERSISTED_NBT_TAG)); + } ++ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerEvent.Clone(p_71049_1_, this, !p_71049_2_)); } protected boolean func_70041_e_() -@@ -1914,7 +2073,14 @@ +@@ -1914,7 +2074,14 @@ public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) { @@ -543,7 +544,7 @@ } @SideOnly(Side.CLIENT) -@@ -1959,7 +2125,7 @@ +@@ -1959,7 +2126,7 @@ public IChatComponent func_145748_c_() { @@ -552,7 +553,7 @@ chatcomponenttext.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); return chatcomponenttext; } -@@ -2042,6 +2208,118 @@ +@@ -2042,6 +2209,118 @@ FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); } diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index f57bc6768..9feb50318 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -68,4 +68,28 @@ public class PlayerEvent extends LivingEvent this.displayname = username; } } + + /** + * Fired when the EntityPlayer is cloned, typically caused by the network sending a RESPAWN_PLAYER event. + * Either caused by death, or by traveling from the End to the overworld. + */ + public static class Clone extends PlayerEvent + { + /** + * The old EntityPlayer that this new entity is a clone of. + */ + public final EntityPlayer original; + /** + * True if this event was fired because the player died. + * False if it was fired because the entity switched dimensions. + */ + public final boolean wasDeath; + + public Clone(EntityPlayer _new, EntityPlayer oldPlayer, boolean wasDeath) + { + super(_new); + this.original = oldPlayer; + this.wasDeath = wasDeath; + } + } }