diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-09 23:35:45 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-09 23:35:45 +0800 |
| commit | 1b21d26487636e50d03979acd5ca4a2a07761a25 (patch) | |
| tree | d7d066b4e7491474f3a962593e97a2d6f0aa2ea2 /src/main/java/me/shedaniel/plugin/potion | |
| parent | 77af6b3f548d34bfdafc585847d3d80ec783c7e7 (diff) | |
| download | RoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.tar.gz RoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.tar.bz2 RoughlyEnoughItems-1b21d26487636e50d03979acd5ca4a2a07761a25.zip | |
Starting off rewrite
Diffstat (limited to 'src/main/java/me/shedaniel/plugin/potion')
| -rw-r--r-- | src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java | 189 | ||||
| -rwxr-xr-x | src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java | 56 |
2 files changed, 0 insertions, 245 deletions
diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java deleted file mode 100644 index d4fb6a917..000000000 --- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionCategory.java +++ /dev/null @@ -1,189 +0,0 @@ -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.block.Blocks; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.Identifier; - -import java.awt.*; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -public class VanillaPotionCategory implements IDisplayCategory<VanillaPotionRecipe> { - private List<VanillaPotionRecipe> recipes = new ArrayList<>(); - - @Override - public String getId() { - return "potion"; - } - - @Override - public String getDisplayName() { - return I18n.translate("category.rei.brewing"); - } - - @Override - public void addRecipe(VanillaPotionRecipe recipe) { - recipes.add(recipe); - } - - @Override - public void resetRecipes() { - recipes = new ArrayList<>(); - } - - @Override - public List<REISlot> setupDisplay(int number) { - List<REISlot> list = new LinkedList<>(); - REISlot blazePowderSlot = new REISlot(32, 62 + number * 75); - blazePowderSlot.setDrawBackground(false); - blazePowderSlot.setStack(new ItemStack(Items.BLAZE_POWDER)); - list.add(blazePowderSlot); - REISlot inputSlot = new REISlot(30 + 41, 62 + number * 75); - inputSlot.setDrawBackground(true); - inputSlot.setStackList(recipes.get(number).getInput().get(0)); - list.add(inputSlot); - REISlot reactWithSlot = new REISlot(30 + 64, 62 + number * 75); - reactWithSlot.setDrawBackground(false); - reactWithSlot.setStackList(recipes.get(number).getInput().get(1)); - list.add(reactWithSlot); - REISlot outputSlotOne = new REISlot(30 + 41, 62 + 34 + number * 75); - outputSlotOne.setDrawBackground(false); - outputSlotOne.setStackList(recipes.get(number).getOutput(0)); - list.add(outputSlotOne); - REISlot outputSlotTwo = new REISlot(30 + 64, 62 + 41 + number * 75); - outputSlotTwo.setDrawBackground(false); - outputSlotTwo.setStackList(recipes.get(number).getOutput(1)); - list.add(outputSlotTwo); - return new LinkedList<>(); - } - - @Override - public boolean canDisplay(VanillaPotionRecipe recipe) { - return false; - } - - @Override - public void drawExtras() { - - } - - private static final Identifier RECIPE_GUI = new Identifier("textures/gui/container/brewing_stand.png"); - - @Override - public void addWidget(List<Control> controls, int number) { - controls.add(new PotionScreen(30, 60 + number * 75)); - PotionSlot blazePowderSlot = new PotionSlot(32, 62 + number * 75); - blazePowderSlot.setDrawBackground(false); - blazePowderSlot.setExtraTooltip(getTooltip(SlotType.BLAZE_POWDER)); - blazePowderSlot.setStack(new ItemStack(Items.BLAZE_POWDER)); - controls.add(blazePowderSlot); - PotionSlot inputSlot = new PotionSlot(30 + 41, 62 + number * 75); - inputSlot.setDrawBackground(true); - inputSlot.setExtraTooltip(getTooltip(SlotType.INPUT)); - inputSlot.setStackList(recipes.get(number).getInput().get(0)); - controls.add(inputSlot); - PotionSlot reactWithSlot = new PotionSlot(30 + 63, 62 + number * 75); - reactWithSlot.setDrawBackground(false); - reactWithSlot.setExtraTooltip(getTooltip(SlotType.REACT)); - reactWithSlot.setStackList(recipes.get(number).getInput().get(1)); - controls.add(reactWithSlot); - PotionSlot outputSlotOne = new PotionSlot(30 + 40, 62 + 34 + number * 75); - outputSlotOne.setDrawBackground(false); - outputSlotOne.setExtraTooltip(getTooltip(SlotType.OUTPUT)); - outputSlotOne.setDrawMiniBackground(true); - outputSlotOne.setStackList(recipes.get(number).getOutput(0)); - controls.add(outputSlotOne); - PotionSlot outputSlotTwo = new PotionSlot(30 + 63, 62 + 41 + number * 75); - outputSlotTwo.setDrawBackground(false); - outputSlotTwo.setExtraTooltip(getTooltip(SlotType.OUTPUT)); - outputSlotTwo.setDrawMiniBackground(true); - outputSlotTwo.setStackList(recipes.get(number).getOutput(1)); - controls.add(outputSlotTwo); - PotionSlot outputSlotThree = new PotionSlot(30 + 86, 62 + 34 + number * 75); - outputSlotThree.setDrawBackground(false); - outputSlotThree.setExtraTooltip(getTooltip(SlotType.OUTPUT)); - outputSlotThree.setDrawMiniBackground(true); - outputSlotThree.setStackList(recipes.get(number).getOutput(2)); - controls.add(outputSlotThree); - } - - @Override - public ItemStack getCategoryIcon() { - return new ItemStack(Blocks.BREWING_STAND.getItem()); - } - - private class PotionScreen extends Control { - - public PotionScreen(int x, int y) { - super(x, y, 103, 60); - } - - @Override - public void draw() { - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - 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); - this.drawTexturedModalRect(rect.x + 44, rect.y + 29, 176, 29, (int) (((double) System.currentTimeMillis() % 2800d / 2800d) * 18), 4, 0); - } - } - - private class PotionSlot extends REISlot { - - protected boolean drawMiniBackground = false; - - public PotionSlot(int x, int y) { - super(x, y); - } - - public void setDrawMiniBackground(boolean drawMiniBackground) { - this.drawMiniBackground = drawMiniBackground; - } - - @Override - public void draw() { - if (getStack().isEmpty()) - return; - if (drawMiniBackground) { - 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(); - } - - @Override - protected void drawTooltip() { - List<String> toolTip = getTooltip(); - toolTip.add(I18n.translate("text.rei.mod", getMod())); - Point mouse = REIRenderHelper.getMouseLoc(); - MinecraftClient.getInstance().currentGui.drawTooltip(toolTip, mouse.x, mouse.y); - } - } - - public static String getTooltip(SlotType slotType) { - switch (slotType) { - case INPUT: - return I18n.translate("category.rei.brewing.input"); - case REACT: - return I18n.translate("category.rei.brewing.reactant"); - case OUTPUT: - return I18n.translate("category.rei.brewing.result"); - } - return null; - } - - public enum SlotType { - INPUT, REACT, OUTPUT, BLAZE_POWDER; - } -} diff --git a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java b/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java deleted file mode 100755 index eb482d8d3..000000000 --- a/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java +++ /dev/null @@ -1,56 +0,0 @@ -package me.shedaniel.plugin.potion; - -import me.shedaniel.api.IRecipe; -import net.minecraft.block.Blocks; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -public class VanillaPotionRecipe implements IRecipe<ItemStack> { - - private ItemStack[] input, reactWith, output; - - @Override - public String getId() { - return "potion"; - } - - public VanillaPotionRecipe(ItemStack[] input, ItemStack[] reactWith, ItemStack[] output) { - this.input = input; - this.reactWith = reactWith; - this.output = output; - } - - @Override - public List<ItemStack> getOutput() { - return Arrays.asList(output); - } - - @Override - public List<List<ItemStack>> getInput() { - List<List<ItemStack>> input = new LinkedList<>(); - input.add(new ArrayList<>(Arrays.asList(this.input))); - input.add(new ArrayList<>(Arrays.asList(this.reactWith))); - return input; - } - - @Override - public List<List<ItemStack>> getRecipeRequiredInput() { - List<List<ItemStack>> input = new LinkedList<>(); - input.add(new ArrayList<>(Arrays.asList(this.input))); - input.add(new ArrayList<>(Arrays.asList(this.reactWith))); - return input; - } - - public List<ItemStack> getOutput(int slot) { - List<ItemStack> stack = new ArrayList<>(); - for(int i = 0; i < slot * 2; i++) - stack.add(new ItemStack(Blocks.AIR)); - for(int i = 0; i < 6 - slot * 2; i++) - stack.addAll(getOutput()); - return stack; - } -} |
