make the blueprint library ignore empty blueprints/templates
This commit is contained in:
parent
6ebb701f23
commit
b22d0c5b64
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue