Search in sources :

Example 6 with PacketPlayOutMultiBlockChange

use of net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange in project MechanicsMain by WeaponMechanics.

the class Block_1_11_R1 method getMultiBlockMaskPacket.

private PacketPlayOutMultiBlockChange getMultiBlockMaskPacket(List<Block> blocks, @Nullable IBlockData mask) {
    net.minecraft.server.v1_11_R1.Chunk chunk = ((CraftChunk) blocks.get(0).getChunk()).getHandle();
    // Setup default information
    PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(0, new short[0], chunk);
    PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] changes = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        Block block = blocks.get(i);
        // Where the block is relative to the chunk it is in
        int x = block.getX() & 0xF;
        int y = block.getY();
        int z = block.getZ() & 0xF;
        // Setting the (x, y, z) location into VarInt format
        short location = (short) (x << 12 | y | z << 8);
        // If mask is null, then undo the mask. Otherwise set the mask
        if (mask == null) {
            changes[i] = packet.new MultiBlockChangeInfo(location, chunk);
        } else {
            changes[i] = packet.new MultiBlockChangeInfo(location, mask);
        }
    }
    assert multiBlockChangeB != null;
    ReflectionUtil.setField(multiBlockChangeB, packet, changes);
    return packet;
}
Also used : PacketPlayOutMultiBlockChange(net.minecraft.server.v1_11_R1.PacketPlayOutMultiBlockChange) Block(org.bukkit.block.Block) CraftChunk(org.bukkit.craftbukkit.v1_11_R1.CraftChunk)

Example 7 with PacketPlayOutMultiBlockChange

use of net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange in project MechanicsMain by WeaponMechanics.

the class Block_1_12_R1 method getMultiBlockMaskPacket.

private PacketPlayOutMultiBlockChange getMultiBlockMaskPacket(List<Block> blocks, @Nullable IBlockData mask) {
    net.minecraft.server.v1_12_R1.Chunk chunk = ((CraftChunk) blocks.get(0).getChunk()).getHandle();
    // Setup default information
    PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(0, new short[0], chunk);
    PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] changes = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        Block block = blocks.get(i);
        // Where the block is relative to the chunk it is in
        int x = block.getX() & 0xF;
        int y = block.getY();
        int z = block.getZ() & 0xF;
        // Setting the (x, y, z) location into VarInt format
        short location = (short) (x << 12 | y | z << 8);
        // If mask is null, then undo the mask. Otherwise set the mask
        if (mask == null) {
            changes[i] = packet.new MultiBlockChangeInfo(location, chunk);
        } else {
            changes[i] = packet.new MultiBlockChangeInfo(location, mask);
        }
    }
    ReflectionUtil.setField(multiBlockChangeB, packet, changes);
    return packet;
}
Also used : PacketPlayOutMultiBlockChange(net.minecraft.server.v1_12_R1.PacketPlayOutMultiBlockChange) Block(org.bukkit.block.Block) CraftChunk(org.bukkit.craftbukkit.v1_12_R1.CraftChunk)

Example 8 with PacketPlayOutMultiBlockChange

use of net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange in project MechanicsMain by WeaponMechanics.

the class Block_1_15_R1 method getMultiBlockMaskPacket.

private PacketPlayOutMultiBlockChange getMultiBlockMaskPacket(List<Block> blocks, @Nullable IBlockData mask) {
    Chunk chunk = ((CraftChunk) blocks.get(0).getChunk()).getHandle();
    // Setup default information
    PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(0, new short[0], chunk);
    PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] changes = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        Block block = blocks.get(i);
        // Where the block is relative to the chunk it is in
        int x = block.getX() & 0xF;
        int y = block.getY();
        int z = block.getZ() & 0xF;
        // Setting the (x, y, z) location into VarInt format
        short location = (short) (x << 12 | y | z << 8);
        // If mask is null, then undo the mask. Otherwise set the mask
        if (mask == null) {
            changes[i] = packet.new MultiBlockChangeInfo(location, chunk);
        } else {
            changes[i] = packet.new MultiBlockChangeInfo(location, mask);
        }
    }
    ReflectionUtil.setField(multiBlockChangeB, packet, changes);
    return packet;
}
Also used : PacketPlayOutMultiBlockChange(net.minecraft.server.v1_15_R1.PacketPlayOutMultiBlockChange) Block(org.bukkit.block.Block) Chunk(net.minecraft.server.v1_15_R1.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_15_R1.CraftChunk) CraftChunk(org.bukkit.craftbukkit.v1_15_R1.CraftChunk)

Example 9 with PacketPlayOutMultiBlockChange

use of net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange in project MechanicsMain by WeaponMechanics.

the class Block_1_13_R2 method getMultiBlockMaskPacket.

private PacketPlayOutMultiBlockChange getMultiBlockMaskPacket(List<Block> blocks, @Nullable IBlockData mask) {
    net.minecraft.server.v1_13_R2.Chunk chunk = ((CraftChunk) blocks.get(0).getChunk()).getHandle();
    // Setup default information
    PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(0, new short[0], chunk);
    PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] changes = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        Block block = blocks.get(i);
        // Where the block is relative to the chunk it is in
        int x = block.getX() & 0xF;
        int y = block.getY();
        int z = block.getZ() & 0xF;
        // Setting the (x, y, z) location into VarInt format
        short location = (short) (x << 12 | y | z << 8);
        // If mask is null, then undo the mask. Otherwise set the mask
        if (mask == null) {
            changes[i] = packet.new MultiBlockChangeInfo(location, chunk);
        } else {
            changes[i] = packet.new MultiBlockChangeInfo(location, mask);
        }
    }
    ReflectionUtil.setField(multiBlockChangeB, packet, changes);
    return packet;
}
Also used : PacketPlayOutMultiBlockChange(net.minecraft.server.v1_13_R2.PacketPlayOutMultiBlockChange) Block(org.bukkit.block.Block) CraftChunk(org.bukkit.craftbukkit.v1_13_R2.CraftChunk)

Example 10 with PacketPlayOutMultiBlockChange

use of net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange in project MechanicsMain by WeaponMechanics.

the class Block_1_9_R2 method getMultiBlockMaskPacket.

private PacketPlayOutMultiBlockChange getMultiBlockMaskPacket(List<Block> blocks, @Nullable IBlockData mask) {
    net.minecraft.server.v1_9_R2.Chunk chunk = ((CraftChunk) blocks.get(0).getChunk()).getHandle();
    // Setup default information
    PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange(0, new short[0], chunk);
    PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] changes = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[blocks.size()];
    for (int i = 0; i < blocks.size(); i++) {
        Block block = blocks.get(i);
        // Where the block is relative to the chunk it is in
        int x = block.getX() & 0xF;
        int y = block.getY();
        int z = block.getZ() & 0xF;
        // Setting the (x, y, z) location into VarInt format
        short location = (short) (x << 12 | y | z << 8);
        // If mask is null, then undo the mask. Otherwise set the mask
        if (mask == null) {
            changes[i] = packet.new MultiBlockChangeInfo(location, chunk);
        } else {
            changes[i] = packet.new MultiBlockChangeInfo(location, mask);
        }
    }
    ReflectionUtil.setField(multiBlockChangeB, packet, changes);
    return packet;
}
Also used : PacketPlayOutMultiBlockChange(net.minecraft.server.v1_9_R2.PacketPlayOutMultiBlockChange) Block(org.bukkit.block.Block) CraftChunk(org.bukkit.craftbukkit.v1_9_R2.CraftChunk)

Aggregations

Block (org.bukkit.block.Block)8 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_15_R1.PacketPlayOutMultiBlockChange)2 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)2 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_16_R3.PacketPlayOutMultiBlockChange)2 ParallelChunk (thpmc.engine.api.world.parallel.ParallelChunk)2 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)2 ParallelWorld (thpmc.engine.api.world.parallel.ParallelWorld)2 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_10_R1.PacketPlayOutMultiBlockChange)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_11_R1.PacketPlayOutMultiBlockChange)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_12_R1.PacketPlayOutMultiBlockChange)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_13_R2.PacketPlayOutMultiBlockChange)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_14_R1.PacketPlayOutMultiBlockChange)1 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)1 Chunk (net.minecraft.server.v1_15_R1.Chunk)1 ChunkCoordIntPair (net.minecraft.server.v1_15_R1.ChunkCoordIntPair)1 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)1 SectionPosition (net.minecraft.server.v1_16_R3.SectionPosition)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_9_R2.PacketPlayOutMultiBlockChange)1 BlockData (org.bukkit.block.data.BlockData)1 ShortArraySet (org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.shorts.ShortArraySet)1