use of org.bukkit.craftbukkit.v1_7_R4.CraftChunk in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method doRandomTick.
@Override
public void doRandomTick(Location location) {
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
Chunk nmsChunk = ((CraftChunk) location.getChunk()).getHandle();
IBlockData nmsBlock = nmsChunk.getType(pos);
WorldServer nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
if (nmsBlock.isTicking()) {
nmsBlock.b(nmsWorld, pos, nmsWorld.random);
}
Fluid fluid = nmsBlock.getFluid();
if (fluid.f()) {
fluid.b(nmsWorld, pos, nmsWorld.random);
}
}
use of org.bukkit.craftbukkit.v1_7_R4.CraftChunk 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);
}
}
use of org.bukkit.craftbukkit.v1_7_R4.CraftChunk in project Denizen-For-Bukkit by DenizenScript.
the class ChunkHelperImpl method getHeightMap.
@Override
public int[] getHeightMap(Chunk chunk) {
Heightmap map = ((CraftChunk) chunk).getHandle().heightmaps.get(Heightmap.Types.MOTION_BLOCKING);
int[] outputMap = new int[256];
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
outputMap[x * 16 + y] = map.getFirstAvailable(x, y);
}
}
return outputMap;
}
use of org.bukkit.craftbukkit.v1_7_R4.CraftChunk in project MagicPlugin by elBukkit.
the class CompatibilityUtils method setBlockFast.
@Override
public boolean setBlockFast(Chunk chunk, int x, int y, int z, Material material, int data) {
LevelChunk nmsChunk = ((CraftChunk) chunk).getHandle();
net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material);
BlockPos blockLocation = new BlockPos(x, y, z);
nmsChunk.setBlockState(blockLocation, block.defaultBlockState(), false);
return true;
}
use of org.bukkit.craftbukkit.v1_7_R4.CraftChunk in project MagicPlugin by elBukkit.
the class CompatibilityUtils method setBlockFast.
@Override
public boolean setBlockFast(Chunk chunk, int x, int y, int z, Material material, int data) {
LevelChunk nmsChunk = ((CraftChunk) chunk).getHandle();
net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(material);
BlockPos blockLocation = new BlockPos(x, y, z);
nmsChunk.setBlockState(blockLocation, block.defaultBlockState(), false);
return true;
}
Aggregations