aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel')
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/VanillaPlugin.java18
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java90
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java44
3 files changed, 143 insertions, 9 deletions
diff --git a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
index 1766f7239..940d9c779 100755
--- a/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
+++ b/src/main/java/me/shedaniel/plugin/VanillaPlugin.java
@@ -3,6 +3,8 @@ package me.shedaniel.plugin;
import me.shedaniel.api.IREIPlugin;
import me.shedaniel.impl.REIRecipeManager;
import me.shedaniel.listenerdefinitions.PotionCraftingAdder;
+import me.shedaniel.plugin.blastfurnace.VanillaBlastFurnaceCategory;
+import me.shedaniel.plugin.blastfurnace.VanillaBlastFurnaceRecipe;
import me.shedaniel.plugin.crafting.VanillaCraftingCategory;
import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
import me.shedaniel.plugin.crafting.VanillaShapedCraftingRecipe;
@@ -23,6 +25,7 @@ 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.BlastingRecipe;
import net.minecraft.recipe.smelting.SmeltingRecipe;
import net.minecraft.recipe.smelting.SmokingRecipe;
import net.minecraft.util.registry.Registry;
@@ -40,10 +43,12 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
List<VanillaCraftingRecipe> recipes = new LinkedList<>();
List<VanillaFurnaceRecipe> furnaceRecipes = new LinkedList<>();
List<VanillaSmokerRecipe> smokerRecipes = new LinkedList<>();
+ List<VanillaBlastFurnaceRecipe> blastFurnaceRecipes = 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 VanillaBlastFurnaceCategory());
// 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())));
@@ -63,6 +68,9 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
if (recipe instanceof SmokingRecipe) {
smokerRecipes.add(new VanillaSmokerRecipe((SmokingRecipe) recipe));
}
+ if (recipe instanceof BlastingRecipe) {
+ blastFurnaceRecipes.add(new VanillaBlastFurnaceRecipe((BlastingRecipe) recipe));
+ }
}
Registry.POTION.stream().filter(potion -> !potion.equals(Potions.EMPTY)).forEach(potion -> {
ItemStack basePotion = PotionUtil.setPotion(new ItemStack(Items.POTION), potion),
@@ -73,20 +81,12 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
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.ofItems(Items.GUNPOWDER).getStackArray(),
- new ItemStack[]{splashPotion}));
- 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("smoker", smokerRecipes);
REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().distinct().collect(Collectors.toList()));
+ REIRecipeManager.instance().addRecipe("blastingfurnace", blastFurnaceRecipes);
// REIRecipeManager.instance().addPotionRecipe("a", new RandomRecipe("a"));
// REIRecipeManager.instance().addPotionRecipe("b", new RandomRecipe("b"));
// REIRecipeManager.instance().addPotionRecipe("c", new RandomRecipe("c"));
diff --git a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
new file mode 100755
index 000000000..4ef67cbf9
--- /dev/null
+++ b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
@@ -0,0 +1,90 @@
+package me.shedaniel.plugin.blastfurnace;
+
+import me.shedaniel.api.IDisplayCategory;
+import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import me.shedaniel.gui.widget.WidgetArrow;
+import net.minecraft.block.Blocks;
+import net.minecraft.block.entity.BlastFurnaceBlockEntity;
+import net.minecraft.block.entity.SmokerBlockEntity;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class VanillaBlastFurnaceCategory implements IDisplayCategory<VanillaBlastFurnaceRecipe> {
+ private List<VanillaBlastFurnaceRecipe> recipes;
+
+ @Override
+ public String getId() {
+ return "blastingfurnace";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return I18n.translate("category.rei.blasting");
+ }
+
+ @Override
+ public void addRecipe(VanillaBlastFurnaceRecipe recipe) {
+ if (this.recipes == null)
+ this.recipes = new ArrayList<>();
+ this.recipes.add(recipe);
+ }
+
+ @Override
+ public void resetRecipes() {
+ this.recipes = new ArrayList<>();
+ }
+
+ @Override
+ public List<REISlot> setupDisplay(int number) {
+ List<REISlot> slots = new LinkedList<>();
+ REISlot inputSlot = new REISlot(50, 70 + number * 75);
+ inputSlot.setStackList(recipes.get(number).getInput().get(0));
+ inputSlot.setDrawBackground(true);
+
+ REISlot outputSlot = new REISlot(110, 70 + number * 75);
+ outputSlot.setStackList(recipes.get(number).getOutput());
+ outputSlot.setDrawBackground(true);
+
+ REISlot fuelSlot = new REISlot(80, 100 + number * 75);
+ fuelSlot.setStackList(getFuel());
+ fuelSlot.setDrawBackground(true);
+ fuelSlot.setExtraTooltip(I18n.translate("category.rei.smelting.fuel"));
+
+ slots.add(inputSlot);
+ slots.add(outputSlot);
+ slots.add(fuelSlot);
+ return slots;
+ }
+
+ @Override
+ public boolean canDisplay(VanillaBlastFurnaceRecipe recipe) {
+ return false;
+ }
+
+ @Override
+ public void drawExtras() {
+
+ }
+
+ @Override
+ public void addWidget(List<Control> controls, int number) {
+ WidgetArrow wa = new WidgetArrow(75, 70 + number * 75, true, 10);
+ controls.add(wa);
+ }
+
+ private List<ItemStack> getFuel() {
+ return BlastFurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
+ }
+
+ @Override
+ public ItemStack getCategoryIcon() {
+ return new ItemStack(Blocks.BLAST_FURNACE.getItem());
+ }
+}
diff --git a/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
new file mode 100755
index 000000000..3032c2401
--- /dev/null
+++ b/src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
@@ -0,0 +1,44 @@
+package me.shedaniel.plugin.blastfurnace;
+
+import me.shedaniel.api.IRecipe;
+import net.minecraft.block.BlastFurnaceBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.smelting.BlastingRecipe;
+import net.minecraft.recipe.smelting.SmokingRecipe;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class VanillaBlastFurnaceRecipe implements IRecipe<ItemStack> {
+ private final BlastingRecipe recipe;
+
+ @Override
+ public String getId() {
+ return "blastingfurnace";
+ }
+
+ public VanillaBlastFurnaceRecipe(BlastingRecipe recipe) {
+ this.recipe = recipe;
+ }
+
+ @Override
+ public List<ItemStack> getOutput() {
+ List<ItemStack> output = new LinkedList<>();
+ output.add(recipe.getOutput().copy());
+ return output;
+ }
+
+ @Override
+ public List<List<ItemStack>> getInput() {
+ List<List<ItemStack>> input = new LinkedList<>();
+ for(Ingredient ingredient : recipe.getPreviewInputs()) {
+ List<ItemStack> ingredients = new LinkedList<>();
+ for(ItemStack matchingStack : ingredient.getStackArray()) {
+ ingredients.add(matchingStack);
+ }
+ input.add(ingredients);
+ }
+ return input;
+ }
+}