Search in sources :

Example 16 with Block

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

the class BlockCacheCB3100 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_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null bounds -> full ?
        return null;
    }
    // getData 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_R4.Block)

Example 17 with Block

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

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

the class BlockHelperImpl method ringBell.

@Override
public void ringBell(Bell block) {
    org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
    Direction face = Direction.byName(bellData.getFacing().name());
    Direction dir = Direction.NORTH;
    switch(bellData.getAttachment()) {
        case DOUBLE_WALL:
        case SINGLE_WALL:
            switch(face) {
                case NORTH:
                case SOUTH:
                    dir = Direction.EAST;
                    break;
            }
            break;
        case FLOOR:
            dir = face;
            break;
    }
    CraftBlock craftBlock = (CraftBlock) block.getBlock();
    ((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
Also used : BellBlock(net.minecraft.world.level.block.BellBlock) org.bukkit.block(org.bukkit.block) org.bukkit.craftbukkit.v1_17_R1.block(org.bukkit.craftbukkit.v1_17_R1.block) Direction(net.minecraft.core.Direction)

Example 19 with Block

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

the class NMSHandler method setBlockSuperFast.

@SuppressWarnings("deprecation")
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_7_R4.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_7_R4.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    try {
        Field f = chunk.getClass().getDeclaredField("sections");
        f.setAccessible(true);
        ChunkSection[] sections = (ChunkSection[]) f.get(chunk);
        ChunkSection chunksection = sections[b.getY() >> 4];
        if (chunksection == null) {
            chunksection = sections[b.getY() >> 4] = new ChunkSection(b.getY() >> 4 << 4, !chunk.world.worldProvider.f);
        }
        net.minecraft.server.v1_7_R4.Block mb = net.minecraft.server.v1_7_R4.Block.getById(blockId);
        chunksection.setTypeId(b.getX() & 15, b.getY() & 15, b.getZ() & 15, mb);
        chunksection.setData(b.getX() & 15, b.getY() & 15, b.getZ() & 15, data);
        if (applyPhysics) {
            w.update(b.getX(), b.getY(), b.getZ(), mb);
        }
    } catch (Exception e) {
        // Bukkit.getLogger().info("Error");
        b.setTypeIdAndData(blockId, data, applyPhysics);
    }
}
Also used : Field(java.lang.reflect.Field) CraftWorld(org.bukkit.craftbukkit.v1_7_R4.CraftWorld) ChunkSection(net.minecraft.server.v1_7_R4.ChunkSection)

Example 20 with Block

use of net.minecraft.server.v1_7_R4.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();
    TileEntityFlowerPot te = (TileEntityFlowerPot) cw.getHandle().getTileEntity(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    // Bukkit.getLogger().info("Debug: flowerpot materialdata = " + (new ItemStack(potItem, 1,(short) potItemData).toString()));
    net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
    te.a(cis.getItem(), cis.getData());
    te.update();
}
Also used : TileEntityFlowerPot(net.minecraft.server.v1_7_R4.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_7_R4.CraftWorld) Location(org.bukkit.Location)

Aggregations

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 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)5 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)4 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)4 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)4 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)4 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)3 CraftWorld (org.bukkit.craftbukkit.v1_7_R4.CraftWorld)3 FallingBlock (org.bukkit.entity.FallingBlock)3 AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)2 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)2