Search in sources :

Example 16 with StringTag

use of com.sk89q.jnbt.StringTag in project FastAsyncWorldEdit by IntellectualSites.

the class FlowerPotCompatibilityHandler method updateNBT.

@Override
public <B extends BlockStateHolder<B>> BlockStateHolder<?> updateNBT(B block, Map<String, Tag> values) {
    Tag item = values.get("Item");
    if (item instanceof StringTag) {
        String id = ((StringTag) item).getValue();
        if (id.isEmpty()) {
            return BlockTypes.FLOWER_POT.getDefaultState();
        }
        int data = 0;
        Tag dataTag = values.get("Data");
        if (dataTag instanceof IntTag) {
            data = ((IntTag) dataTag).getValue();
        }
        BlockState newState = convertLegacyBlockType(id, data);
        if (newState != null) {
            values.clear();
            return newState;
        }
    }
    return block;
}
Also used : StringTag(com.sk89q.jnbt.StringTag) BlockState(com.sk89q.worldedit.world.block.BlockState) Tag(com.sk89q.jnbt.Tag) StringTag(com.sk89q.jnbt.StringTag) IntTag(com.sk89q.jnbt.IntTag) IntTag(com.sk89q.jnbt.IntTag)

Aggregations

StringTag (com.sk89q.jnbt.StringTag)16 Tag (com.sk89q.jnbt.Tag)15 CompoundTag (com.sk89q.jnbt.CompoundTag)14 IntTag (com.sk89q.jnbt.IntTag)8 ListTag (com.sk89q.jnbt.ListTag)8 HashMap (java.util.HashMap)8 ShortTag (com.sk89q.jnbt.ShortTag)5 BaseEntity (com.sk89q.worldedit.entity.BaseEntity)5 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)5 Location (com.sk89q.worldedit.util.Location)5 BaseBlock (com.sk89q.worldedit.world.block.BaseBlock)5 BlockState (com.sk89q.worldedit.world.block.BlockState)5 Region (com.sk89q.worldedit.regions.Region)4 ArrayList (java.util.ArrayList)4 ByteArrayTag (com.sk89q.jnbt.ByteArrayTag)3 IntArrayTag (com.sk89q.jnbt.IntArrayTag)3 NamedTag (com.sk89q.jnbt.NamedTag)3 BlockArrayClipboard (com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard)3 CuboidRegion (com.sk89q.worldedit.regions.CuboidRegion)3 Entity (com.sk89q.worldedit.entity.Entity)2