Search in sources :

Example 21 with Block

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

the class BlockHelper_v1_11_R1 method setNbtData.

@Override
public void setNbtData(Block block, CompoundTag compoundTag) {
    TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
    if (tileEntity == null) {
        return;
    }
    tileEntity.a(((CompoundTag_v1_11_R1) compoundTag).toNMSTag());
    tileEntity.update();
}
Also used : TileEntity(net.minecraft.server.v1_11_R1.TileEntity) CraftBlockState(org.bukkit.craftbukkit.v1_11_R1.block.CraftBlockState)

Example 22 with Block

use of net.minecraft.server.v1_11_R1.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)
     */
@Override
public void setFlowerPotBlock(final Block block, final ItemStack itemStack) {
    if (block.getType().equals(Material.FLOWER_POT)) {
        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_11_R1.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
        te.setContents(cis);
        te.update();
    }
}
Also used : BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) TileEntityFlowerPot(net.minecraft.server.v1_11_R1.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld) Location(org.bukkit.Location)

Example 23 with Block

use of net.minecraft.server.v1_11_R1.Block 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_11_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_11_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_11_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_11_R1.IBlockData) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 24 with Block

use of net.minecraft.server.v1_11_R1.Block in project acidisland by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_11_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_11_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_11_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_11_R1.IBlockData) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 25 with Block

use of net.minecraft.server.v1_11_R1.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_11_R1.BlockPosition)13 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_12_R1.BlockPosition)6 Block (net.minecraft.server.v1_8_R3.Block)6 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)5 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)5 IBlockData (net.minecraft.server.v1_11_R1.IBlockData)4 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)4 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)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