Implemented custom item rotation rate, and start using, using, stop using, finished using events for custom items.

This commit is contained in:
Luis C.M committed 2022-05-11 14:24:12 -05:00
1 parent 11cc46b48f
commit aab550cdca
7 files changed
+212 -36

No files matched your search

@@ -1,20 +1,23 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.scripted.entity.ScriptEntity;
import net.minecraft.item.ItemStack;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.ICustomItem;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.item.ScriptCustomItem;
public class ItemEvent extends CustomNPCsEvent {
public ScriptCustomItem item;
public ICustomItem item;
public ItemEvent(ScriptCustomItem item) {
public ItemEvent(ICustomItem item) {
this.item = item;
}
public static class InitEvent extends ItemEvent {
public InitEvent(ScriptCustomItem item) {
public InitEvent(ICustomItem item) {
super(item);
}
}
@@ -22,7 +25,7 @@ public class ItemEvent extends CustomNPCsEvent {
public static class UpdateEvent extends ItemEvent {
public IEntity entity;
public UpdateEvent(ScriptCustomItem item, IEntity entity) {
public UpdateEvent(ICustomItem item, IEntity entity) {
super(item);
this.entity = entity;
}
@@ -33,7 +36,7 @@ public class ItemEvent extends CustomNPCsEvent {
public IEntity entity;
public IPlayer player;
public TossedEvent(ScriptCustomItem item, IPlayer player, IEntity entity) {
public TossedEvent(ICustomItem item, IPlayer player, IEntity entity) {
super(item);
this.entity = entity;
this.player = player;
@@ -43,7 +46,7 @@ public class ItemEvent extends CustomNPCsEvent {
public static class PickedUpEvent extends ItemEvent {
public IPlayer player;
public PickedUpEvent(ScriptCustomItem item, IPlayer player) {
public PickedUpEvent(ICustomItem item, IPlayer player) {
super(item);
this.player = player;
}
@@ -52,7 +55,7 @@ public class ItemEvent extends CustomNPCsEvent {
@Cancelable
public static class SpawnEvent extends ItemEvent {
public IEntity entity;
public SpawnEvent(ScriptCustomItem item, IEntity entity){
public SpawnEvent(ICustomItem item, IEntity entity){
super(item);
this.entity = entity;
}
@@ -64,7 +67,7 @@ public class ItemEvent extends CustomNPCsEvent {
public final Object target;
public IPlayer player;
public InteractEvent(ScriptCustomItem item, IPlayer player, int type, Object target) {
public InteractEvent(ICustomItem item, IPlayer player, int type, Object target) {
super(item);
this.type = type;
this.target = target;
@@ -74,11 +77,11 @@ public class ItemEvent extends CustomNPCsEvent {
@Cancelable
public static class AttackEvent extends ItemEvent {
public final int type;//1: Hit, 2: Whiff //TODO: Implement type 2
public final int type;//1: Hit, 2: Whiff
public final Object target;
public IEntity swingingEntity;
public AttackEvent(ScriptCustomItem item, IEntity swingingEntity, int type, Object target) {
public AttackEvent(ICustomItem item, IEntity swingingEntity, int type, Object target) {
super(item);
this.type = type;
this.target = target;
@@ -86,4 +89,44 @@ public class ItemEvent extends CustomNPCsEvent {
}
}
public static class StartUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public StartUsingItem(ICustomItem item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class UsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public UsingItem(ICustomItem item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class StopUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public StopUsingItem(ICustomItem item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class FinishUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public FinishUsingItem(ICustomItem item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
}