use of net.minecraft.server.v1_7_R4.ChunkPosition in project TheAPI by TheDevTec.
the class v1_7_R4 method setBlock.
@SuppressWarnings("unchecked")
@Override
public void setBlock(Object chunk, int x, int y, int z, Object block, int data) {
net.minecraft.server.v1_7_R4.Chunk c = (net.minecraft.server.v1_7_R4.Chunk) chunk;
ChunkSection sc = c.getSections()[y >> 4];
if (sc == null) {
c.getSections()[y >> 4] = sc = new ChunkSection(y >> 4 << 4, true);
}
ChunkPosition pos = new ChunkPosition(x & 15, y & 15, z & 15);
// REMOVE TILE ENTITY
c.tileEntities.remove(pos);
sc.setTypeId(x & 15, y & 15, z & 15, (Block) block);
sc.setData(x & 15, y & 15, z & 15, data);
// ADD TILE ENTITY
if (block instanceof IContainer) {
TileEntity ent = ((IContainer) block).a(c.world, 0);
c.tileEntities.put(pos, ent);
Object packet = ent.getUpdatePacket();
for (Player player : Bukkit.getOnlinePlayers()) BukkitLoader.getPacketHandler().send(player, packet);
}
}
Aggregations