Search in sources :

Example 26 with CraftWorld

use of org.bukkit.craftbukkit.v1_15_R1.CraftWorld 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_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_8_R3.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_8_R3.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_8_R3.IBlockData) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 27 with CraftWorld

use of org.bukkit.craftbukkit.v1_15_R1.CraftWorld 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_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 28 with CraftWorld

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

Example 29 with CraftWorld

use of org.bukkit.craftbukkit.v1_15_R1.CraftWorld 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_9_R2.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_9_R2.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_9_R2.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_9_R2.IBlockData) BlockPosition(net.minecraft.server.v1_9_R2.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 30 with CraftWorld

use of org.bukkit.craftbukkit.v1_15_R1.CraftWorld 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_8_R2.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_8_R2.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_8_R2.Block.getByCombinedId(combined);
    chunk.a(bp, ibd);
    if (applyPhysics) {
        net.minecraft.server.v1_8_R2.Block block = chunk.getType(bp);
        w.update(bp, block);
    }
}
Also used : IBlockData(net.minecraft.server.v1_8_R2.IBlockData) BlockPosition(net.minecraft.server.v1_8_R2.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R2.CraftWorld)

Aggregations

ServerLevel (net.minecraft.server.level.ServerLevel)63 Location (org.bukkit.Location)56 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)42 ItemStack (org.bukkit.inventory.ItemStack)42 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)40 BlockPos (net.minecraft.core.BlockPos)36 Zombie (org.bukkit.entity.Zombie)32 LivingEntity (org.bukkit.entity.LivingEntity)29 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)28 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)28 ItemEntity (net.minecraft.world.entity.item.ItemEntity)27 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)26 HangingEntity (net.minecraft.world.entity.decoration.HangingEntity)25 FallingBlockEntity (net.minecraft.world.entity.item.FallingBlockEntity)25 FireworkRocketEntity (net.minecraft.world.entity.projectile.FireworkRocketEntity)25 SignBlockEntity (net.minecraft.world.level.block.entity.SignBlockEntity)25 Entity (org.bukkit.entity.Entity)25 HumanEntity (org.bukkit.entity.HumanEntity)25 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)23 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)17