Search in sources :

Example 1 with IContainer

use of net.minecraft.server.v1_8_R1.IContainer in project TheAPI by TheDevTec.

the class v1_8_R3 method setBlock.

@Override
public void setBlock(Object chunk, int x, int y, int z, Object IblockData, int data) {
    net.minecraft.server.v1_8_R3.Chunk c = (net.minecraft.server.v1_8_R3.Chunk) chunk;
    ChunkSection sc = c.getSections()[y >> 4];
    if (sc == null) {
        c.getSections()[y >> 4] = sc = new ChunkSection(y >> 4 << 4, true);
    }
    BlockPosition pos = new BlockPosition(x, y, z);
    // REMOVE TILE ENTITY
    c.tileEntities.remove(pos);
    sc.setType(x & 15, y & 15, z & 15, (IBlockData) IblockData);
    // ADD TILE ENTITY
    if (IblockData instanceof IContainer) {
        TileEntity ent = ((IContainer) IblockData).a(c.world, 0);
        c.tileEntities.put(pos, ent);
        Object packet = ent.getUpdatePacket();
        Bukkit.getOnlinePlayers().forEach(player -> BukkitLoader.getPacketHandler().send(player, packet));
    }
}
Also used : TileEntity(net.minecraft.server.v1_8_R3.TileEntity) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Chunk(org.bukkit.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_8_R3.CraftChunk) IContainer(net.minecraft.server.v1_8_R3.IContainer) ChunkSection(net.minecraft.server.v1_8_R3.ChunkSection)

Example 2 with IContainer

use of net.minecraft.server.v1_8_R1.IContainer in project TheAPI by TheDevTec.

the class v1_8_R2 method setBlock.

@Override
public void setBlock(Object chunk, int x, int y, int z, Object IblockData, int data) {
    net.minecraft.server.v1_8_R2.Chunk c = (net.minecraft.server.v1_8_R2.Chunk) chunk;
    ChunkSection sc = c.getSections()[y >> 4];
    if (sc == null) {
        c.getSections()[y >> 4] = sc = new ChunkSection(y >> 4 << 4, true);
    }
    BlockPosition pos = new BlockPosition(x, y, z);
    // REMOVE TILE ENTITY
    c.tileEntities.remove(pos);
    sc.setType(x & 15, y & 15, z & 15, (IBlockData) IblockData);
    // ADD TILE ENTITY
    if (IblockData instanceof IContainer) {
        TileEntity ent = ((IContainer) IblockData).a(c.world, 0);
        c.tileEntities.put(pos, ent);
        Object packet = ent.getUpdatePacket();
        Bukkit.getOnlinePlayers().forEach(player -> BukkitLoader.getPacketHandler().send(player, packet));
    }
}
Also used : TileEntity(net.minecraft.server.v1_8_R2.TileEntity) BlockPosition(net.minecraft.server.v1_8_R2.BlockPosition) Chunk(org.bukkit.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_8_R2.CraftChunk) IContainer(net.minecraft.server.v1_8_R2.IContainer) ChunkSection(net.minecraft.server.v1_8_R2.ChunkSection)

Example 3 with IContainer

use of net.minecraft.server.v1_8_R1.IContainer 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);
    }
}
Also used : TileEntity(net.minecraft.server.v1_7_R4.TileEntity) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer) EntityPlayer(net.minecraft.server.v1_7_R4.EntityPlayer) ChunkPosition(net.minecraft.server.v1_7_R4.ChunkPosition) Chunk(org.bukkit.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_7_R4.CraftChunk) IContainer(net.minecraft.server.v1_7_R4.IContainer) ChunkSection(net.minecraft.server.v1_7_R4.ChunkSection)

Example 4 with IContainer

use of net.minecraft.server.v1_8_R1.IContainer in project TheAPI by TheDevTec.

the class v1_8_R1 method setBlock.

@SuppressWarnings("unchecked")
@Override
public void setBlock(Object chunk, int x, int y, int z, Object IblockData, int data) {
    net.minecraft.server.v1_8_R1.Chunk c = (net.minecraft.server.v1_8_R1.Chunk) chunk;
    ChunkSection sc = c.getSections()[y >> 4];
    if (sc == null) {
        c.getSections()[y >> 4] = sc = new ChunkSection(y >> 4 << 4, true);
    }
    BlockPosition pos = new BlockPosition(x, y, z);
    // REMOVE TILE ENTITY
    c.tileEntities.remove(pos);
    sc.setType(x & 15, y & 15, z & 15, (IBlockData) IblockData);
    // ADD TILE ENTITY
    if (IblockData instanceof IContainer) {
        TileEntity ent = ((IContainer) IblockData).a(c.world, 0);
        c.tileEntities.put(pos, ent);
        Object packet = ent.getUpdatePacket();
        Bukkit.getOnlinePlayers().forEach(player -> BukkitLoader.getPacketHandler().send(player, packet));
    }
}
Also used : TileEntity(net.minecraft.server.v1_8_R1.TileEntity) BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition) Chunk(org.bukkit.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_8_R1.CraftChunk) IContainer(net.minecraft.server.v1_8_R1.IContainer) ChunkSection(net.minecraft.server.v1_8_R1.ChunkSection)

Aggregations

Chunk (org.bukkit.Chunk)4 ChunkPosition (net.minecraft.server.v1_7_R4.ChunkPosition)1 ChunkSection (net.minecraft.server.v1_7_R4.ChunkSection)1 EntityPlayer (net.minecraft.server.v1_7_R4.EntityPlayer)1 IContainer (net.minecraft.server.v1_7_R4.IContainer)1 TileEntity (net.minecraft.server.v1_7_R4.TileEntity)1 BlockPosition (net.minecraft.server.v1_8_R1.BlockPosition)1 ChunkSection (net.minecraft.server.v1_8_R1.ChunkSection)1 IContainer (net.minecraft.server.v1_8_R1.IContainer)1 TileEntity (net.minecraft.server.v1_8_R1.TileEntity)1 BlockPosition (net.minecraft.server.v1_8_R2.BlockPosition)1 ChunkSection (net.minecraft.server.v1_8_R2.ChunkSection)1 IContainer (net.minecraft.server.v1_8_R2.IContainer)1 TileEntity (net.minecraft.server.v1_8_R2.TileEntity)1 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)1 ChunkSection (net.minecraft.server.v1_8_R3.ChunkSection)1 IContainer (net.minecraft.server.v1_8_R3.IContainer)1 TileEntity (net.minecraft.server.v1_8_R3.TileEntity)1 CraftChunk (org.bukkit.craftbukkit.v1_7_R4.CraftChunk)1 CraftPlayer (org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer)1