Search in sources :

Example 6 with BlockFace

use of com.viaversion.viaversion.api.minecraft.BlockFace in project ViaVersion by ViaVersion.

the class StairConnectionHandler method getShape.

private int getShape(UserConnection user, Position position, StairData stair) {
    BlockFace facing = stair.getFacing();
    StairData relativeStair = stairDataMap.get(getBlockData(user, position.getRelative(facing)));
    if (relativeStair != null && relativeStair.isBottom() == stair.isBottom()) {
        BlockFace facing2 = relativeStair.getFacing();
        if (facing.axis() != facing2.axis() && checkOpposite(user, stair, position, facing2.opposite())) {
            // outer_left : outer_right
            return facing2 == rotateAntiClockwise(facing) ? 3 : 4;
        }
    }
    relativeStair = stairDataMap.get(getBlockData(user, position.getRelative(facing.opposite())));
    if (relativeStair != null && relativeStair.isBottom() == stair.isBottom()) {
        BlockFace facing2 = relativeStair.getFacing();
        if (facing.axis() != facing2.axis() && checkOpposite(user, stair, position, facing2)) {
            // inner_left : inner_right
            return facing2 == rotateAntiClockwise(facing) ? 1 : 2;
        }
    }
    // straight
    return 0;
}
Also used : BlockFace(com.viaversion.viaversion.api.minecraft.BlockFace)

Aggregations

BlockFace (com.viaversion.viaversion.api.minecraft.BlockFace)6 Position (com.viaversion.viaversion.api.minecraft.Position)2 ChunkSection (com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)2 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)2 ArrayList (java.util.ArrayList)2 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)1 StringTag (com.github.steveice10.opennbt.tag.builtin.StringTag)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 Via (com.viaversion.viaversion.api.Via)1 BaseChunk (com.viaversion.viaversion.api.minecraft.chunks.BaseChunk)1 Chunk (com.viaversion.viaversion.api.minecraft.chunks.Chunk)1 NibbleArray (com.viaversion.viaversion.api.minecraft.chunks.NibbleArray)1 DataItem (com.viaversion.viaversion.api.minecraft.item.DataItem)1 Item (com.viaversion.viaversion.api.minecraft.item.Item)1 Protocol (com.viaversion.viaversion.api.protocol.Protocol)1 PacketHandler (com.viaversion.viaversion.api.protocol.remapper.PacketHandler)1 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)1 Type (com.viaversion.viaversion.api.type.Type)1