Attempt to fix multiple clicks being triggered in chestgui
This commit is contained in:
parent
5372fd2129
commit
d773f34376
2 changed files with 5 additions and 3 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.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.10.011424.1952
|
mod_version=1.10.011524.0023
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -16,13 +16,13 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler
|
||||||
private ChestGUI gui;
|
private ChestGUI gui;
|
||||||
private Player player;
|
private Player player;
|
||||||
private long lastClickTime;
|
private long lastClickTime;
|
||||||
private int lastClickStack;
|
private int lastClickStack=-1;
|
||||||
|
|
||||||
public boolean validClick(int slot)
|
public boolean validClick(int slot)
|
||||||
{
|
{
|
||||||
if(lastClickStack != slot)return true;
|
if(lastClickStack != slot)return true;
|
||||||
else{
|
else{
|
||||||
if(Instant.now().getEpochSecond() > (lastClickTime + 1))
|
if(Instant.now().getEpochSecond() > (lastClickTime + 3))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -100,4 +100,6 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler
|
||||||
|
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue