Add MissingIngredientExpection
This commit is contained in:
parent
eb2453480f
commit
a0c3cc644a
14 changed files with 45 additions and 30 deletions
|
@ -15,7 +15,7 @@ import reborncore.common.BaseBlock;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
|
||||
|
@ -36,7 +36,7 @@ public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
|
|||
return new ItemStack(ModBlocks.machineframe, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.world.config.IOreNameProvider;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
|
@ -47,7 +47,7 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
return new ItemStack(ModBlocks.ore2, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The ore block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name) {
|
||||
|
@ -63,7 +63,7 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The ore block " + name + " could not be found.");
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import reborncore.common.BaseBlock;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock {
|
|||
return new ItemStack(ModBlocks.storage2, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The storage block " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The storage block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,11 +31,12 @@ import techreborn.blocks.*;
|
|||
import techreborn.compat.CompatManager;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.items.*;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import techreborn.parts.powerCables.ItemStandaloneCables;
|
||||
import techreborn.utils.RecipeUtils;
|
||||
import techreborn.utils.StackWIPHandler;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -990,10 +991,10 @@ public class ModRecipes {
|
|||
ItemStack item = null;
|
||||
try {
|
||||
item = ItemIngots.getIngotByName(name, 9);
|
||||
} catch (InvalidParameterException e) {
|
||||
} catch (MissingIngredientExpection e) {
|
||||
try {
|
||||
item = ItemGems.getGemByName(name, 9);
|
||||
} catch (InvalidParameterException e2) {
|
||||
} catch (MissingIngredientExpection e2) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDusts extends ItemTextureBase {
|
||||
|
@ -31,7 +31,7 @@ public class ItemDusts extends ItemTextureBase {
|
|||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The dust " + name + " could not be found.");
|
||||
}
|
||||
return new ItemStack(ModItems.dusts, count, i);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class ItemDusts extends ItemTextureBase {
|
|||
if (name.equalsIgnoreCase("gunpowder")) {
|
||||
return new ItemStack(Items.GUNPOWDER, count);
|
||||
}
|
||||
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDustsSmall extends ItemTextureBase {
|
||||
|
@ -32,12 +32,12 @@ public class ItemDustsSmall extends ItemTextureBase {
|
|||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||
throw new InvalidParameterException("The small dust " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The small dust " + name + " could not be found.");
|
||||
}
|
||||
return new ItemStack(ModItems.smallDusts, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The small dust " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The small dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getSmallDustByName(String name) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemGems extends ItemTextureBase {
|
||||
|
@ -26,7 +26,7 @@ public class ItemGems extends ItemTextureBase {
|
|||
return new ItemStack(ModItems.gems, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getGemByName(String name) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemIngots extends ItemTextureBase {
|
||||
|
@ -28,7 +28,7 @@ public class ItemIngots extends ItemTextureBase {
|
|||
return new ItemStack(ModItems.ingots, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The ingot " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The ingot " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getIngotByName(String name) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNuggets extends ItemTextureBase {
|
||||
|
@ -29,7 +29,7 @@ public class ItemNuggets extends ItemTextureBase {
|
|||
return new ItemStack(ModItems.nuggets, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The nugget " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The nugget " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getNuggetByName(String name) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemParts extends ItemTextureBase {
|
||||
|
@ -36,7 +36,7 @@ public class ItemParts extends ItemTextureBase {
|
|||
return new ItemStack(ModItems.parts, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import techreborn.init.ModItems;
|
|||
import techreborn.lib.ModInfo;
|
||||
import techreborn.utils.OreDictUtils;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPlates extends ItemTextureBase {
|
||||
|
@ -31,7 +31,7 @@ public class ItemPlates extends ItemTextureBase {
|
|||
return new ItemStack(ModItems.plate, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The plate " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The plate " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPlateByName(String name) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.utils.upgrade.IMachineUpgrade;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrades extends ItemTextureBase implements IMachineUpgrade, ITexturedItem {
|
||||
|
@ -31,7 +31,7 @@ public class ItemUpgrades extends ItemTextureBase implements IMachineUpgrade, IT
|
|||
return new ItemStack(ModItems.upgrades, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The upgrade " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The upgrade " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getUpgradeByName(String name) {
|
||||
|
|
14
src/main/java/techreborn/lib/MissingIngredientExpection.java
Normal file
14
src/main/java/techreborn/lib/MissingIngredientExpection.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package techreborn.lib;
|
||||
|
||||
/**
|
||||
* Created by Mark on 05/01/2017.
|
||||
*/
|
||||
public class MissingIngredientExpection extends RuntimeException {
|
||||
|
||||
public MissingIngredientExpection() {
|
||||
}
|
||||
|
||||
public MissingIngredientExpection(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import techreborn.items.ItemTextureBase;
|
|||
import techreborn.lib.ModInfo;
|
||||
import techreborn.parts.StandalonePartCompact;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import techreborn.lib.MissingIngredientExpection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ public class ItemStandaloneCables extends ItemTextureBase {
|
|||
count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The cable " + name + " could not be found.");
|
||||
throw new MissingIngredientExpection("The cable " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getCableByName(String name) {
|
||||
|
|
Loading…
Reference in a new issue