make the blueprint library ignore empty blueprints/templates

This commit is contained in:
asiekierka 2015-09-20 09:46:28 +02:00
parent 6ebb701f23
commit b22d0c5b64
2 changed files with 7 additions and 2 deletions

View file

@ -10,6 +10,8 @@ package buildcraft.builders;
import java.util.List;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -103,6 +105,9 @@ public abstract class ItemBlueprint extends ItemBuildCraft implements IBlueprint
return itemIcon;
}
public static boolean isContentReadable(ItemStack stack) {
return getId(stack) != null;
}
public static LibraryId getId(ItemStack stack) {
NBTTagCompound nbt = NBTUtils.getItemData(stack);

View file

@ -19,9 +19,9 @@ public class LibraryBlueprintTypeHandler extends LibraryTypeHandlerNBT {
@Override
public boolean isHandler(ItemStack stack, HandlerType type) {
if (isBlueprint) {
return stack.getItem() instanceof ItemBlueprintStandard;
return stack.getItem() instanceof ItemBlueprintStandard && ItemBlueprint.isContentReadable(stack);
} else {
return stack.getItem() instanceof ItemBlueprintTemplate;
return stack.getItem() instanceof ItemBlueprintTemplate && ItemBlueprint.isContentReadable(stack);
}
}