use of buildcraft.api.items.IBlueprintItem in project BuildCraft by BuildCraft.
the class ItemBlueprint method loadBlueprint.
public static BlueprintBase loadBlueprint(ItemStack stack) {
if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof IBlueprintItem)) {
return null;
}
LibraryId id = getId(stack);
if (id == null) {
return null;
}
NBTTagCompound nbt = BuildCraftBuilders.serverDB.load(id);
BlueprintBase base;
if (((IBlueprintItem) stack.getItem()).getType(stack) == EnumBlueprintType.TEMPLATE) {
base = new Template();
} else {
base = new Blueprint();
}
base.readFromNBT(nbt);
base.id = id;
return base;
}
Aggregations