diff options
author | Vixid <52578495+VixidDev@users.noreply.github.com> | 2023-10-07 07:18:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-07 17:18:25 +1100 |
commit | 87cf5fde69c76b8dee87790f18ee8b3283d86c09 (patch) | |
tree | c2eec259efca01cff3f2baf75a48f647e2b70f9f /src/main | |
parent | e3863946cf55a1d2d4767174c44f17918df4df0d (diff) | |
download | NotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.tar.gz NotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.tar.bz2 NotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.zip |
Fix Disconnects when Farming (#850)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 22 |
1 files changed, 12 insertions, 10 deletions
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() { |