Implemented custom GUIs.

This commit is contained in:
luisc committed 2022-01-12 04:44:08 -06:00
1 parent d50f51e208
commit 6b9cfb9d25
40 files changed
+3136 -92

No files matched your search

+24
View File
@@ -18,6 +18,7 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.controllers.CustomGuiController;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
@@ -33,6 +34,7 @@ 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.DropEvent;
import noppes.npcs.scripted.interfaces.ICustomGui;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IWorld;
@@ -47,6 +49,8 @@ public class EventHooks {
public EventHooks() {
}
public static void onNPCTimer(EntityNPCInterface npc, int id) {
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
@@ -311,4 +315,24 @@ public class EventHooks {
}
}
public static void onCustomGuiButton(ScriptPlayer player, ICustomGui gui, int buttonId) {
CustomGuiEvent.ButtonEvent event = new CustomGuiEvent.ButtonEvent(player, gui, buttonId);
CustomGuiController.onButton(event);
}
public static void onCustomGuiSlot(ScriptPlayer player, ICustomGui gui, int slotId) {
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId));
CustomGuiController.onSlotChange(event);
}
public static void onCustomGuiScrollClick(ScriptPlayer player, ICustomGui gui, int scrollId, int scrollIndex, String[] selection, boolean doubleClick) {
CustomGuiEvent.ScrollEvent event = new CustomGuiEvent.ScrollEvent(player, gui, scrollId, scrollIndex, selection, doubleClick);
CustomGuiController.onScrollClick(event);
}
public static void onCustomGuiClose(ScriptPlayer player, ICustomGui gui) {
noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent event = new noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent(player, gui);
CustomGuiController.onClose(event);
}
}