diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2018-12-30 20:10:36 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2018-12-30 20:10:36 +0800 |
| commit | 3e1f4333a51513b440b32adfe9b698590fbf76f5 (patch) | |
| tree | cf337b4e12df85cd30d25721bab6c1ba1f4591f8 /src/main/java/me/shedaniel/plugin/VanillaPlugin.java | |
| parent | 814e2e94ad643f04576ab0569c4b94f96b275f51 (diff) | |
| download | RoughlyEnoughItems-3e1f4333a51513b440b32adfe9b698590fbf76f5.tar.gz RoughlyEnoughItems-3e1f4333a51513b440b32adfe9b698590fbf76f5.tar.bz2 RoughlyEnoughItems-3e1f4333a51513b440b32adfe9b698590fbf76f5.zip | |
Better stuff
Diffstat (limited to 'src/main/java/me/shedaniel/plugin/VanillaPlugin.java')
| -rwxr-xr-x | src/main/java/me/shedaniel/plugin/VanillaPlugin.java | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java index 22c87a168..70e7918da 100755 --- a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java +++ b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java @@ -1,31 +1,47 @@ package me.shedaniel.plugin; -import me.shedaniel.api.IAEIPlugin; -import me.shedaniel.impl.AEIRecipeManager; +import me.shedaniel.api.IREIPlugin; +import me.shedaniel.impl.REIRecipeManager; +import me.shedaniel.listenerdefinitions.PotionCraftingAdder; import me.shedaniel.plugin.crafting.VanillaCraftingCategory; import me.shedaniel.plugin.crafting.VanillaCraftingRecipe; import me.shedaniel.plugin.crafting.VanillaShapedCraftingRecipe; import me.shedaniel.plugin.crafting.VanillaShapelessCraftingRecipe; import me.shedaniel.plugin.furnace.VanillaFurnaceCategory; import me.shedaniel.plugin.furnace.VanillaFurnaceRecipe; -import net.minecraft.item.crafting.FurnaceRecipe; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipe; -import net.minecraft.item.crafting.ShapelessRecipe; +import me.shedaniel.plugin.potion.VanillaPotionCategory; +import me.shedaniel.plugin.potion.VanillaPotionRecipe; +import net.minecraft.init.Items; +import net.minecraft.init.PotionTypes; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.*; +import net.minecraft.potion.PotionType; +import net.minecraft.potion.PotionUtils; +import net.minecraft.util.registry.IRegistry; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; +import java.util.stream.Collectors; -public class VanillaPlugin implements IAEIPlugin { +public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder { + + private List<VanillaPotionRecipe> potionRecipes = new LinkedList<>(); + @Override public void register() { List<VanillaCraftingRecipe> recipes = new LinkedList<>(); List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>(); - AEIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory()); - AEIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory()); + REIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory()); + REIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory()); + REIRecipeManager.instance().addDisplayAdapter(new VanillaPotionCategory()); +// REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("a", new ItemStack(Blocks.ACACIA_BUTTON.asItem()))); +// REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("b", new ItemStack(Blocks.ACACIA_LOG.asItem()))); +// REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("c", new ItemStack(Blocks.ACACIA_LOG.asItem()))); +// REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("d", new ItemStack(Blocks.ACACIA_LOG.asItem()))); +// REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("e", new ItemStack(Blocks.ACACIA_LOG.asItem()))); - for(IRecipe recipe : AEIRecipeManager.instance().recipeManager.getRecipes()) { + for(IRecipe recipe : REIRecipeManager.instance().recipeManager.getRecipes()) { if (recipe instanceof ShapelessRecipe) { recipes.add(new VanillaShapelessCraftingRecipe((ShapelessRecipe) recipe)); } @@ -36,8 +52,30 @@ public class VanillaPlugin implements IAEIPlugin { furnaceRecipes.add(new VanillaFurnaceRecipe((FurnaceRecipe) recipe)); } } + IRegistry.POTION.stream().filter(potionType -> !potionType.equals(PotionTypes.EMPTY)).forEach(potionType -> { + ItemStack basePotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionType), + splashPotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potionType), + lingeringPotion = PotionUtils.addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), potionType); + potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{basePotion}, Ingredient.fromItems(Items.GUNPOWDER).getMatchingStacks(), + new ItemStack[]{splashPotion})); + potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.fromItems(Items.DRAGON_BREATH).getMatchingStacks(), + new ItemStack[]{lingeringPotion})); + }); - AEIRecipeManager.instance().addRecipe("vanilla", recipes); - AEIRecipeManager.instance().addRecipe("furnace", furnaceRecipes); + REIRecipeManager.instance().addRecipe("vanilla", recipes); + REIRecipeManager.instance().addRecipe("furnace", furnaceRecipes); + REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().collect(Collectors.toList())); +// REIRecipeManager.instance().addPotionRecipe("a", new RandomRecipe("a")); +// REIRecipeManager.instance().addPotionRecipe("b", new RandomRecipe("b")); +// REIRecipeManager.instance().addPotionRecipe("c", new RandomRecipe("c")); +// REIRecipeManager.instance().addPotionRecipe("d", new RandomRecipe("d")); +// REIRecipeManager.instance().addPotionRecipe("e", new RandomRecipe("e")); + } + + @Override + public void addPotionRecipe(PotionType inputType, Item reagent, PotionType outputType) { + potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), inputType)}, + Ingredient.fromItems(reagent).getMatchingStacks(), + new ItemStack[]{PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), outputType)})); } } |
