aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVixid <52578495+VixidDev@users.noreply.github.com>2023-10-07 07:18:25 +0100
committerGitHub <noreply@github.com>2023-10-07 17:18:25 +1100
commit87cf5fde69c76b8dee87790f18ee8b3283d86c09 (patch)
treec2eec259efca01cff3f2baf75a48f647e2b70f9f
parente3863946cf55a1d2d4767174c44f17918df4df0d (diff)
downloadNotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.tar.gz
NotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.tar.bz2
NotEnoughUpdates-87cf5fde69c76b8dee87790f18ee8b3283d86c09.zip
Fix Disconnects when Farming (#850)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java22
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() {