Search in sources :

Example 41 with IBlockData

use of net.minecraft.server.v1_15_R1.IBlockData in project RoseStacker by Rosewood-Development.

the class StackedSpawnerTileImpl method updateTile.

private void updateTile() {
    World level = this.a();
    if (level != null) {
        level.b(this.blockPos, this.blockEntity);
        IBlockData var1 = this.a().getType(this.b());
        this.a().notify(this.blockPos, var1, var1, 3);
    }
}
Also used : IBlockData(net.minecraft.server.v1_16_R3.IBlockData) World(net.minecraft.server.v1_16_R3.World)

Example 42 with IBlockData

use of net.minecraft.server.v1_15_R1.IBlockData in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_8_R3 method simulateToolBreak.

@Override
public void simulateToolBreak(Player bukkitPlayer, org.bukkit.block.Block bukkitBlock) {
    EntityPlayer entityPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
    ItemStack itemStack = entityPlayer.bZ();
    WorldServer worldServer = ((CraftWorld) bukkitBlock.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
    IBlockData blockData = worldServer.getType(blockPosition);
    itemStack.a(worldServer, blockData.getBlock(), blockPosition, entityPlayer);
    if (itemStack.count == 0)
        entityPlayer.ca();
}
Also used : IBlockData(net.minecraft.server.v1_8_R3.IBlockData) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) WorldServer(net.minecraft.server.v1_8_R3.WorldServer) ItemStack(net.minecraft.server.v1_8_R3.ItemStack) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 43 with IBlockData

use of net.minecraft.server.v1_15_R1.IBlockData in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_12_R1 method simulateToolBreak.

@Override
public void simulateToolBreak(Player bukkitPlayer, org.bukkit.block.Block bukkitBlock) {
    EntityPlayer entityPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
    ItemStack itemStack = entityPlayer.getItemInMainHand();
    WorldServer worldServer = ((CraftWorld) bukkitBlock.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
    IBlockData blockData = worldServer.getType(blockPosition);
    assert itemStack != null;
    itemStack.a(worldServer, blockData, blockPosition, entityPlayer);
}
Also used : IBlockData(net.minecraft.server.v1_12_R1.IBlockData) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) WorldServer(net.minecraft.server.v1_12_R1.WorldServer) ItemStack(net.minecraft.server.v1_12_R1.ItemStack) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 44 with IBlockData

use of net.minecraft.server.v1_15_R1.IBlockData in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method simulateToolBreak.

@Override
public void simulateToolBreak(Player bukkitPlayer, org.bukkit.block.Block bukkitBlock) {
    EntityPlayer entityPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
    ItemStack itemStack = entityPlayer.getItemInMainHand();
    WorldServer worldServer = ((CraftWorld) bukkitBlock.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(bukkitBlock.getX(), bukkitBlock.getY(), bukkitBlock.getZ());
    IBlockData blockData = worldServer.getType(blockPosition);
    assert itemStack != null;
    itemStack.a(worldServer, blockData, blockPosition, entityPlayer);
}
Also used : IBlockData(net.minecraft.server.v1_16_R3.IBlockData) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) ItemStack(net.minecraft.server.v1_16_R3.ItemStack) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 45 with IBlockData

use of net.minecraft.server.v1_15_R1.IBlockData in project Atlas by funkemunky.

the class BlockBox1_15_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(org.bukkit.block.Block block) {
    final net.minecraft.server.v1_15_R1.World world = ((org.bukkit.craftbukkit.v1_15_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    net.minecraft.server.v1_15_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
    net.minecraft.server.v1_15_R1.Block vblock = iblockData.getBlock();
    BlockPosition blockPos = new BlockPosition(x, y, z);
    VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
    List<AxisAlignedBB> boxes = shape.d();
    if (boxes.size() == 0) {
        return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
        }
        return complexBox;
    }
}
Also used : ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) CraftBlock(org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock) World(net.minecraft.server.v1_15_R1.World) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) net.minecraft.server.v1_15_R1(net.minecraft.server.v1_15_R1) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Aggregations

HashMap (java.util.HashMap)24 ArrayList (java.util.ArrayList)20 Block (org.bukkit.block.Block)18 List (java.util.List)16 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)16 NotNull (org.jetbrains.annotations.NotNull)16 Chunk (org.bukkit.Chunk)12 IBlockData (net.minecraft.server.v1_14_R1.IBlockData)10 IBlockData (net.minecraft.server.v1_12_R1.IBlockData)9 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 IBlockData (net.minecraft.server.v1_15_R1.IBlockData)8 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 IBlockData (net.minecraft.server.v1_11_R1.IBlockData)7 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)7 IBlockData (net.minecraft.server.v1_8_R3.IBlockData)7 IdentityHashMap (java.util.IdentityHashMap)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)6