mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 08:29:05 +00:00
Implemented 1.12 event scripting API.
This commit is contained in:
1 parent
feeef71b5a
commit
bb1da8376d
8 files changed
+174
-87
No files matched your search
@@ -6,7 +6,6 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -32,7 +31,7 @@ import noppes.npcs.scripted.event.PlayerEvent.KeyPressedEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.TossEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
@@ -92,7 +91,7 @@ public class EventHooks {
|
||||
IItemStack[] items = new IItemStack[entityItems.size()];
|
||||
for(int i = 0; i < entityItems.size(); i++){ items[i] = NpcAPI.Instance().getIItemStack(entityItems.get(i).getEntityItem()); }
|
||||
|
||||
TossEvent event = new TossEvent(handler.getPlayer(), items);
|
||||
DropEvent event = new DropEvent(handler.getPlayer(), items);
|
||||
handler.callScript(EnumScriptType.DROP, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -103,6 +102,12 @@ public class EventHooks {
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerToss(PlayerDataScript handler, EntityItem entityItem) {
|
||||
PlayerEvent.TossEvent event = new PlayerEvent.TossEvent(handler.getPlayer(), NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
|
||||
handler.callScript(EnumScriptType.TOSS, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerPickUp(PlayerDataScript handler, EntityItem entityItem) {
|
||||
PickUpEvent event = new PickUpEvent(handler.getPlayer(), new ScriptItemStack(entityItem.getEntityItem()));//NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
|
||||
handler.callScript(EnumScriptType.PICKUP, event,"event", event);
|
||||
|
||||
Reference in new issue
Block a user