9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-19 15:09:25 +00:00

Update SprinklerBlock.java

This commit is contained in:
XiaoMoMi
2024-10-03 22:16:14 +08:00
parent 99aa349565
commit a1d5bd7f67

View File

@@ -27,6 +27,7 @@ import net.momirealms.customcrops.api.core.*;
import net.momirealms.customcrops.api.core.mechanic.pot.PotConfig;
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
import net.momirealms.customcrops.api.core.world.CustomCropsChunk;
import net.momirealms.customcrops.api.core.world.CustomCropsWorld;
import net.momirealms.customcrops.api.core.world.Pos3;
import net.momirealms.customcrops.api.core.wrapper.WrappedBreakEvent;
@@ -315,7 +316,10 @@ public class SprinklerBlock extends AbstractCustomCropsBlock {
}
for (Pos3 pos3 : pos3s) {
Optional<CustomCropsBlockState> optionalState = world.getBlockState(pos3);
Optional<CustomCropsChunk> optionalChunk = world.getLoadedChunk(pos3.toChunkPos());
if (optionalChunk.isPresent()) {
CustomCropsChunk chunk = optionalChunk.get();
Optional<CustomCropsBlockState> optionalState = chunk.getBlockState(pos3);
if (optionalState.isPresent()) {
CustomCropsBlockState anotherState = optionalState.get();
if (anotherState.type() instanceof PotBlock potBlock) {
@@ -339,6 +343,7 @@ public class SprinklerBlock extends AbstractCustomCropsBlock {
}
}
}
}
}, bukkitLocation);
}