mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 20:22:37 +00:00
Fixed custom gui slot behavior
This commit is contained in:
1 parent
e3405d22e9
commit
80352741b9
8 files changed
+113
-124
No files matched your search
@@ -2,6 +2,7 @@ package noppes.npcs.scripted.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.event.ICustomGuiEvent;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
@@ -9,6 +10,7 @@ import noppes.npcs.api.gui.IItemSlot;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
public class CustomGuiEvent extends CustomNPCsEvent implements ICustomGuiEvent {
|
||||
public final IPlayer player;
|
||||
@@ -119,15 +121,11 @@ public class CustomGuiEvent extends CustomNPCsEvent implements ICustomGuiEvent {
|
||||
public final IItemStack stack;
|
||||
public final IItemSlot slot;
|
||||
|
||||
public SlotEvent(IPlayer player, ICustomGui gui, int slotId, IItemStack stack) {
|
||||
public SlotEvent(IPlayer player, ICustomGui gui, int slotId, ItemStack stack, IItemSlot slot) {
|
||||
super(player, gui);
|
||||
this.slotId = slotId;
|
||||
this.stack = stack;
|
||||
if ((((EntityPlayerMP)player.getMCEntity()).openContainer.getSlot(slotId) instanceof CustomGuiSlot)) {
|
||||
this.slot = (IItemSlot) gui.getComponent(((CustomGuiSlot) (((EntityPlayerMP) player.getMCEntity()).openContainer.getSlot(slotId))).guiSlotId);
|
||||
} else {
|
||||
this.slot = null;
|
||||
}
|
||||
this.stack = NpcAPI.Instance().getIItemStack(stack);
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public String getHookName() {
|
||||
@@ -154,17 +152,13 @@ public class CustomGuiEvent extends CustomNPCsEvent implements ICustomGuiEvent {
|
||||
*/
|
||||
public final int clickType;
|
||||
|
||||
public SlotClickEvent(IPlayer player, ICustomGui gui, int slotId, CustomGuiSlot guiSlot, IItemStack stack, int dragType, int clickType) {
|
||||
public SlotClickEvent(IPlayer player, ICustomGui gui, int slotId, IItemSlot slot, IItemStack stack, int dragType, int clickType) {
|
||||
super(player,gui);
|
||||
this.slotId = slotId;
|
||||
this.stack = stack;
|
||||
this.dragType = dragType;
|
||||
this.clickType = clickType;
|
||||
if (guiSlot != null) {
|
||||
this.slot = (IItemSlot) gui.getComponent(guiSlot.guiSlotId);
|
||||
} else {
|
||||
this.slot = null;
|
||||
}
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public String getHookName() {
|
||||
|
||||
Reference in new issue
Block a user