use of net.minecraft.world.level.chunk.LevelChunk in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method doRandomTick.
@Override
public void doRandomTick(Location location) {
BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
LevelChunk nmsChunk = ((CraftChunk) location.getChunk()).getHandle();
net.minecraft.world.level.block.state.BlockState nmsBlock = nmsChunk.getBlockState(pos);
ServerLevel nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
if (nmsBlock.isRandomlyTicking()) {
nmsBlock.randomTick(nmsWorld, pos, nmsWorld.random);
}
try {
// FluidState fluid = nmsBlock.getFluidState();
// if (fluid.isRandomlyTicking()) {
// fluid.animateTick(nmsWorld, pos, nmsWorld.random);
// }
Object fluid = BLOCKSTATEBASE_GETFLUIDSTATE.invoke(nmsBlock);
if ((boolean) FLUIDSTATE_ISRANDOMLYTICKING.invoke(fluid)) {
FLUIDSTATE_ANIMATETICK.invoke(fluid, nmsWorld, pos, nmsWorld.random);
}
} catch (Throwable ex) {
Debug.echoError(ex);
}
}
Aggregations