Search in sources :

Example 11 with InvalidRecipeConfigException

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

the class ItemOptional method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    if (name == null || name.trim().isEmpty()) {
        nullItem = true;
        return this;
    }
    thing.add(name);
    final String nbt_nullchecked = nbt;
    if (nbt_nullchecked != null) {
        if (!nbt_nullchecked.trim().isEmpty()) {
            try {
                thing.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 12 with InvalidRecipeConfigException

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

the class Smelting method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (exp == null) {
            if (valid) {
                exp = FurnaceRecipes.instance().getSmeltingExperience(getOutput().getItemStack());
            }
        } else {
            if (exp < 0) {
                throw new InvalidRecipeConfigException("Invalid negative value for 'exp'");
            }
            if (exp > 1) {
                throw new InvalidRecipeConfigException("Invalid value for 'exp', above 100%");
            }
        }
        if (input == null) {
            throw new InvalidRecipeConfigException("Missing <input>");
        }
        if (!vanilla && !tinkers) {
            throw new InvalidRecipeConfigException("One or more of 'vanilla' or 'tinkers' must be enabled");
        }
        if (vanilla && input.amount != 1f) {
            throw new InvalidRecipeConfigException("For 'vanilla' setting an input amount is not valid");
        }
        valid = valid && input.isValid() && (!vanilla || Prep.isValid(input.getItemStack()));
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <smelting>");
    }
    return this;
}
Also used : InvalidRecipeConfigException(crazypants.enderio.base.config.recipes.InvalidRecipeConfigException)

Example 13 with InvalidRecipeConfigException

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

the class Spawning method readResolve.

@Override
public Object readResolve() throws InvalidRecipeConfigException {
    try {
        super.readResolve();
        if (entities.isEmpty()) {
            throw new InvalidRecipeConfigException("Missing <entity>");
        }
        valid = true;
        for (Entity entity : entities) {
            valid = valid && entity.isValid();
        }
    } catch (InvalidRecipeConfigException e) {
        throw new InvalidRecipeConfigException(e, "in <spawning>");
    }
    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