mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Add PlayerSetSpawnEvent
This commit is contained in:
1 parent
e280f72cfb
commit
b9f5e152de
4 files changed
+64
-10
No files matched your search
@@ -63,6 +63,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.entity.player.PlayerSetSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
|
||||
@@ -397,6 +398,10 @@ public class ForgeEventFactory
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerFlyableFallEvent(player, distance, multiplier));
|
||||
}
|
||||
|
||||
public static boolean onPlayerSpawnSet(EntityPlayer player, BlockPos pos, boolean forced) {
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerSetSpawnEvent(player, pos, forced));
|
||||
}
|
||||
|
||||
public static void onPlayerClone(EntityPlayer player, EntityPlayer oldPlayer, boolean wasDeath)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerSetSpawnEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is called before a player's spawn point is changed.
|
||||
* The event can be canceled, and no further processing will be done.
|
||||
*/
|
||||
public final boolean forced;
|
||||
public final BlockPos newSpawn;
|
||||
|
||||
public PlayerSetSpawnEvent(EntityPlayer player, BlockPos newSpawn, boolean forced) {
|
||||
super(player);
|
||||
this.newSpawn = newSpawn;
|
||||
this.forced = forced;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user