From 87cf5fde69c76b8dee87790f18ee8b3283d86c09 Mon Sep 17 00:00:00 2001 From: Vixid <52578495+VixidDev@users.noreply.github.com> Date: Sat, 7 Oct 2023 07:18:25 +0100 Subject: Fix Disconnects when Farming (#850) --- .../miscfeatures/ItemCooldowns.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index bab7def6..2c807065 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -168,19 +168,21 @@ public class ItemCooldowns { } public static void checkForBlockChange(BlockPos pos, IBlockState blockState) { - BlockData oldBlockData = null; + Minecraft.getMinecraft().addScheduledTask(() -> { + BlockData oldBlockData = null; - for (BlockData value : blocksClicked.values()) { - if (value.blockPos.equals(pos)) oldBlockData = value; - } + for (BlockData value : blocksClicked.values()) { + if (value.blockPos.equals(pos)) oldBlockData = value; + } - if (oldBlockData != null) { - IBlockState oldState = oldBlockData.blockState; - if ((oldState.getBlock() == Blocks.log || oldState.getBlock() == Blocks.log2) && - blockState.getBlock() == Blocks.air) { - onBlockMined(); + if (oldBlockData != null) { + IBlockState oldState = oldBlockData.blockState; + if ((oldState.getBlock() == Blocks.log || oldState.getBlock() == Blocks.log2) && + blockState.getBlock() == Blocks.air) { + onBlockMined(); + } } - } + }); } public static void onBlockMined() { -- cgit