Continued work on **rei**
This commit is contained in:
parent
aa1b0d87bb
commit
49386dc7e1
7 changed files with 120 additions and 165 deletions
|
@ -27,7 +27,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||||
return AlloyingRecipe.ID;
|
return REIPlugin.ALLOYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,11 +76,6 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DisplayRenderer getDisplayRenderer(REIAlloyingDisplay recipe) {
|
|
||||||
return SimpleDisplayRenderer.from(recipe.getInputEntries(), recipe.getOutputEntries());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDisplayHeight() {
|
public int getDisplayHeight() {
|
||||||
return 49;
|
return 49;
|
||||||
|
|
|
@ -29,8 +29,6 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
|
||||||
private float xp;
|
private float xp;
|
||||||
private double smeltTime;
|
private double smeltTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public REIAlloyingDisplay(AlloyingRecipe recipe) {
|
public REIAlloyingDisplay(AlloyingRecipe recipe) {
|
||||||
super(
|
super(
|
||||||
EntryIngredients.ofIngredients(recipe.getIngredients()),
|
EntryIngredients.ofIngredients(recipe.getIngredients()),
|
||||||
|
@ -62,7 +60,7 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||||
return AlloyingRecipe.ID;
|
return REIPlugin.ALLOYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
|
|
@ -1,50 +1,48 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import me.shedaniel.math.Point;
|
import me.shedaniel.math.Point;
|
||||||
import me.shedaniel.math.Rectangle;
|
import me.shedaniel.math.Rectangle;
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||||
import me.shedaniel.rei.api.TransferRecipeCategory;
|
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||||
import me.shedaniel.rei.api.widgets.Widgets;
|
import me.shedaniel.rei.api.client.registry.display.TransferDisplayCategory;
|
||||||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
|
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||||
import me.shedaniel.rei.gui.widget.Widget;
|
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||||
import ru.betterend.util.LangUtil;
|
|
||||||
|
|
||||||
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ResourceLocation getIdentifier() {
|
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||||
return REIPlugin.SMITHING;
|
return REIPlugin.SMITHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getCategoryName() {
|
public @NotNull Component getTitle() {
|
||||||
return LangUtil.translate(Blocks.ANVIL.getDescriptionId());
|
return new TranslatableComponent(Blocks.ANVIL.getDescriptionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull EntryStack getLogo() {
|
public @NotNull EntryStack getIcon() {
|
||||||
return REIPlugin.ANVILS[0];
|
return REIPlugin.ANVILS[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
|
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
|
||||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
||||||
|
@ -53,23 +51,23 @@ public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay>
|
||||||
int x = startPoint.x + 10;
|
int x = startPoint.x + 10;
|
||||||
int y = startPoint.y;
|
int y = startPoint.y;
|
||||||
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
|
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
|
||||||
List<List<EntryStack>> inputEntries = display.getInputEntries();
|
List<EntryIngredient> inputEntries = display.getInputEntries();
|
||||||
List<EntryStack> materials = inputEntries.get(1);
|
EntryIngredient materials = inputEntries.get(1);
|
||||||
int anvilLevel = display.getAnvilLevel();
|
int anvilLevel = display.getAnvilLevel();
|
||||||
List<EntryStack> anvils = Arrays.stream(REIPlugin.ANVILS).filter(anvil -> {
|
Collection<EntryStack<?>> anvils = Arrays.stream(REIPlugin.ANVILS).filter(anvil -> {
|
||||||
Block block = ((BlockItem) anvil.getItem()).getBlock();
|
Block block = ((BlockItem) anvil.getValue()).getBlock();
|
||||||
if (block instanceof EndAnvilBlock) {
|
if (block instanceof EndAnvilBlock) {
|
||||||
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
|
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
|
||||||
}
|
}
|
||||||
return anvilLevel == 1;
|
return anvilLevel == 1;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
|
//materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
|
||||||
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
|
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
|
||||||
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
|
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
|
||||||
new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||||
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
|
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
|
||||||
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
|
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
|
||||||
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
|
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput());
|
||||||
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
|
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
|
||||||
|
|
||||||
return widgets;
|
return widgets;
|
||||||
|
@ -88,11 +86,6 @@ public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay>
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
|
|
||||||
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDisplayHeight() {
|
public int getDisplayHeight() {
|
||||||
return 60;
|
return 60;
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
import java.util.Collections;
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
import java.util.List;
|
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
|
||||||
import java.util.Optional;
|
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
|
||||||
|
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
|
||||||
import me.shedaniel.rei.api.TransferRecipeDisplay;
|
|
||||||
import me.shedaniel.rei.server.ContainerInfo;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.betterend.recipe.builders.AnvilRecipe;
|
import ru.betterend.recipe.builders.AnvilRecipe;
|
||||||
|
|
||||||
public class REIAnvilDisplay implements TransferRecipeDisplay {
|
import java.util.Collections;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
|
||||||
|
|
||||||
private final AnvilRecipe recipe;
|
private final AnvilRecipe recipe;
|
||||||
private final List<List<EntryStack>> input;
|
|
||||||
private final List<EntryStack> output;
|
|
||||||
|
|
||||||
public REIAnvilDisplay(AnvilRecipe recipe) {
|
public REIAnvilDisplay(AnvilRecipe recipe) {
|
||||||
|
super(
|
||||||
|
EntryIngredients.ofIngredients(recipe.getIngredients()),
|
||||||
|
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
|
||||||
|
);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
this.input = EntryStack.ofIngredients(recipe.getIngredients());
|
|
||||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDamage() {
|
public int getDamage() {
|
||||||
|
@ -39,29 +37,19 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Optional<ResourceLocation> getRecipeLocation() {
|
public @NotNull Optional<ResourceLocation> getDisplayLocation() {
|
||||||
return Optional.ofNullable(recipe).map(Recipe::getId);
|
return Optional.ofNullable(recipe).map(Recipe::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<List<EntryStack>> getInputEntries() {
|
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull List<List<EntryStack>> getResultingEntries() {
|
|
||||||
return Collections.singletonList(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull ResourceLocation getRecipeCategory() {
|
|
||||||
return REIPlugin.SMITHING;
|
return REIPlugin.SMITHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
// public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
||||||
return input;
|
// return input;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
|
@ -73,9 +61,9 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo,
|
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo,
|
||||||
AbstractContainerMenu container) {
|
// AbstractContainerMenu container) {
|
||||||
return input;
|
// return input;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,55 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import me.shedaniel.math.Point;
|
import me.shedaniel.math.Point;
|
||||||
import me.shedaniel.math.Rectangle;
|
import me.shedaniel.math.Rectangle;
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
|
||||||
import me.shedaniel.rei.api.TransferRecipeCategory;
|
import me.shedaniel.rei.api.client.gui.SimpleDisplayRenderer;
|
||||||
import me.shedaniel.rei.api.widgets.Widgets;
|
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||||
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
|
import me.shedaniel.rei.api.client.registry.display.TransferDisplayCategory;
|
||||||
import me.shedaniel.rei.gui.widget.Widget;
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
|
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||||
|
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.LangUtil;
|
|
||||||
|
|
||||||
public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDisplay> {
|
import java.util.List;
|
||||||
|
|
||||||
|
public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionDisplay> {
|
||||||
|
|
||||||
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
|
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ResourceLocation getIdentifier() {
|
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||||
return InfusionRecipe.ID;
|
return REIPlugin.INFUSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getCategoryName() {
|
public @NotNull Component getTitle() {
|
||||||
return LangUtil.translate(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
|
return new TranslatableComponent(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull EntryStack getLogo() {
|
public @NotNull EntryStack getIcon() {
|
||||||
return REIPlugin.INFUSION_RITUAL;
|
return REIPlugin.INFUSION_RITUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull RecipeEntry getSimpleRenderer(REIInfusionDisplay recipe) {
|
|
||||||
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
|
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
|
||||||
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
|
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
|
||||||
List<Widget> widgets = Lists.newArrayList();
|
List<Widget> widgets = Lists.newArrayList();
|
||||||
widgets.add(Widgets.createRecipeBase(bounds));
|
widgets.add(Widgets.createRecipeBase(bounds));
|
||||||
List<List<EntryStack>> inputEntries = display.getInputEntries();
|
List<EntryIngredient> inputEntries = display.getInputEntries();
|
||||||
List<List<EntryStack>> outputEntries = display.getResultingEntries();
|
List<EntryIngredient> outputEntries = display.getOutputEntries();
|
||||||
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
|
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
|
||||||
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
|
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
|
||||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
|
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
|
||||||
|
@ -70,12 +66,13 @@ public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDi
|
||||||
return widgets;
|
return widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds,
|
|
||||||
REIInfusionDisplay display, IntList redSlots) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDisplayHeight() {
|
public int getDisplayHeight() {
|
||||||
return 104;
|
return 104;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIInfusionDisplay display, IntList redSlots) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,29 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
import java.util.Collections;
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
import java.util.List;
|
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
|
||||||
import java.util.Optional;
|
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
|
||||||
|
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
|
||||||
import me.shedaniel.rei.api.TransferRecipeDisplay;
|
|
||||||
import me.shedaniel.rei.server.ContainerInfo;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||||
|
|
||||||
public class REIInfusionDisplay implements TransferRecipeDisplay {
|
import java.util.Collections;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
|
||||||
|
|
||||||
private final InfusionRecipe recipe;
|
private final InfusionRecipe recipe;
|
||||||
private final List<List<EntryStack>> input;
|
|
||||||
private final List<EntryStack> output;
|
|
||||||
private final int time;
|
private final int time;
|
||||||
|
|
||||||
public REIInfusionDisplay(InfusionRecipe recipe) {
|
public REIInfusionDisplay(InfusionRecipe recipe) {
|
||||||
|
super(
|
||||||
|
EntryIngredients.ofIngredients(recipe.getIngredients()),
|
||||||
|
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
|
||||||
|
);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
this.input = Lists.newArrayList();
|
|
||||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
|
||||||
this.time = recipe.getInfusionTime();
|
this.time = recipe.getInfusionTime();
|
||||||
|
|
||||||
recipe.getIngredients().forEach(ingredient -> {
|
|
||||||
input.add(EntryStack.ofIngredient(ingredient));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInfusionTime() {
|
public int getInfusionTime() {
|
||||||
|
@ -40,29 +31,19 @@ public class REIInfusionDisplay implements TransferRecipeDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Optional<ResourceLocation> getRecipeLocation() {
|
public @NotNull Optional<ResourceLocation> getDisplayLocation() {
|
||||||
return Optional.ofNullable(recipe).map(Recipe::getId);
|
return Optional.ofNullable(recipe).map(Recipe::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<List<EntryStack>> getInputEntries() {
|
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||||
return this.input;
|
return REIPlugin.INFUSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public @NotNull List<List<EntryStack>> getResultingEntries() {
|
// public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
||||||
return Collections.singletonList(output);
|
// return this.input;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull ResourceLocation getRecipeCategory() {
|
|
||||||
return AlloyingRecipe.ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
|
||||||
return this.input;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
|
@ -74,8 +55,8 @@ public class REIInfusionDisplay implements TransferRecipeDisplay {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
|
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
|
||||||
return this.input;
|
// return this.input;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
package ru.betterend.integration.rei;
|
package ru.betterend.integration.rei;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import me.shedaniel.rei.api.EntryStack;
|
|
||||||
import me.shedaniel.rei.api.RecipeHelper;
|
import me.shedaniel.rei.api.RecipeHelper;
|
||||||
import me.shedaniel.rei.api.plugins.REIPluginV0;
|
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
||||||
|
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
||||||
|
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||||
|
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||||
import me.shedaniel.rei.plugin.DefaultPlugin;
|
import me.shedaniel.rei.plugin.DefaultPlugin;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -23,14 +21,18 @@ import ru.betterend.recipe.builders.AnvilRecipe;
|
||||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class REIPlugin implements REIPluginV0 {
|
public class REIPlugin implements REIClientPlugin {
|
||||||
|
|
||||||
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
||||||
public final static ResourceLocation ALLOYING_FUEL = BetterEnd.makeID("alloying_fuel");
|
public final static CategoryIdentifier ALLOYING_FUEL = CategoryIdentifier.of(BetterEnd.MOD_ID, "alloying_fuel");
|
||||||
public final static ResourceLocation ALLOYING = AlloyingRecipe.ID;
|
public final static CategoryIdentifier ALLOYING = AlloyingRecipe.ID;
|
||||||
public final static ResourceLocation SMITHING = AnvilRecipe.ID;
|
public final static CategoryIdentifier SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
|
||||||
public final static ResourceLocation INFUSION = InfusionRecipe.ID;
|
public final static CategoryIdentifier INFUSION = InfusionRecipe.ID;
|
||||||
|
|
||||||
public final static EntryStack END_STONE_SMELTER = EntryStack.create(EndBlocks.END_STONE_SMELTER);
|
public final static EntryStack END_STONE_SMELTER = EntryStack.create(EndBlocks.END_STONE_SMELTER);
|
||||||
public final static EntryStack INFUSION_RITUAL = EntryStack.create(EndBlocks.INFUSION_PEDESTAL);
|
public final static EntryStack INFUSION_RITUAL = EntryStack.create(EndBlocks.INFUSION_PEDESTAL);
|
||||||
|
@ -69,12 +71,13 @@ public class REIPlugin implements REIPluginV0 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPluginCategories(RecipeHelper recipeHelper) {
|
public void registerCategories(CategoryRegistry registry) {
|
||||||
recipeHelper.registerCategories(
|
registry.add(
|
||||||
new REIAlloyingFuelCategory(),
|
new REIAlloyingFuelCategory(),
|
||||||
new REIAlloyingCategory(),
|
new REIAlloyingCategory(),
|
||||||
new REIInfusionCategory(),
|
new REIInfusionCategory(),
|
||||||
new REIAnvilCategory());
|
new REIAnvilCategory()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue