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;
}
Aggregations