Search in sources :

Example 1 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Denizen-For-Bukkit by DenizenScript.

the class BlockData_v1_11_R1 method setBlock.

public void setBlock(Block block) {
    block.setTypeIdAndData(material.getId(), (byte) data, false);
    if (ctag != null) {
        CompoundTagBuilder builder = ctag.createBuilder();
        builder.putInt("x", block.getX());
        builder.putInt("y", block.getY());
        builder.putInt("z", block.getZ());
        ctag = (CompoundTag_v1_11_R1) builder.build();
        // TODO: make this work!
        BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
        te.a(ctag.toNMSTag());
    }
}
Also used : TileEntity(net.minecraft.server.v1_11_R1.TileEntity) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 2 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Denizen-For-Bukkit by DenizenScript.

the class WorldHelper_v1_8_R3 method setWorldAccess.

@Override
public void setWorldAccess(World world, final WorldAccess worldAccess) {
    if (worldAccessMap.containsKey(world)) {
        removeWorldAccess(world);
    }
    IWorldAccess nmsWorldAccess = new IWorldAccess() {

        @Override
        public void a(BlockPosition blockPosition) {
        }

        @Override
        public void b(BlockPosition blockPosition) {
        }

        @Override
        public void a(int i, int i1, int i2, int i3, int i4, int i5) {
        }

        @Override
        public void a(String s, double v, double v1, double v2, float v3, float v4) {
        }

        @Override
        public void a(EntityHuman entityHuman, String s, double v, double v1, double v2, float v3, float v4) {
        }

        @Override
        public void a(int i, boolean b, double v, double v1, double v2, double v3, double v4, double v5, int... ints) {
        }

        @Override
        public void a(Entity entity) {
        }

        @Override
        public void b(Entity entity) {
            worldAccess.despawn(entity.getBukkitEntity());
        }

        @Override
        public void a(String s, BlockPosition blockPosition) {
        }

        @Override
        public void a(int i, BlockPosition blockPosition, int i1) {
        }

        @Override
        public void a(EntityHuman entityHuman, int i, BlockPosition blockPosition, int i1) {
        }

        @Override
        public void b(int i, BlockPosition blockPosition, int i1) {
        }
    };
    worldAccessMap.put(world, nmsWorldAccess);
    ((CraftWorld) world).getHandle().addIWorldAccess(nmsWorldAccess);
}
Also used : IWorldAccess(net.minecraft.server.v1_8_R3.IWorldAccess) EntityHuman(net.minecraft.server.v1_8_R3.EntityHuman) Entity(net.minecraft.server.v1_8_R3.Entity) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition)

Example 3 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project Denizen-For-Bukkit by DenizenScript.

the class BlockData_v1_8_R3 method setBlock.

public void setBlock(Block block) {
    block.setTypeIdAndData(material.getId(), (byte) data, false);
    if (ctag != null) {
        CompoundTagBuilder builder = ctag.createBuilder();
        builder.putInt("x", block.getX());
        builder.putInt("y", block.getY());
        builder.putInt("z", block.getZ());
        ctag = (CompoundTag_v1_8_R3) builder.build();
        // TODO: make this work!
        BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
        te.a(ctag.toNMSTag());
    }
}
Also used : TileEntity(net.minecraft.server.v1_8_R3.TileEntity) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CompoundTagBuilder(net.aufdemrand.denizen.nms.util.jnbt.CompoundTagBuilder)

Example 4 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project acidisland 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 5 with BlockPosition

use of net.minecraft.server.v1_13_R1.BlockPosition in project acidisland 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_R1.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
    te.a(cis.getItem(), cis.getData());
    te.update();
}
Also used : BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition) TileEntityFlowerPot(net.minecraft.server.v1_8_R1.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld) Location(org.bukkit.Location)

Aggregations

BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)39 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)36 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)34 Location (org.bukkit.Location)31 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)30 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)30 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)26 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)24 Chunk (org.bukkit.Chunk)23 ArrayList (java.util.ArrayList)22 List (java.util.List)19 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)18 Map (java.util.Map)17 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)17 Iterator (java.util.Iterator)14 HashMap (java.util.HashMap)12 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)11 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)10 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)10 BlockPosition (net.minecraft.server.v1_13_R2.BlockPosition)10