diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-11 18:14:42 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-11 18:14:42 +0800 |
| commit | 39186205227594eecb9c29157c5eb5fd9b293f11 (patch) | |
| tree | e50f48a106d535c418b89ddfc67f2d1f3013be69 /src/main/java/me/shedaniel/rei/plugin | |
| parent | 77ff77003ff31dabda47388ca2d9727a185b90f8 (diff) | |
| download | RoughlyEnoughItems-39186205227594eecb9c29157c5eb5fd9b293f11.tar.gz RoughlyEnoughItems-39186205227594eecb9c29157c5eb5fd9b293f11.tar.bz2 RoughlyEnoughItems-39186205227594eecb9c29157c5eb5fd9b293f11.zip | |
Furnace Recipe + Scrolling in Recipe Window
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin')
3 files changed, 39 insertions, 5 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java b/src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java index 32299c466..ded3e3087 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java @@ -55,7 +55,7 @@ public class DefaultCraftingCategory implements IRecipeCategory<DefaultCraftingD List<ItemSlotWidget> slots = Lists.newArrayList(); for(int y = 0; y < 3; y++) for(int x = 0; x < 3; x++) - slots.add(new ItemSlotWidget(startPoint.x + 1 + x * 18, startPoint.y + 1 + y * 18, Lists.newArrayList(), true, true, containerGui)); + slots.add(new ItemSlotWidget(startPoint.x + 1 + x * 18, startPoint.y + 1 + y * 18, Lists.newArrayList(), true, true, containerGui, true)); for(int i = 0; i < input.size(); i++) { if (recipeDisplay instanceof DefaultShapedDisplay) { if (!input.get(i).isEmpty()) @@ -64,7 +64,7 @@ public class DefaultCraftingCategory implements IRecipeCategory<DefaultCraftingD slots.get(i).setItemList(input.get(i)); } widgets.addAll(slots); - widgets.add(new ItemSlotWidget(startPoint.x + 95, startPoint.y + 19, recipeDisplay.getOutput(), false, true, containerGui) { + widgets.add(new ItemSlotWidget(startPoint.x + 95, startPoint.y + 19, recipeDisplay.getOutput(), false, true, containerGui, true) { @Override protected String getItemCountOverlay(ItemStack currentStack) { if (currentStack.getAmount() == 1) diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java b/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java index 8388b9e00..3784a1f8b 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java @@ -1,13 +1,27 @@ package me.shedaniel.rei.plugin; +import com.mojang.blaze3d.platform.GlStateManager; import me.shedaniel.rei.api.IRecipeCategory; +import me.shedaniel.rei.gui.widget.IWidget; +import me.shedaniel.rei.gui.widget.ItemSlotWidget; +import me.shedaniel.rei.gui.widget.RecipeBaseWidget; +import me.shedaniel.rei.listeners.IMixinContainerGui; import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.GuiLighting; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import java.awt.*; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + public class DefaultSmeltingCategory implements IRecipeCategory<DefaultSmeltingDisplay> { + private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png"); + @Override public Identifier getIdentifier() { return DefaultPlugin.SMELTING; @@ -23,4 +37,23 @@ public class DefaultSmeltingCategory implements IRecipeCategory<DefaultSmeltingD return I18n.translate("category.rei.smelting"); } + @Override + public List<IWidget> setupDisplay(IMixinContainerGui containerGui, DefaultSmeltingDisplay recipeDisplay, Rectangle bounds) { + Point startPoint = new Point((int) bounds.getCenterX() - 41, (int) bounds.getCenterY() - 27); + List<IWidget> widgets = new LinkedList<>(Arrays.asList(new RecipeBaseWidget(bounds) { + @Override + public void draw(int mouseX, int mouseY, float partialTicks) { + super.draw(mouseX, mouseY, partialTicks); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiLighting.disable(); + MinecraftClient.getInstance().getTextureManager().bindTexture(DISPLAY_TEXTURE); + drawTexturedRect(startPoint.x, startPoint.y, 0, 54, 82, 54); + } + })); + List<List<ItemStack>> input = recipeDisplay.getInput(); + widgets.add(new ItemSlotWidget(startPoint.x + 1, startPoint.y + 1, input.get(0), true, true, containerGui, true)); + widgets.add(new ItemSlotWidget(startPoint.x + 1, startPoint.y + 37, recipeDisplay.getFuel(), true, true, containerGui, true)); + widgets.add(new ItemSlotWidget(startPoint.x + 61, startPoint.y + 19, recipeDisplay.getOutput(), false, true, containerGui, true)); + return widgets; + } } diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java index 417bed72f..2b12b7603 100644 --- a/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java @@ -18,16 +18,17 @@ public class DefaultSmeltingDisplay implements IRecipeDisplay<SmeltingRecipe> { private SmeltingRecipe display; private List<List<ItemStack>> input; - private List<ItemStack> fuel, output; + private List<ItemStack> output; public DefaultSmeltingDisplay(SmeltingRecipe recipe) { this.display = recipe; - this.fuel = Lists.newArrayList(); + List<ItemStack> fuel = Lists.newArrayList(); this.input = Lists.newArrayList(); fuel.addAll(FurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList())); recipe.getPreviewInputs().forEach(ingredient -> { input.add(Arrays.asList(ingredient.getStackArray())); }); + input.add(fuel); this.output = Arrays.asList(recipe.getOutput()); } @@ -42,7 +43,7 @@ public class DefaultSmeltingDisplay implements IRecipeDisplay<SmeltingRecipe> { } public List<ItemStack> getFuel() { - return fuel; + return input.get(1); } @Override |
