Fix index problem for chestGUI
This commit is contained in:
parent
b2a2c60dfd
commit
ac69c828a4
3 changed files with 11 additions and 10 deletions
|
@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.10.011024.0005
|
||||
mod_version=1.10.011024.0121
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ChestGUI
|
|||
private String MenuTitle = "";
|
||||
private UUID player;
|
||||
public List<ChestGUIButton> buttons = new ArrayList<>();
|
||||
private ResourceLocation id;
|
||||
private ChestGUIIdentifier id;
|
||||
private int page =0;
|
||||
private boolean hasAdd = false;
|
||||
private boolean hasReset = false;
|
||||
|
@ -95,7 +95,7 @@ public class ChestGUI
|
|||
|
||||
ChestGUIButton rem = new ChestGUIButton(remStack, ()-> {
|
||||
onRemove.run();
|
||||
}, new Vector2i(3, 3));
|
||||
}, new Vector2i(2, 3));
|
||||
|
||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class ChestGUI
|
|||
|
||||
ChestGUIButton rem = new ChestGUIButton(resStack, ()-> {
|
||||
onReset.run();
|
||||
}, new Vector2i(3, 4));
|
||||
}, new Vector2i(2, 4));
|
||||
|
||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class ChestGUI
|
|||
|
||||
ChestGUIButton rem = new ChestGUIButton(remStack, ()-> {
|
||||
onAdd.run();
|
||||
}, new Vector2i(3, 5));
|
||||
}, new Vector2i(2, 5));
|
||||
|
||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||
}
|
||||
|
@ -197,13 +197,13 @@ public class ChestGUI
|
|||
return player.equals(ID);
|
||||
}
|
||||
|
||||
public ChestGUI withGUIId(ResourceLocation id)
|
||||
public ChestGUI withGUIId(ChestGUIIdentifier id)
|
||||
{
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean matches(ResourceLocation id)
|
||||
public boolean matches(ChestGUIIdentifier id)
|
||||
{
|
||||
return this.id.equals(id);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package dev.zontreck.libzontreck.events;
|
||||
|
||||
import dev.zontreck.libzontreck.chestgui.ChestGUI;
|
||||
import dev.zontreck.libzontreck.chestgui.ChestGUIIdentifier;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -11,18 +12,18 @@ import java.util.UUID;
|
|||
|
||||
public class OpenGUIEvent extends Event
|
||||
{
|
||||
private ResourceLocation GUIId;
|
||||
private ChestGUIIdentifier GUIId;
|
||||
private UUID playerID;
|
||||
private final ChestGUI gui;
|
||||
|
||||
public OpenGUIEvent(ResourceLocation ID, UUID player, ChestGUI gui)
|
||||
public OpenGUIEvent(ChestGUIIdentifier ID, UUID player, ChestGUI gui)
|
||||
{
|
||||
GUIId = ID;
|
||||
playerID = player;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public boolean matches(ResourceLocation id)
|
||||
public boolean matches(ChestGUIIdentifier id)
|
||||
{
|
||||
return GUIId.equals(id);
|
||||
}
|
||||
|
|
Reference in a new issue