aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/plugin')
-rw-r--r--src/main/java/me/shedaniel/plugin/RandomRecipe.java6
-rw-r--r--src/main/java/me/shedaniel/plugin/TestRandomCategory.java3
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/VanillaPlugin.java59
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java17
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java10
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java14
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java16
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java14
-rw-r--r--src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java32
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java2
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java89
-rwxr-xr-xsrc/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java43
12 files changed, 228 insertions, 77 deletions
diff --git a/src/main/java/me/shedaniel/plugin/RandomRecipe.java b/src/main/java/me/shedaniel/plugin/RandomRecipe.java
index 5dcdb9d4a..4a33c8be1 100644
--- a/src/main/java/me/shedaniel/plugin/RandomRecipe.java
+++ b/src/main/java/me/shedaniel/plugin/RandomRecipe.java
@@ -1,7 +1,7 @@
package me.shedaniel.plugin;
import me.shedaniel.api.IRecipe;
-import net.minecraft.init.Blocks;
+import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import java.util.Arrays;
@@ -23,11 +23,11 @@ public class RandomRecipe implements IRecipe<ItemStack> {
@Override
public List<ItemStack> getOutput() {
- return new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.BEETROOTS.asItem())}));
+ return new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.BEETROOTS.getItem())}));
}
@Override
public List<List<ItemStack>> getInput() {
- return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.asItem())}))));
+ return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.getItem())}))));
}
}
diff --git a/src/main/java/me/shedaniel/plugin/TestRandomCategory.java b/src/main/java/me/shedaniel/plugin/TestRandomCategory.java
index 4773e7e55..877e9c3fd 100644
--- a/src/main/java/me/shedaniel/plugin/TestRandomCategory.java
+++ b/src/main/java/me/shedaniel/plugin/TestRandomCategory.java
@@ -3,9 +3,6 @@ package me.shedaniel.plugin;
import me.shedaniel.api.IDisplayCategory;
import me.shedaniel.gui.widget.Control;
import me.shedaniel.gui.widget.REISlot;
-import me.shedaniel.plugin.crafting.VanillaCraftingRecipe;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
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)}));
}
}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
index 1c37ed292..dec94db05 100755
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
+++ b/src/main/java/me/shedaniel/plugin/crafting/VanillaCraftingCategory.java
@@ -1,14 +1,13 @@
package me.shedaniel.plugin.crafting;
import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.gui.widget.REISlot;
import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
import me.shedaniel.gui.widget.WidgetArrow;
-import net.minecraft.client.MainWindow;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
+import net.minecraft.block.Blocks;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.client.util.Window;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
@@ -16,7 +15,7 @@ import java.util.LinkedList;
import java.util.List;
public class VanillaCraftingCategory implements IDisplayCategory<VanillaCraftingRecipe> {
- MainWindow mainWindow = Minecraft.getInstance().mainWindow;
+ Window mainWindow = MinecraftClient.getInstance().window;
private List<VanillaCraftingRecipe> recipes;
@Override
@@ -26,7 +25,7 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
@Override
public String getDisplayName() {
- return I18n.format("category.rei.crafting");
+ return I18n.translate("category.rei.crafting");
}
@Override
@@ -109,7 +108,7 @@ public class VanillaCraftingCategory implements IDisplayCategory<VanillaCrafting
@Override
public ItemStack getCategoryIcon() {
- return new ItemStack(Blocks.CRAFTING_TABLE.asItem());
+ return new ItemStack(Blocks.CRAFTING_TABLE.getItem());
}
}
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
index 1c537b2a7..3f830f381 100755
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
+++ b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java
@@ -1,8 +1,8 @@
package me.shedaniel.plugin.crafting;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.Ingredient;
-import net.minecraft.item.crafting.ShapedRecipe;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.crafting.ShapedRecipe;
import java.util.LinkedList;
import java.util.List;
@@ -34,7 +34,7 @@ public class VanillaShapedCraftingRecipe extends VanillaCraftingRecipe {
@Override
public List<ItemStack> getOutput() {
List<ItemStack> output = new LinkedList<>();
- output.add(recipe.getRecipeOutput());
+ output.add(recipe.getOutput());
return output;
}
@@ -42,9 +42,9 @@ public class VanillaShapedCraftingRecipe extends VanillaCraftingRecipe {
public List<List<ItemStack>> getInput() {
List<List<ItemStack>> input = new LinkedList<>();
int count = 0;
- for(Ingredient ingredient : recipe.getIngredients()) {
+ for(Ingredient ingredient : recipe.getPreviewInputs()) {
List<ItemStack> ingList = new LinkedList<>();
- for(ItemStack matchingStack : ingredient.getMatchingStacks()) {
+ for(ItemStack matchingStack : ingredient.getStackArray()) {
ingList.add(matchingStack);
}
input.add(ingList);
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
index 034ac77b0..7b04e9901 100755
--- a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
+++ b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapelessCraftingRecipe.java
@@ -1,8 +1,8 @@
package me.shedaniel.plugin.crafting;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.Ingredient;
-import net.minecraft.item.crafting.ShapelessRecipe;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.crafting.ShapelessRecipe;
import java.util.LinkedList;
import java.util.List;
@@ -24,16 +24,16 @@ public class VanillaShapelessCraftingRecipe extends VanillaCraftingRecipe {
@Override
public List<ItemStack> getOutput() {
List<ItemStack> output = new LinkedList<>();
- output.add(recipe.getRecipeOutput());
+ output.add(recipe.getOutput());
return output;
}
@Override
public List<List<ItemStack>> getInput() {
List<List<ItemStack>> input = new LinkedList<>();
- for(Ingredient ingredient : recipe.getIngredients()) {
+ for(Ingredient ingredient : recipe.getPreviewInputs()) {
List<ItemStack> ingList = new LinkedList<>();
- for(ItemStack matchingStack : ingredient.getMatchingStacks()) {
+ for(ItemStack matchingStack : ingredient.getStackArray()) {
ingList.add(matchingStack);
}
input.add(ingList);
@@ -43,14 +43,14 @@ public class VanillaShapelessCraftingRecipe extends VanillaCraftingRecipe {
@Override
public int getWidth() {
- if (recipe.getIngredients().size() > 4)
+ if (recipe.getPreviewInputs().size() > 4)
return 3;
return 2;
}
@Override
public int getHeight() {
- if (recipe.getIngredients().size() > 4)
+ if (recipe.getPreviewInputs().size() > 4)
return 3;
return 2;
}
diff --git a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
index 1f38b6964..969ae4265 100755
--- a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
+++ b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
@@ -1,14 +1,14 @@
package me.shedaniel.plugin.furnace;
import me.shedaniel.api.IDisplayCategory;
-import me.shedaniel.gui.widget.REISlot;
import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
import me.shedaniel.gui.widget.WidgetArrow;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.init.Blocks;
+import net.minecraft.block.Blocks;
+import net.minecraft.block.entity.FurnaceBlockEntity;
+import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntityFurnace;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -25,7 +25,7 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
@Override
public String getDisplayName() {
- return I18n.format("category.rei.smelting");
+ return I18n.translate("category.rei.smelting");
}
@Override
@@ -54,7 +54,7 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
REISlot fuelSlot = new REISlot(80, 100 + number * 75);
fuelSlot.setStackList(getFuel());
fuelSlot.setDrawBackground(true);
- fuelSlot.setExtraTooltip(I18n.format("category.rei.smelting.fuel"));
+ fuelSlot.setExtraTooltip(I18n.translate("category.rei.smelting.fuel"));
slots.add(inputSlot);
slots.add(outputSlot);
@@ -79,11 +79,11 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
}
private List<ItemStack> getFuel() {
- return TileEntityFurnace.getBurnTimes().keySet().stream().map(Item::getDefaultInstance).collect(Collectors.toList());
+ return FurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
}
@Override
public ItemStack getCategoryIcon() {
- return new ItemStack(Blocks.FURNACE.asItem());
+ return new ItemStack(Blocks.FURNACE.getItem());
}
}
diff --git a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java
index a8c18d251..97c6b5460 100755
--- a/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java
+++ b/src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java
@@ -2,37 +2,37 @@ package me.shedaniel.plugin.furnace;
import me.shedaniel.api.IRecipe;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.FurnaceRecipe;
-import net.minecraft.item.crafting.Ingredient;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.smelting.SmeltingRecipe;
import java.util.LinkedList;
import java.util.List;
public class VanillaFurnaceRecipe implements IRecipe<ItemStack> {
- private final FurnaceRecipe recipe;
+ private final SmeltingRecipe recipe;
@Override
public String getId() {
return "furnace";
}
- public VanillaFurnaceRecipe(FurnaceRecipe recipe) {
+ public VanillaFurnaceRecipe(SmeltingRecipe recipe) {
this.recipe = recipe;
}
@Override
public List<ItemStack> getOutput() {
List<ItemStack> output = new LinkedList<>();
- output.add(recipe.getRecipeOutput().copy());
+ output.add(recipe.getOutput().copy());
return output;
}
@Override
public List<List<ItemStack>> getInput() {
List<List<ItemStack>> input = new LinkedList<>();
- for(Ingredient ingredient : recipe.getIngredients()) {
+ for(Ingredient ingredient : recipe.getPreviewInputs()) {
List<ItemStack> ingredients = new LinkedList<>();
- for(ItemStack matchingStack : ingredient.getMatchingStacks()) {
+ for(ItemStack matchingStack : ingredient.getStackArray()) {
ingredients.add(matchingStack);
}
input.add(ingredients);
diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java
index b9f3cf85e..d4fb6a917 100644
--- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java
+++ b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java
@@ -1,16 +1,16 @@
package me.shedaniel.plugin.potion;
+import com.mojang.blaze3d.platform.GlStateManager;
import me.shedaniel.api.IDisplayCategory;
import me.shedaniel.gui.REIRenderHelper;
import me.shedaniel.gui.widget.Control;
import me.shedaniel.gui.widget.REISlot;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
+import net.minecraft.block.Blocks;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.item.Items;
+import net.minecraft.util.Identifier;
import java.awt.*;
import java.util.ArrayList;
@@ -27,7 +27,7 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
@Override
public String getDisplayName() {
- return I18n.format("category.rei.brewing");
+ return I18n.translate("category.rei.brewing");
}
@Override
@@ -76,7 +76,7 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
}
- private static final ResourceLocation RECIPE_GUI = new ResourceLocation("textures/gui/container/brewing_stand.png");
+ private static final Identifier RECIPE_GUI = new Identifier("textures/gui/container/brewing_stand.png");
@Override
public void addWidget(List<Control> controls, int number) {
@@ -118,7 +118,7 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
@Override
public ItemStack getCategoryIcon() {
- return new ItemStack(Blocks.BREWING_STAND.asItem());
+ return new ItemStack(Blocks.BREWING_STAND.getItem());
}
private class PotionScreen extends Control {
@@ -131,7 +131,7 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
public void draw() {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
- Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
+ MinecraftClient.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
this.drawTexturedModalRect(rect.x, rect.y, 16, 15, 103, 60, 0);
this.drawTexturedModalRect(rect.x + 97 - 16, rect.y + 16 - 15, 176, 0, 9, (int) (((double) System.currentTimeMillis() % 2800d / 2800d) * 28), 0);
this.drawTexturedModalRect(rect.x + 45, rect.y, 110, 15, 15, 27, 0);
@@ -156,7 +156,7 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
if (getStack().isEmpty())
return;
if (drawMiniBackground) {
- Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
+ MinecraftClient.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
drawTexturedModalRect(rect.x + 1, rect.y + 1, 0 + 2, 222 + 2, rect.width - 4, rect.height - 4);
}
super.draw();
@@ -165,20 +165,20 @@ public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionReci
@Override
protected void drawTooltip() {
List<String> toolTip = getTooltip();
- toolTip.add(I18n.format("text.rei.mod", getMod()));
+ toolTip.add(I18n.translate("text.rei.mod", getMod()));
Point mouse = REIRenderHelper.getMouseLoc();
- Minecraft.getInstance().currentScreen.drawHoveringText(toolTip, mouse.x, mouse.y);
+ MinecraftClient.getInstance().currentGui.drawTooltip(toolTip, mouse.x, mouse.y);
}
}
public static String getTooltip(SlotType slotType) {
switch (slotType) {
case INPUT:
- return I18n.format("category.rei.brewing.input");
+ return I18n.translate("category.rei.brewing.input");
case REACT:
- return I18n.format("category.rei.brewing.reactant");
+ return I18n.translate("category.rei.brewing.reactant");
case OUTPUT:
- return I18n.format("category.rei.brewing.result");
+ return I18n.translate("category.rei.brewing.result");
}
return null;
}
diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
index 3f4592a90..e7343d449 100755
--- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
+++ b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
@@ -1,7 +1,7 @@
package me.shedaniel.plugin.potion;
import me.shedaniel.api.IRecipe;
-import net.minecraft.init.Blocks;
+import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
diff --git a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
new file mode 100755
index 000000000..6bbb896d1
--- /dev/null
+++ b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
@@ -0,0 +1,89 @@
+package me.shedaniel.plugin.smoker;
+
+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.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 VanillaSmokerCategory implements IDisplayCategory<VanillaSmokerRecipe> {
+ private List<VanillaSmokerRecipe> recipes;
+
+ @Override
+ public String getId() {
+ return "smoker";
+ }
+
+ @Override
+ public String getDisplayName() {
+ return I18n.translate("category.rei.smoking");
+ }
+
+ @Override
+ public void addRecipe(VanillaSmokerRecipe 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(VanillaSmokerRecipe 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 SmokerBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
+ }
+
+ @Override
+ public ItemStack getCategoryIcon() {
+ return new ItemStack(Blocks.SMOKER.getItem());
+ }
+}
diff --git a/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java
new file mode 100755
index 000000000..7a6d0fe95
--- /dev/null
+++ b/src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java
@@ -0,0 +1,43 @@
+package me.shedaniel.plugin.smoker;
+
+import me.shedaniel.api.IRecipe;
+import net.minecraft.item.ItemStack;
+import net.minecraft.recipe.Ingredient;
+import net.minecraft.recipe.smelting.SmeltingRecipe;
+import net.minecraft.recipe.smelting.SmokingRecipe;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class VanillaSmokerRecipe implements IRecipe<ItemStack> {
+ private final SmokingRecipe recipe;
+
+ @Override
+ public String getId() {
+ return "smoker";
+ }
+
+ public VanillaSmokerRecipe(SmokingRecipe 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;
+ }
+}