mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-20 15:39:21 +00:00
Update SprinklerBlock.java
This commit is contained in:
@@ -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.pot.PotConfig;
|
||||||
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
import net.momirealms.customcrops.api.core.mechanic.sprinkler.SprinklerConfig;
|
||||||
import net.momirealms.customcrops.api.core.world.CustomCropsBlockState;
|
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.CustomCropsWorld;
|
||||||
import net.momirealms.customcrops.api.core.world.Pos3;
|
import net.momirealms.customcrops.api.core.world.Pos3;
|
||||||
import net.momirealms.customcrops.api.core.wrapper.WrappedBreakEvent;
|
import net.momirealms.customcrops.api.core.wrapper.WrappedBreakEvent;
|
||||||
@@ -315,7 +316,10 @@ public class SprinklerBlock extends AbstractCustomCropsBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Pos3 pos3 : pos3s) {
|
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()) {
|
if (optionalState.isPresent()) {
|
||||||
CustomCropsBlockState anotherState = optionalState.get();
|
CustomCropsBlockState anotherState = optionalState.get();
|
||||||
if (anotherState.type() instanceof PotBlock potBlock) {
|
if (anotherState.type() instanceof PotBlock potBlock) {
|
||||||
@@ -339,6 +343,7 @@ public class SprinklerBlock extends AbstractCustomCropsBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, bukkitLocation);
|
}, bukkitLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user