Search in sources :

Example 6 with InvalidRecipeConfigException

use of crazypants.enderio.base.config.recipes.InvalidRecipeConfigException in project EnderIO by SleepyTrousers.

the class Output method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    super.readResolve();
    if (item == null) {
        throw new InvalidRecipeConfigException("Missing name in <output>");
    }
    if (isValid()) {
        if (amount < 0) {
            throw new InvalidRecipeConfigException("Invalid negative amount in <output>");
        }
        if (amount > item.getItemStack().getMaxStackSize()) {
            throw new InvalidRecipeConfigException("Invalid amount in <output>, bigger than maximum stack size");
        }
        if (amount == 0) {
            amount = 1;
        }
    }
    item.getThing().setSize(amount);
    final String nbt_nullchecked = nbt;
    if (nbt_nullchecked != null) {
        if (!nbt_nullchecked.trim().isEmpty()) {
            try {
                item.getThing().setNbt(JsonToNBT.getTagFromJson(nbt_nullchecked));
            } catch (NBTException e) {
                throw new InvalidRecipeConfigException(nbt_nullchecked + " is not valid NBT json.");
            }
        }
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException) NBTException(net.minecraft.nbt.NBTException)

Example 7 with InvalidRecipeConfigException

use of crazypants.enderio.base.config.recipes.InvalidRecipeConfigException in project EnderIO by SleepyTrousers.

the class Sagmilling method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (input == null) {
            throw new InvalidRecipeConfigException("Missing <input>");
        }
        if (energy < 0) {
            throw new InvalidRecipeConfigException("Invalid negative value for 'energy'");
        }
        valid = valid && input.isValid();
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <alloying>");
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)

Example 8 with InvalidRecipeConfigException

use of crazypants.enderio.base.config.recipes.InvalidRecipeConfigException in project EnderIO by SleepyTrousers.

the class Fermenting method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (inputgroup.size() < 1 || inputgroup.size() > 2) {
            throw new InvalidRecipeConfigException("Wrong number of <inputgroup>");
        }
        if (energy < 0) {
            throw new InvalidRecipeConfigException("Invalid negative value for 'energy'");
        }
        valid = inputfluid.isValid() && outputfluid.isValid();
        for (Inputgroup input : inputgroup) {
            valid = valid && input.isValid();
        }
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <fermenting>");
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)

Example 9 with InvalidRecipeConfigException

use of crazypants.enderio.base.config.recipes.InvalidRecipeConfigException in project EnderIO by SleepyTrousers.

the class Casting method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (input == null) {
            throw new InvalidRecipeConfigException("Missing <input>");
        }
        valid = valid && input.isValid() && (cast == null ? true : cast.isValid());
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <casting>");
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)

Example 10 with InvalidRecipeConfigException

use of crazypants.enderio.base.config.recipes.InvalidRecipeConfigException in project EnderIO by SleepyTrousers.

the class Enchanting method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (input == null) {
            throw new InvalidRecipeConfigException("Missing <input>");
        }
        if (enchantment == null) {
            throw new InvalidRecipeConfigException("Missing <enchantment>");
        }
        valid = input.isValid() && enchantment.isValid();
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <enchanting>");
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)

Aggregations

InvalidRecipeConfigException (crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)13 NBTException (net.minecraft.nbt.NBTException)3 CapturedMob (crazypants.enderio.util.CapturedMob)1