Buckets & entity enhancements, cleanup

This commit is contained in:
paulevsGitch 2021-04-19 21:22:11 +03:00
parent 00fd2b6199
commit 3ec2edd6d5
234 changed files with 1988 additions and 1643 deletions

View file

@ -1,88 +1,89 @@
package ru.betterend.integration.rei;
import java.text.DecimalFormat;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.LangUtil;
public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDisplay> {
@Override
public @NotNull ResourceLocation getIdentifier() {
return AlloyingRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(EndBlocks.END_STONE_SMELTER.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.END_STONE_SMELTER;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<List<EntryStack>> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
} else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
}
matrices.popPose();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingDisplay recipe) {
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}
package ru.betterend.integration.rei;
import java.text.DecimalFormat;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.LangUtil;
public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDisplay> {
@Override
public @NotNull ResourceLocation getIdentifier() {
return AlloyingRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(EndBlocks.END_STONE_SMELTER.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.END_STONE_SMELTER;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<List<EntryStack>> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
} else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
}
matrices.popPose();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingDisplay recipe) {
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 49;
}
}

View file

@ -1,91 +1,92 @@
package ru.betterend.integration.rei;
import java.text.DecimalFormat;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.widgets.Slot;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDisplay> {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
@Override
public @NotNull ResourceLocation getIdentifier() {
return REIPlugin.ALLOYING_FUEL;
}
@Override
public @NotNull String getCategoryName() {
return I18n.get("category.rei.fuel");
}
@Override
public int getDisplayHeight() {
return 49;
}
@Override
public @NotNull EntryStack getLogo() {
return EntryStack.create(Items.COAL);
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime))
.color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
return widgets;
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
return new RecipeEntry() {
private TranslatableComponent text = new TranslatableComponent("category.rei.fuel.time_short.items", burnItems);
@Override
public int getHeight() {
return 22;
}
@Nullable
@Override
public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point))
return slot.getCurrentTooltip(point);
return null;
}
@Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta);
Minecraft.getInstance().font.drawShadow(matrices, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1);
}
};
}
}
package ru.betterend.integration.rei;
import java.text.DecimalFormat;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.widgets.Slot;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDisplay> {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
@Override
public @NotNull ResourceLocation getIdentifier() {
return REIPlugin.ALLOYING_FUEL;
}
@Override
public @NotNull String getCategoryName() {
return I18n.get("category.rei.fuel");
}
@Override
public int getDisplayHeight() {
return 49;
}
@Override
public @NotNull EntryStack getLogo() {
return EntryStack.create(Items.COAL);
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime))
.color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
return widgets;
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
return new RecipeEntry() {
private TranslatableComponent text = new TranslatableComponent("category.rei.fuel.time_short.items", burnItems);
@Override
public int getHeight() {
return 22;
}
@Nullable
@Override
public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point))
return slot.getCurrentTooltip(point);
return null;
}
@Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta);
Minecraft.getInstance().font.drawShadow(matrices, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1);
}
};
}
}

View file

@ -1,100 +1,101 @@
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.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import ru.betterend.blocks.basis.EndAnvilBlock;
import ru.betterend.util.LangUtil;
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
@Override
public @NotNull ResourceLocation getIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(Blocks.ANVIL.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.ANVILS[0];
}
@Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10;
int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
List<List<EntryStack>> inputEntries = display.getInputEntries();
List<EntryStack> materials = inputEntries.get(1);
int anvilLevel = display.getAnvilLevel();
List<EntryStack> anvils = Arrays.stream(REIPlugin.ANVILS).filter(anvil -> {
Block block = ((BlockItem) anvil.getItem()).getBlock();
if (block instanceof EndAnvilBlock) {
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
}
return anvilLevel == 1;
}).collect(Collectors.toList());
materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
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),
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 + 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 - 9, y + 25)).entries(anvils));
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
}
matrices.popPose();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 60;
}
}
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.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import ru.betterend.blocks.basis.EndAnvilBlock;
import ru.betterend.util.LangUtil;
public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay> {
@Override
public @NotNull ResourceLocation getIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(Blocks.ANVIL.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.ANVILS[0];
}
@Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10;
int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
List<List<EntryStack>> inputEntries = display.getInputEntries();
List<EntryStack> materials = inputEntries.get(1);
int anvilLevel = display.getAnvilLevel();
List<EntryStack> anvils = Arrays.stream(REIPlugin.ANVILS).filter(anvil -> {
Block block = ((BlockItem) anvil.getItem()).getBlock();
if (block instanceof EndAnvilBlock) {
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
}
return anvilLevel == 1;
}).collect(Collectors.toList());
materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
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),
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 + 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 - 9, y + 25)).entries(anvils));
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
}
matrices.popPose();
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
}
@Override
public int getDisplayHeight() {
return 60;
}
}

View file

@ -1,80 +1,81 @@
package ru.betterend.integration.rei;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.builders.InfusionRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.LangUtil;
public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDisplay> {
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
@Override
public @NotNull ResourceLocation getIdentifier() {
return InfusionRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.INFUSION_RITUAL;
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIInfusionDisplay recipe) {
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
}
@Override
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
List<List<EntryStack>> inputEntries = display.getInputEntries();
List<List<EntryStack>> outputEntries = display.getResultingEntries();
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(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)).entries(inputEntries.get(3)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)).entries(inputEntries.get(5)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)).entries(inputEntries.get(7)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)).entries(inputEntries.get(2)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)).entries(inputEntries.get(4)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime()))
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds,
REIInfusionDisplay display, IntList redSlots) {}
@Override
public int getDisplayHeight() {
return 104;
}
}
package ru.betterend.integration.rei;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.TransferRecipeCategory;
import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.BetterEnd;
import ru.betterend.recipe.builders.InfusionRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.LangUtil;
public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDisplay> {
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
@Override
public @NotNull ResourceLocation getIdentifier() {
return InfusionRecipe.ID;
}
@Override
public @NotNull String getCategoryName() {
return LangUtil.translate(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
}
@Override
public @NotNull EntryStack getLogo() {
return REIPlugin.INFUSION_RITUAL;
}
@Override
public @NotNull RecipeEntry getSimpleRenderer(REIInfusionDisplay recipe) {
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
}
@Override
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
List<List<EntryStack>> inputEntries = display.getInputEntries();
List<List<EntryStack>> outputEntries = display.getResultingEntries();
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(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)).entries(inputEntries.get(3)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)).entries(inputEntries.get(5)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)).entries(inputEntries.get(7)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)).entries(inputEntries.get(2)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)).entries(inputEntries.get(4)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime()))
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds,
REIInfusionDisplay display, IntList redSlots) {}
@Override
public int getDisplayHeight() {
return 104;
}
}