aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2018-12-31 13:12:25 +0800
committerUnknown <shekwancheung0528@gmail.com>2018-12-31 13:12:25 +0800
commitfee12aa0885da204ec874cd5ada371c42501c873 (patch)
tree880596f5f463e08762a56b1cb1d7008aaed1899d /src/main/java/me/shedaniel/plugin/VanillaPlugin.java
parent1b14c5142bb49db9af078b5c753bc22ce35a40cc (diff)
downloadRoughlyEnoughItems-fee12aa0885da204ec874cd5ada371c42501c873.tar.gz
RoughlyEnoughItems-fee12aa0885da204ec874cd5ada371c42501c873.tar.bz2
RoughlyEnoughItems-fee12aa0885da204ec874cd5ada371c42501c873.zip
packetadder wip
Diffstat (limited to 'src/main/java/me/shedaniel/plugin/VanillaPlugin.java')
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/VanillaPlugin.java59
1 files changed, 41 insertions, 18 deletions
diff --git a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
index 70e7918da..1766f7239 100755
--- a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
+++ b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
@@ -11,14 +11,21 @@ import me.shedaniel.plugin.furnace.VanillaFurnaceCategory;
import me.shedaniel.plugin.furnace.VanillaFurnaceRecipe;
import me.shedaniel.plugin.potion.VanillaPotionCategory;
import me.shedaniel.plugin.potion.VanillaPotionRecipe;
-import net.minecraft.init.Items;
-import net.minecraft.init.PotionTypes;
+import me.shedaniel.plugin.smoker.VanillaSmokerCategory;
+import me.shedaniel.plugin.smoker.VanillaSmokerRecipe;
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 net.minecraft.item.Items;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionUtil;
+import net.minecraft.potion.Potions;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.Recipe;
+import net.minecraft.recipe.crafting.ShapedRecipe;
+import net.minecraft.recipe.crafting.ShapelessRecipe;
+import net.minecraft.recipe.smelting.SmeltingRecipe;
+import net.minecraft.recipe.smelting.SmokingRecipe;
+import net.minecraft.util.registry.Registry;
import java.util.LinkedList;
import java.util.List;
@@ -32,39 +39,54 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
public void register() {
List<VanillaCraftingRecipe> recipes = new LinkedList<>();
List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>();
+ List<VanillaSmokerRecipe> smokerRecipes = new LinkedList<>();
REIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory());
REIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory());
REIRecipeManager.instance().addDisplayAdapter(new VanillaPotionCategory());
+ REIRecipeManager.instance().addDisplayAdapter(new VanillaSmokerCategory());
// 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 : REIRecipeManager.instance().recipeManager.getRecipes()) {
+ for(Recipe recipe : REIRecipeManager.instance().recipeManager.values()) {
if (recipe instanceof ShapelessRecipe) {
recipes.add(new VanillaShapelessCraftingRecipe((ShapelessRecipe) recipe));
}
if (recipe instanceof ShapedRecipe) {
recipes.add(new VanillaShapedCraftingRecipe((ShapedRecipe) recipe));
}
- if (recipe instanceof FurnaceRecipe) {
- furnaceRecipes.add(new VanillaFurnaceRecipe((FurnaceRecipe) recipe));
+ if (recipe instanceof SmeltingRecipe) {
+ furnaceRecipes.add(new VanillaFurnaceRecipe((SmeltingRecipe) recipe));
+ }
+ if (recipe instanceof SmokingRecipe) {
+ smokerRecipes.add(new VanillaSmokerRecipe((SmokingRecipe) recipe));
}
}
- IRegistry.POTION.stream().filter(potionType -> !potionType.equals(PotionTypes.EMPTY)).forEach(potionType -> {
+ Registry.POTION.stream().filter(potion -> !potion.equals(Potions.EMPTY)).forEach(potion -> {
+ ItemStack basePotion = PotionUtil.setPotion(new ItemStack(Items.POTION), potion),
+ splashPotion = PotionUtil.setPotion(new ItemStack(Items.SPLASH_POTION), potion),
+ lingeringPotion = PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), potion);
+ potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{basePotion}, Ingredient.ofItems(Items.GUNPOWDER).getStackArray(),
+ new ItemStack[]{splashPotion}));
+ potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.ofItems(Items.DRAGON_BREATH).getStackArray(),
+ new ItemStack[]{lingeringPotion}));
+ });
+ /*PotionType.REGISTRY.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(),
+ potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{basePotion}, Ingredient.ofItems(Items.GUNPOWDER).getStackArray(),
new ItemStack[]{splashPotion}));
- potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.fromItems(Items.DRAGON_BREATH).getMatchingStacks(),
+ potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{splashPotion}, Ingredient.ofItems(Items.DRAGON_BREATH).getStackArray(),
new ItemStack[]{lingeringPotion}));
- });
+ });*/
REIRecipeManager.instance().addRecipe("vanilla", recipes);
REIRecipeManager.instance().addRecipe("furnace", furnaceRecipes);
- REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().collect(Collectors.toList()));
+ REIRecipeManager.instance().addRecipe("smoker", smokerRecipes);
+ REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().distinct().collect(Collectors.toList()));
// REIRecipeManager.instance().addPotionRecipe("a", new RandomRecipe("a"));
// REIRecipeManager.instance().addPotionRecipe("b", new RandomRecipe("b"));
// REIRecipeManager.instance().addPotionRecipe("c", new RandomRecipe("c"));
@@ -72,10 +94,11 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
// 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)}));
+ public void addPotionRecipe(Potion inputType, Item reagent, Potion outputType) {
+ potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), inputType)},
+ Ingredient.ofItems(reagent).getStackArray(),
+ new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), outputType)}));
}
}