mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 18:45:09 +00:00
Add PlayerEvent.StartTracking and .StopTracking & make trackedEntityIDs visible
& Update, as discussed on IRC (squash)
This commit is contained in:
1 parent
4a6a49e073
commit
deb5df542e
4 files changed
+92
No files matched your search
@@ -155,4 +155,14 @@ public class ForgeEventFactory
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.result;
|
||||
}
|
||||
|
||||
public static void onStartEntityTracking(Entity entity, EntityPlayer player)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StartTracking(player, entity));
|
||||
}
|
||||
|
||||
public static void onStopEntityTracking(Entity entity, EntityPlayer player)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerEvent.StopTracking(player, entity));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
@@ -92,4 +93,42 @@ public class PlayerEvent extends LivingEvent
|
||||
this.wasDeath = wasDeath;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StartTracking extends PlayerEvent {
|
||||
|
||||
/**
|
||||
* The Entity now being tracked.
|
||||
*/
|
||||
public final Entity target;
|
||||
|
||||
public StartTracking(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StopTracking extends PlayerEvent {
|
||||
|
||||
/**
|
||||
* The Entity no longer being tracked.
|
||||
*/
|
||||
public final Entity target;
|
||||
|
||||
public StopTracking(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user