Move dynamic recipes to new registration system

This commit is contained in:
Vincent Lee committed 2017-06-25 00:18:15 -05:00
1 parent 48784fe495
commit 1dd68f9558
13 files changed
+71 -40

No files matched your search

@@ -65,9 +65,6 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
public BlockFloatingSpecialFlower() {
super(LibBlockNames.FLOATING_SPECIAL_FLOWER);
GameRegistry.register(new SpecialFloatingFlowerRecipe(), new ResourceLocation(LibMisc.MOD_ID, "special_floating_flower"));
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
}
@Nonnull
@@ -25,24 +25,46 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraftforge.registries.IForgeRegistry;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.tile.TileCraftCrate;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.crafting.recipe.AesirRingRecipe;
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
import vazkii.botania.common.crafting.recipe.ArmorUpgradeRecipe;
import vazkii.botania.common.crafting.recipe.BlackHoleTalismanExtractRecipe;
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
import vazkii.botania.common.crafting.recipe.CosmeticAttachRecipe;
import vazkii.botania.common.crafting.recipe.CosmeticRemoveRecipe;
import vazkii.botania.common.crafting.recipe.HelmRevealingRecipe;
import vazkii.botania.common.crafting.recipe.KeepIvyRecipe;
import vazkii.botania.common.crafting.recipe.LensDyeingRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunClipRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe;
import vazkii.botania.common.crafting.recipe.ManaGunRemoveLensRecipe;
import vazkii.botania.common.crafting.recipe.ManaUpgradeRecipe;
import vazkii.botania.common.crafting.recipe.PhantomInkRecipe;
import vazkii.botania.common.crafting.recipe.ShapelessManaUpgradeRecipe;
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
import vazkii.botania.common.crafting.recipe.SpellClothRecipe;
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
import vazkii.botania.common.item.ItemTwigWand;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibOreDict;
@Mod.EventBusSubscriber
public final class ModCraftingRecipes {
public static IRecipe recipeLexicon;
@@ -314,7 +336,55 @@ public final class ModCraftingRecipes {
public static IRecipe recipeFelPumpkin;
public static IRecipe recipeEndPortal;
public static void init() {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> evt) {
IForgeRegistry<IRecipe> r = evt.getRegistry();
r.register(new AesirRingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "aesir_ring")));
RecipeSorter.register("botania:aesirRing", AesirRingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new AncientWillRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "ancient_will_attach")));
RecipeSorter.register("botania:ancientWill", AncientWillRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new BlackHoleTalismanExtractRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "black_hole_talisman_extract")));
RecipeSorter.register("botania:blackHoleTalismanExtract", BlackHoleTalismanExtractRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new SpellClothRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cleanse_enchants")));
RecipeSorter.register("botania:spellCloth", SpellClothRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new CompositeLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "composite_lens")));
RecipeSorter.register("botania:compositeLens", CompositeLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new CosmeticAttachRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cosmetic_attach")));
r.register(new CosmeticRemoveRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "cosmetic_remove")));
RecipeSorter.register("botania:cosmeticAttach", CosmeticAttachRecipe.class, RecipeSorter.Category.SHAPELESS, "");
RecipeSorter.register("botania:cosmeticRemove", CosmeticRemoveRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new HelmRevealingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "helm_revealing")));
RecipeSorter.register("botania:helmRevealing", HelmRevealingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new KeepIvyRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "keep_ivy_attach")));
RecipeSorter.register("botania:keepIvy", KeepIvyRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new LensDyeingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "lens_dye")));
RecipeSorter.register("botania:lensDying", LensDyeingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new ManaGunLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_lens")));
r.register(new ManaGunRemoveLensRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_remove_lens")));
r.register(new ManaGunClipRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_clip")));
RecipeSorter.register("botania:manaGunLens", ManaGunLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
RecipeSorter.register("botania:manaGunRemoveLens", ManaGunRemoveLensRecipe.class, RecipeSorter.Category.SHAPELESS, "");
RecipeSorter.register("botania:manaGunClip", ManaGunClipRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new PhantomInkRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "phantom_ink")));
RecipeSorter.register("botania:phantomInk", PhantomInkRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new SpecialFloatingFlowerRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "special_floating_flower")));
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, RecipeSorter.Category.SHAPELESS, "");
r.register(new TerraPickTippingRecipe().setRegistryName(new ResourceLocation(LibMisc.MOD_ID, "terra_pick_tipping")));
RecipeSorter.register("botania:terraPickTipping", TerraPickTippingRecipe.class, RecipeSorter.Category.SHAPELESS, "");
int recipeListSize = CraftingManager.getInstance().getRecipeList().size();
// Lexicon Recipe
@@ -41,9 +41,6 @@ public class ItemAncientWill extends ItemMod {
super(LibItemNames.ANCIENT_WILL);
setHasSubtypes(true);
setMaxStackSize(1);
GameRegistry.register(new AncientWillRecipe(), new ResourceLocation(LibMisc.MOD_ID, "ancient_will_attach"));
RecipeSorter.register("botania:ancientWill", AncientWillRecipe.class, Category.SHAPELESS, "");
}
@Override
@@ -61,9 +61,6 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
super(LibItemNames.BLACK_HOLE_TALISMAN);
setMaxStackSize(1);
setHasSubtypes(true);
GameRegistry.register(new BlackHoleTalismanExtractRecipe(), new ResourceLocation(LibMisc.MOD_ID, "black_hole_talisman_extract"));
RecipeSorter.register("botania:blackHoleTalismanExtract", BlackHoleTalismanExtractRecipe.class, Category.SHAPELESS, "");
}
@Nonnull
@@ -40,8 +40,6 @@ public class ItemKeepIvy extends ItemMod {
public ItemKeepIvy() {
super(LibItemNames.KEEP_IVY);
GameRegistry.register(new KeepIvyRecipe(), new ResourceLocation(LibMisc.MOD_ID, "keep_ivy_attach"));
RecipeSorter.register("botania:keepIvy", KeepIvyRecipe.class, Category.SHAPELESS, "");
MinecraftForge.EVENT_BUS.register(ItemKeepIvy.class);
}
@@ -69,13 +69,6 @@ public class ItemManaGun extends ItemMod implements IManaUsingItem {
setMaxDamage(COOLDOWN);
setMaxStackSize(1);
setNoRepair();
GameRegistry.register(new ManaGunLensRecipe(), new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_lens"));
GameRegistry.register(new ManaGunRemoveLensRecipe(), new ResourceLocation(LibMisc.MOD_ID, "mana_gun_remove_lens"));
GameRegistry.register(new ManaGunClipRecipe(), new ResourceLocation(LibMisc.MOD_ID, "mana_gun_add_clip"));
RecipeSorter.register("botania:manaGunLens", ManaGunLensRecipe.class, Category.SHAPELESS, "");
RecipeSorter.register("botania:manaGunRemoveLens", ManaGunRemoveLensRecipe.class, Category.SHAPELESS, "");
RecipeSorter.register("botania:manaGunClip", ManaGunClipRecipe.class, Category.SHAPELESS, "");
}
@Nonnull
@@ -22,8 +22,6 @@ public class ItemPhantomInk extends ItemMod {
public ItemPhantomInk() {
super(LibItemNames.PHANTOM_INK);
GameRegistry.register(new PhantomInkRecipe(), new ResourceLocation(LibMisc.MOD_ID, "phantom_ink"));
RecipeSorter.register("botania:phantomInk", PhantomInkRecipe.class, Category.SHAPELESS, "");
}
}
@@ -28,9 +28,6 @@ public class ItemSpellCloth extends ItemMod {
setMaxDamage(35);
setMaxStackSize(1);
setNoRepair();
GameRegistry.register(new SpellClothRecipe(), new ResourceLocation(LibMisc.MOD_ID, "cleanse_enchants"));
RecipeSorter.register("botania:spellCloth", SpellClothRecipe.class, Category.SHAPELESS, "");
}
@Override
@@ -69,11 +69,6 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
public ItemBaubleCosmetic() {
super(LibItemNames.COSMETIC);
setHasSubtypes(true);
GameRegistry.register(new CosmeticAttachRecipe(), new ResourceLocation(LibMisc.MOD_ID, "cosmetic_attach"));
GameRegistry.register(new CosmeticRemoveRecipe(), new ResourceLocation(LibMisc.MOD_ID, "cosmetic_remove"));
RecipeSorter.register("botania:cosmeticAttach", CosmeticAttachRecipe.class, Category.SHAPELESS, "");
RecipeSorter.register("botania:cosmeticRemove", CosmeticRemoveRecipe.class, Category.SHAPELESS, "");
renderStack = new ItemStack(this);
}
@@ -80,8 +80,6 @@ public class ItemTerraPick extends ItemManasteelPick implements IManaItem, ISequ
public ItemTerraPick() {
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_PICK);
GameRegistry.register(new TerraPickTippingRecipe(), new ResourceLocation(LibMisc.MOD_ID, "terra_pick_tipping"));
RecipeSorter.register("botania:terraPickTipping", TerraPickTippingRecipe.class, Category.SHAPELESS, "");
addPropertyOverride(new ResourceLocation("botania", "tipped"), (itemStack, world, entityLivingBase) -> isTipped(itemStack) ? 1 : 0);
addPropertyOverride(new ResourceLocation("botania", "enabled"), (itemStack, world, entityLivingBase) -> isEnabled(itemStack) ? 1 : 0);
}
@@ -34,8 +34,6 @@ public class ItemManasteelHelmRevealing extends ItemManasteelHelm implements IGo
public ItemManasteelHelmRevealing() {
super(LibItemNames.MANASTEEL_HELM_R);
GameRegistry.register(new HelmRevealingRecipe(), new ResourceLocation(LibMisc.MOD_ID, "helm_revealing")); //Manasteel is the base so it gets the recipe added in its constructor so that ModItems can call it
RecipeSorter.register("botania:helmRevealing", HelmRevealingRecipe.class, Category.SHAPELESS, "");
}
@Override
@@ -153,11 +153,6 @@ public class ItemLens extends ItemMod implements ILensControl, ICompositableLens
super(LibItemNames.LENS);
setMaxStackSize(1);
setHasSubtypes(true);
GameRegistry.register(new CompositeLensRecipe(), new ResourceLocation(LibMisc.MOD_ID, "composite_lens"));
GameRegistry.register(new LensDyeingRecipe(), new ResourceLocation(LibMisc.MOD_ID, "lens_dye"));
RecipeSorter.register("botania:compositeLens", CompositeLensRecipe.class, Category.SHAPELESS, "");
RecipeSorter.register("botania:lensDying", LensDyeingRecipe.class, Category.SHAPELESS, "");
}
@Override
@@ -46,8 +46,6 @@ public class ItemAesirRing extends ItemRelicBauble implements IWireframeCoordina
public ItemAesirRing() {
super(LibItemNames.AESIR_RING);
GameRegistry.register(new AesirRingRecipe(), new ResourceLocation(LibMisc.MOD_ID, "aesir_ring"));
RecipeSorter.register("botania:aesirRing", AesirRingRecipe.class, Category.SHAPELESS, "");
MinecraftForge.EVENT_BUS.register(this);
}