Search in sources :

Example 21 with Block

use of net.minecraft.server.v1_8_R3.Block in project NoCheatPlus by NoCheatPlus.

the class BlockCacheCB2922 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    // TODO: change api for this / use nodes (!)
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
    if (block == null)
        return null;
    // data from cache.
    block.updateShape(iBlockAccess, x, y, z);
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
Also used : Block(net.minecraft.server.v1_7_R1.Block)

Example 22 with Block

use of net.minecraft.server.v1_8_R3.Block 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 23 with Block

use of net.minecraft.server.v1_8_R3.Block in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelper_v1_8_R3 method getNbtData.

@Override
public CompoundTag getNbtData(Block block) {
    TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
    if (tileEntity == null) {
        return null;
    }
    NBTTagCompound nbtTagCompound = new NBTTagCompound();
    tileEntity.b(new NBTTagCompound());
    return CompoundTag_v1_8_R3.fromNMSTag(nbtTagCompound);
}
Also used : TileEntity(net.minecraft.server.v1_8_R3.TileEntity) CraftBlockState(org.bukkit.craftbukkit.v1_8_R3.block.CraftBlockState) NBTTagCompound(net.minecraft.server.v1_8_R3.NBTTagCompound)

Example 24 with Block

use of net.minecraft.server.v1_8_R3.Block in project askyblock by tastybento.

the class NMSHandler method setFlowerPotBlock.

/* (non-Javadoc)
     * @see com.wasteofplastic.askyblock.nms.NMSAbstraction#setBlock(org.bukkit.block.Block, org.bukkit.inventory.ItemStack)
     * Credis: Mister_Frans (THANK YOU VERY MUCH !)
     */
@Override
public void setFlowerPotBlock(Block block, ItemStack itemStack) {
    Location loc = block.getLocation();
    CraftWorld cw = (CraftWorld) block.getWorld();
    BlockPosition bp = new BlockPosition(loc.getX(), loc.getY(), loc.getZ());
    TileEntityFlowerPot te = (TileEntityFlowerPot) cw.getHandle().getTileEntity(bp);
    // Bukkit.getLogger().info("Debug: flowerpot materialdata = " + (new ItemStack(potItem, 1,(short) potItemData).toString()));
    net.minecraft.server.v1_8_R3.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
    te.a(cis.getItem(), cis.getData());
    te.update();
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) TileEntityFlowerPot(net.minecraft.server.v1_8_R3.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) Location(org.bukkit.Location)

Example 25 with Block

use of net.minecraft.server.v1_8_R3.Block in project Citizens2 by CitizensDev.

the class PlayerNavigation method r.

private int r() {
    if ((!this.a.isInWater()) || (!g())) {
        return (int) (this.a.getBoundingBox().b + 0.5D);
    }
    int i = (int) this.a.getBoundingBox().b;
    Block localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
    int j = 0;
    while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
        i++;
        localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
        j++;
        if (j > 16) {
            return (int) this.a.getBoundingBox().b;
        }
    }
    return i;
}
Also used : BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) Block(net.minecraft.server.v1_10_R1.Block) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Aggregations

BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)12 Block (net.minecraft.server.v1_10_R1.Block)7 Block (net.minecraft.server.v1_11_R1.Block)7 Block (net.minecraft.server.v1_12_R1.Block)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)6 Block (net.minecraft.server.v1_8_R3.Block)6 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)6 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)4 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)3 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)3 FallingBlock (org.bukkit.entity.FallingBlock)3 AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)2 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)2 BatchAnnotateImagesResponse (com.google.cloud.vision.v1.BatchAnnotateImagesResponse)2