use of net.minecraft.server.v1_8_R3.Chunk in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_8_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_8_R3.Chunk in project askyblock by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_8_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_8_R3.Chunk in project fairy by FairyProject.
the class CacheBlockSetHandler method setType.
public void setType(CacheBlockChange blockChange) {
if (world.isChunkLoaded(blockChange.getX() >> 4, blockChange.getZ() >> 4)) {
Chunk chunk = ((CraftChunk) world.getChunkAt(blockChange.getX() >> 4, blockChange.getZ() >> 4)).getHandle();
final int combined = blockChange.getMaterial().getId() + (blockChange.getData() << 12);
final IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
int y = blockChange.getY().get(blockChange.getX(), blockChange.getZ(), chunk);
BlockPosition blockPosition = new BlockPosition(blockChange.getX(), y, blockChange.getZ());
chunk.a(blockPosition, ibd);
chunk.world.notify(blockPosition);
return;
}
long key = LongHash.toLong(blockChange.getX() >> 4, blockChange.getZ() >> 4);
if (cachedChanges.containsKey(key)) {
cachedChanges.get(key).add(blockChange);
return;
}
CacheChunkChanges chunkChanges = new CacheChunkChanges();
cachedChanges.put(key, chunkChanges);
chunkChanges.add(blockChange);
}
use of net.minecraft.server.v1_8_R3.Chunk in project fairy by FairyProject.
the class CacheChunkChanges method place.
public void place(Chunk chunk) {
BlockPosition.MutableBlockPosition blockPosition = new BlockPosition.MutableBlockPosition();
for (CacheBlockChange blockChange : this.blockChanges) {
final int combined = blockChange.getMaterial().getId() + (blockChange.getData() << 12);
final IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
int y = blockChange.getY().get(blockChange.getX(), blockChange.getZ(), chunk);
chunk.a(blockPosition.c(blockChange.getX(), y, blockChange.getZ()), ibd);
chunk.world.notify(blockPosition);
}
}
use of net.minecraft.server.v1_8_R3.Chunk in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method removeLoader.
@Override
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
Location loaderLoc = chunkLoader.getLocation();
assert loaderLoc.getWorld() != null;
WorldServer world = ((CraftWorld) loaderLoc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loaderLoc.getX(), loaderLoc.getY(), loaderLoc.getZ());
long tileEntityLong = ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4);
TileEntityChunkLoader tileEntityChunkLoader = TileEntityChunkLoader.tileEntityChunkLoaderMap.remove(tileEntityLong);
if (tileEntityChunkLoader != null) {
tileEntityChunkLoader.holograms.forEach(EntityHolograms_v1_16_R3::removeHologram);
tileEntityChunkLoader.removed = true;
world.tileEntityListTick.remove(tileEntityChunkLoader);
}
if (spawnParticle)
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
for (org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
}
}
Aggregations