Expand PlayerWakupEvent to expose the three parameters passed into EntityPlayer.wakeUp.

This commit is contained in:
Lex Manos 2014-12-07 05:48:26 -08:00
parent fd3f948e4c
commit f9955efb08
3 changed files with 25 additions and 4 deletions

View file

@ -306,7 +306,7 @@
public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_)
{
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_);
this.func_70105_a(0.6F, 1.8F);
IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT);

View file

@ -340,9 +340,9 @@ public class ForgeEventFactory
return event.result;
}
public static void onPlayerWakeup(EntityPlayer player)
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediatly, boolean updateWorldFlag, boolean setSpawn)
{
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player));
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediatly, updateWorldFlag, setSpawn));
}
public static void onPlayerFall(EntityPlayer player, float distance, float multiplier)

View file

@ -9,8 +9,29 @@ import net.minecraft.entity.player.EntityPlayer;
*/
public class PlayerWakeUpEvent extends PlayerEvent
{
public PlayerWakeUpEvent(EntityPlayer player)
/**
* 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;
}
}