From 81086375e88e58433724fe79bf8ea10fee24807e Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Sun, 7 Dec 2014 05:48:02 -0800 Subject: [PATCH] Expand PlayerWakupEvent to expose the three parameters passed into EntityPlayer.wakeUp. Closes #1486 --- .../entity/player/EntityPlayer.java.patch | 6 ++--- .../entity/player/PlayerWakeUpEvent.java | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index d7d3003ba..70a55709a 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -77,7 +77,7 @@ + { + this.func_71010_c(itemstack, 5); + } -+ ++ + if (--this.field_71072_f == 0 && !this.field_70170_p.field_72995_K) + { + this.func_71036_o(); @@ -384,7 +384,7 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { -+ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerWakeUpEvent(this)); ++ MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerWakeUpEvent(this, p_70999_1_, p_70999_2_, p_70999_3_)); this.func_70105_a(0.6F, 1.8F); this.func_71061_d_(); ChunkCoordinates chunkcoordinates = this.field_71081_bT; @@ -642,7 +642,7 @@ + + public float eyeHeight; + private String displayname; -+ ++ + /** + * Returns the default eye height of the player + * @return player default eye height diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java index 3483ef5f3..a87511a1e 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java @@ -9,8 +9,34 @@ import net.minecraft.entity.player.EntityPlayer; */ public class PlayerWakeUpEvent extends PlayerEvent { + @Deprecated //ToDo: Remove in 1.8 public PlayerWakeUpEvent(EntityPlayer player) + { + this(player, false, false, false); + } + /** + * Used for the 'wake up animation'. + * This is false if the player is considered 'sleepy' and the overlay should slowly fade away. + */ + public final boolean wakeImmediatly; + + /** + * Indicates if the server should be notified of sleeping changes. + * This will only be false if the server is considered 'up to date' already, because, for example, it initiated the call. + */ + public final boolean updateWorld; + + /** + * Indicates if the player's sleep was considered successful. + * In vanilla, this is used to determine if the spawn chunk is to be set to the bed's position. + */ + public final boolean setSpawn; + + public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediatly, boolean updateWorld, boolean setSpawn) { super(player); + this.wakeImmediatly = wakeImmediatly; + this.updateWorld = updateWorld; + this.setSpawn = setSpawn; } }