Chest GUI API now completed
This commit is contained in:
parent
01a6f1ddc7
commit
0fb37b1633
19 changed files with 436 additions and 239 deletions
|
@ -0,0 +1,19 @@
|
|||
package dev.zontreck.libzontreck.events;
|
||||
|
||||
import dev.zontreck.libzontreck.chestgui.ChestGUI;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
public class CloseGUIEvent extends Event
|
||||
{
|
||||
public ChestGUI gui;
|
||||
public Player player;
|
||||
|
||||
public CloseGUIEvent(ChestGUI gui, ServerPlayer player)
|
||||
{
|
||||
this.gui = gui;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.libzontreck.events;
|
||||
|
||||
import dev.zontreck.libzontreck.chestgui.ChestGUI;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -8,16 +9,17 @@ import net.minecraftforge.eventbus.api.Event;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
@Cancelable
|
||||
public class OpenGUIEvent extends Event
|
||||
{
|
||||
private ResourceLocation GUIId;
|
||||
private UUID playerID;
|
||||
private final ChestGUI gui;
|
||||
|
||||
public OpenGUIEvent(ResourceLocation ID, UUID player)
|
||||
public OpenGUIEvent(ResourceLocation ID, UUID player, ChestGUI gui)
|
||||
{
|
||||
GUIId = ID;
|
||||
playerID = player;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public boolean matches(ResourceLocation id)
|
||||
|
@ -27,6 +29,10 @@ public class OpenGUIEvent extends Event
|
|||
|
||||
public ServerPlayer getPlayer()
|
||||
{
|
||||
return ServerUtilities.getPlayerByID(getPlayer().getStringUUID());
|
||||
return ServerUtilities.getPlayerByID(playerID.toString());
|
||||
}
|
||||
|
||||
public ChestGUI getGui() {
|
||||
return gui;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue