Search in sources :

Example 36 with BlockPosition

use of net.minecraft.server.v1_8_R1.BlockPosition in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_8_R2 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_8_R2.Block block = net.minecraft.server.v1_8_R2.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null bounds -> full ?
        return null;
    }
    block.updateShape(world, new BlockPosition(x, y, z));
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { block.B(), block.D(), block.F(), block.C(), block.E(), block.G() };
}
Also used : BlockPosition(net.minecraft.server.v1_8_R2.BlockPosition)

Example 37 with BlockPosition

use of net.minecraft.server.v1_8_R1.BlockPosition in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_8_R3 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_8_R3.Block block = net.minecraft.server.v1_8_R3.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null bounds -> full ?
        return null;
    }
    block.updateShape(world, new BlockPosition(x, y, z));
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { block.B(), block.D(), block.F(), block.C(), block.E(), block.G() };
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition)

Example 38 with BlockPosition

use of net.minecraft.server.v1_8_R1.BlockPosition in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_9_R1 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_9_R1.Block block = net.minecraft.server.v1_9_R1.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null blocks -> full ?
        return null;
    }
    final BlockPosition pos = new BlockPosition(x, y, z);
    final AxisAlignedBB bb = block.a(world.getType(pos), world, pos);
    if (bb == null) {
        // Special case.
        return new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 };
    // return null;
    }
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { bb.a, bb.b, bb.c, bb.d, bb.e, bb.f };
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_9_R1.BlockPosition)

Example 39 with BlockPosition

use of net.minecraft.server.v1_8_R1.BlockPosition in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_9_R2 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_9_R2.Block block = net.minecraft.server.v1_9_R2.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null blocks -> full ?
        return null;
    }
    final BlockPosition pos = new BlockPosition(x, y, z);
    // TODO: Deprecation warning below (reason / substitute?).
    @SuppressWarnings("deprecation") final AxisAlignedBB bb = block.a(world.getType(pos), world, pos);
    if (bb == null) {
        // Special case.
        return new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 };
    // return null;
    }
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { bb.a, bb.b, bb.c, bb.d, bb.e, bb.f };
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R2.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_9_R2.BlockPosition)

Example 40 with BlockPosition

use of net.minecraft.server.v1_8_R1.BlockPosition 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_10_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_10_R1.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_10_R1.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_10_R1.IBlockData) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Aggregations

BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)23 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)23 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)20 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)17 Location (org.bukkit.Location)16 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)10 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)10 NPC (net.citizensnpcs.api.npc.NPC)8 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)8 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)7 PathType (net.minecraft.server.v1_10_R1.PathType)7 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)7 Block (net.minecraft.server.v1_10_R1.Block)6 Block (net.minecraft.server.v1_11_R1.Block)6 PathType (net.minecraft.server.v1_11_R1.PathType)6 PathType (net.minecraft.server.v1_12_R1.PathType)6 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)6 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)5 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)5