use of net.minecraft.server.v1_14_R1.Chunk in project Movecraft by APDevTeam.
the class IWorldHandler method moveTileEntity.
private void moveTileEntity(@NotNull World nativeWorld, @NotNull BlockPosition newPosition, @NotNull TileEntity tile) {
Chunk chunk = nativeWorld.getChunkAtWorldCoords(newPosition);
tile.invalidateBlockCache();
tile.setLocation(nativeWorld, newPosition);
if (nativeWorld.captureBlockStates) {
tile.setLocation(nativeWorld, newPosition);
nativeWorld.capturedTileEntities.put(newPosition, tile);
return;
}
chunk.tileEntities.put(newPosition, tile);
}
use of net.minecraft.server.v1_14_R1.Chunk in project Movecraft by APDevTeam.
the class IWorldHandler method moveTileEntity.
private void moveTileEntity(@NotNull World nativeWorld, @NotNull BlockPosition newPosition, @NotNull TileEntity tile) {
Chunk chunk = nativeWorld.getChunkAtWorldCoords(newPosition);
tile.invalidateBlockCache();
tile.setWorld(nativeWorld);
tile.setPosition(newPosition);
if (nativeWorld.captureBlockStates) {
tile.setWorld(nativeWorld);
tile.setPosition(newPosition);
nativeWorld.capturedTileEntities.put(newPosition, tile);
return;
}
chunk.tileEntities.put(newPosition, tile);
}
use of net.minecraft.server.v1_14_R1.Chunk in project TheAPI by TheDevTec.
the class v1_14_R1 method updateLightAt.
@Override
public void updateLightAt(Object chunk, int x, int y, int z) {
net.minecraft.server.v1_14_R1.Chunk c = (net.minecraft.server.v1_14_R1.Chunk) chunk;
c.world.getChunkProvider().getLightEngine().a(new BlockPosition(x, y, z));
}
use of net.minecraft.server.v1_14_R1.Chunk in project TheAPI by TheDevTec.
the class v1_14_R1 method setBlock.
@Override
public void setBlock(Object chunk, int x, int y, int z, Object IblockData, int data) {
net.minecraft.server.v1_14_R1.Chunk c = (net.minecraft.server.v1_14_R1.Chunk) chunk;
ChunkSection sc = c.getSections()[y >> 4];
if (sc == null) {
c.getSections()[y >> 4] = sc = new ChunkSection(y >> 4 << 4);
}
BlockPosition pos = new BlockPosition(x, y, z);
// REMOVE TILE ENTITY
c.tileEntities.remove(pos);
sc.getBlocks().b(x & 15, y & 15, z & 15, (IBlockData) IblockData);
// ADD TILE ENTITY
if (IblockData instanceof ITileEntity) {
TileEntity ent = ((ITileEntity) IblockData).createTile(c);
c.tileEntities.put(pos, ent);
Object packet = ent.getUpdatePacket();
Bukkit.getOnlinePlayers().forEach(player -> BukkitLoader.getPacketHandler().send(player, packet));
}
}
use of net.minecraft.server.v1_14_R1.Chunk in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method spawnExistingEntity.
@Override
public void spawnExistingEntity(LivingEntity entity, SpawnReason spawnReason, boolean bypassSpawnEvent) {
Location location = entity.getLocation();
World world = location.getWorld();
if (world == null)
throw new IllegalArgumentException("Entity is not in a loaded world");
if (bypassSpawnEvent) {
IChunkAccess ichunkaccess = ((CraftWorld) world).getHandle().getChunkAt(MathHelper.floor(entity.getLocation().getX() / 16.0D), MathHelper.floor(entity.getLocation().getZ() / 16.0D), ChunkStatus.FULL, false);
if (!(ichunkaccess instanceof Chunk))
return;
ichunkaccess.a(((CraftEntity) entity).getHandle());
((CraftWorld) world).getHandle().addEntityChunk(((CraftEntity) entity).getHandle());
} else {
((CraftWorld) world).addEntity(((CraftEntity) entity).getHandle(), spawnReason);
}
}
Aggregations