mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 21:59:05 +00:00
Fixed null pointer exceptions from new custom gui slot commit.
This commit is contained in:
1 parent
586c451f06
commit
e3405d22e9
4 files changed
+25
-10
No files matched your search
@@ -123,7 +123,11 @@ public class CustomGuiEvent extends CustomNPCsEvent implements ICustomGuiEvent {
|
||||
super(player, gui);
|
||||
this.slotId = slotId;
|
||||
this.stack = stack;
|
||||
this.slot = (IItemSlot) gui.getComponent(((CustomGuiSlot)(((EntityPlayerMP)player.getMCEntity()).openContainer.getSlot(slotId))).guiSlotId);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHookName() {
|
||||
@@ -150,13 +154,17 @@ public class CustomGuiEvent extends CustomNPCsEvent implements ICustomGuiEvent {
|
||||
*/
|
||||
public final int clickType;
|
||||
|
||||
public SlotClickEvent(IPlayer player, ICustomGui gui, int slotId, int guiSlotId, IItemStack stack, int dragType, int clickType) {
|
||||
public SlotClickEvent(IPlayer player, ICustomGui gui, int slotId, CustomGuiSlot guiSlot, IItemStack stack, int dragType, int clickType) {
|
||||
super(player,gui);
|
||||
this.slotId = slotId;
|
||||
this.stack = stack;
|
||||
this.dragType = dragType;
|
||||
this.clickType = clickType;
|
||||
this.slot = (IItemSlot) gui.getComponent(guiSlotId);
|
||||
if (guiSlot != null) {
|
||||
this.slot = (IItemSlot) gui.getComponent(guiSlot.guiSlotId);
|
||||
} else {
|
||||
this.slot = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHookName() {
|
||||
|
||||
Reference in new issue
Block a user