public Map<BlockPos, Integer> map = new HashMap<>();
@SubscribeEvent
public void cooldownChest(PlayerInteractEvent.RightClickBlock e)
{
if(map.get(e.getPos()) == e.getEntityPlayer().world.getTotalWorldTime())
{
e.setCancelled(true);
// getTotalWorldTime всегда будет больше чем 0
map.put(e.getPos(), 0);
}
map.put(e.getPos(), 0);
if(e.getEntityPlayer().world.getBlockState(e.getPos()).getBlock() == Blocks.CHEST)
{
if(map.get(e.getPos()) < e.getEntityPlayer().world.getTotalWorldTime())
{
// 20 тиков = 1 секунда. 10 секунд = 200 тиков
map.put(e.getPos()...
public Map<BlockPos, Integer> map = new HashMap<>();
@SubscribeEvent
public void cooldownChest(PlayerInteractEvent.RightClickBlock e)
{
if(map.get(e.getPos()) == e.getEntityPlayer().world.getTotalWorldTime())
{
e.setCancelled(true);
// getTotalWorldTime всегда будет больше чем 0
map.put(e.getPos(), 0);
}
map.put(e.getPos(), 0);
if(e.getEntityPlayer().world.getBlockState(e.getPos()).getBlock() == Blocks.CHEST)
{
if(map.get(e.getPos()) < e.getEntityPlayer().world.getTotalWorldTime())
{
// 20 тиков = 1 секунда. 10 секунд = 200 тиков
map.put(e.getPos(), e.getEntityPlayer().world.getTotalWorldTime() + 200);
}
}
}