2022-05-11 01:10:31 -05:00
|
|
|
package noppes.npcs.scripted.event;
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.Cancelable;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.item.IItemCustom;
|
|
|
|
|
import noppes.npcs.api.entity.IEntity;
|
|
|
|
|
import noppes.npcs.api.entity.IPlayer;
|
2022-05-11 01:10:31 -05:00
|
|
|
|
|
|
|
|
public class ItemEvent extends CustomNPCsEvent {
|
2022-05-11 17:12:48 -05:00
|
|
|
public IItemCustom item;
|
2022-05-11 01:10:31 -05:00
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public ItemEvent(IItemCustom item) {
|
2022-05-11 01:10:31 -05:00
|
|
|
this.item = item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class InitEvent extends ItemEvent {
|
2022-05-11 17:12:48 -05:00
|
|
|
public InitEvent(IItemCustom item) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class UpdateEvent extends ItemEvent {
|
2022-05-11 13:30:13 -05:00
|
|
|
public IEntity entity;
|
2022-05-11 01:10:31 -05:00
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public UpdateEvent(IItemCustom item, IEntity entity) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
2022-05-11 13:30:13 -05:00
|
|
|
this.entity = entity;
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class TossedEvent extends ItemEvent {
|
|
|
|
|
public IEntity entity;
|
|
|
|
|
public IPlayer player;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public TossedEvent(IItemCustom item, IPlayer player, IEntity entity) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
this.entity = entity;
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class PickedUpEvent extends ItemEvent {
|
|
|
|
|
public IPlayer player;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public PickedUpEvent(IItemCustom item, IPlayer player) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class SpawnEvent extends ItemEvent {
|
|
|
|
|
public IEntity entity;
|
2022-05-11 17:12:48 -05:00
|
|
|
public SpawnEvent(IItemCustom item, IEntity entity){
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
this.entity = entity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class InteractEvent extends ItemEvent {
|
|
|
|
|
public final int type;
|
|
|
|
|
public final Object target;
|
|
|
|
|
public IPlayer player;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public InteractEvent(IItemCustom item, IPlayer player, int type, Object target) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.target = target;
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class AttackEvent extends ItemEvent {
|
2022-05-11 14:24:12 -05:00
|
|
|
public final int type;//1: Hit, 2: Whiff
|
2022-05-11 01:10:31 -05:00
|
|
|
public final Object target;
|
2022-05-11 13:30:13 -05:00
|
|
|
public IEntity swingingEntity;
|
2022-05-11 01:10:31 -05:00
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public AttackEvent(IItemCustom item, IEntity swingingEntity, int type, Object target) {
|
2022-05-11 01:10:31 -05:00
|
|
|
super(item);
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.target = target;
|
2022-05-11 13:30:13 -05:00
|
|
|
this.swingingEntity = swingingEntity;
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 14:24:12 -05:00
|
|
|
public static class StartUsingItem extends ItemEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public StartUsingItem(IItemCustom item, IPlayer player, int duration){
|
2022-05-11 14:24:12 -05:00
|
|
|
super(item);
|
|
|
|
|
this.player = player;
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class UsingItem extends ItemEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public UsingItem(IItemCustom item, IPlayer player, int duration){
|
2022-05-11 14:24:12 -05:00
|
|
|
super(item);
|
|
|
|
|
this.player = player;
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class StopUsingItem extends ItemEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public StopUsingItem(IItemCustom item, IPlayer player, int duration){
|
2022-05-11 14:24:12 -05:00
|
|
|
super(item);
|
|
|
|
|
this.player = player;
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class FinishUsingItem extends ItemEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
public FinishUsingItem(IItemCustom item, IPlayer player, int duration){
|
2022-05-11 14:24:12 -05:00
|
|
|
super(item);
|
|
|
|
|
this.player = player;
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|