Attempt to fix multiple clicks being triggered in chestgui
This commit is contained in:
parent
d773f34376
commit
bef8f89f97
2 changed files with 12 additions and 2 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.011524.0023
|
mod_version=1.10.011524.0036
|
||||||
# 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
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -155,8 +156,17 @@ public class ChestGUIButton
|
||||||
return (int) Math.floor((position.x * 9) + position.y);
|
return (int) Math.floor((position.x * 9) + position.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long lastInvoked = 0;
|
||||||
|
/**
|
||||||
|
* Button was clicked!
|
||||||
|
*/
|
||||||
public void clicked()
|
public void clicked()
|
||||||
{
|
{
|
||||||
|
if(Instant.now().getEpochSecond() > (lastInvoked + 3))
|
||||||
|
{
|
||||||
|
|
||||||
|
lastInvoked = Instant.now().getEpochSecond();
|
||||||
callback.run(built, container, lore);
|
callback.run(built, container, lore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Reference in a new issue