Disabled emi, rei and trinkets for now

This commit is contained in:
Frank 2023-05-24 19:07:12 +02:00
parent 295f9926bd
commit 1ac25673a8
17 changed files with 1156 additions and 1157 deletions

View file

@ -92,14 +92,13 @@ dependencies {
} else { } else {
modImplementation "com.github.quiqueck:BCLib:${project.bclib_version}" modImplementation "com.github.quiqueck:BCLib:${project.bclib_version}"
} }
modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" // modCompileOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}" // modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
//needed for trinkets, otherwise BetterEnd would require users to install trinkets //needed for trinkets, otherwise BetterEnd would require users to install trinkets
modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" // modApi "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}"
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" // modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
modCompileOnly "dev.emi:emi:${emi_version}" // modCompileOnly "dev.emi:emi:${emi_version}"
//modRuntimeOnly "dev.emi:emi:${emi_version}"
if (local_wunderlib) { if (local_wunderlib) {
println "Using local WunderLib" println "Using local WunderLib"

View file

@ -1,40 +1,40 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
import org.betterx.bclib.integration.emi.EMIAbstractAlloyingRecipe; //import org.betterx.bclib.integration.emi.EMIAbstractAlloyingRecipe;
import org.betterx.bclib.integration.emi.EMIPlugin; //import org.betterx.bclib.integration.emi.EMIPlugin;
import org.betterx.betterend.BetterEnd; //import org.betterx.betterend.BetterEnd;
//
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.Container; //import net.minecraft.world.Container;
import net.minecraft.world.item.crafting.BlastingRecipe; //import net.minecraft.world.item.crafting.BlastingRecipe;
import net.minecraft.world.item.crafting.RecipeManager; //import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.world.item.crafting.RecipeType; //import net.minecraft.world.item.crafting.RecipeType;
//
import dev.emi.emi.api.EmiRegistry; //import dev.emi.emi.api.EmiRegistry;
//
public class EMIBlastingRecipe extends EMIAbstractAlloyingRecipe<Container, BlastingRecipe> { //public class EMIBlastingRecipe extends EMIAbstractAlloyingRecipe<Container, BlastingRecipe> {
public EMIBlastingRecipe(BlastingRecipe recipe) { // public EMIBlastingRecipe(BlastingRecipe recipe) {
super(recipe, new ResourceLocation( // super(recipe, new ResourceLocation(
"emi", // "emi",
recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/allloying" // recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/allloying"
), 1, false); // ), 1, false);
} // }
//
@Override // @Override
protected int getSmeltTime() { // protected int getSmeltTime() {
return recipe.getCookingTime(); // return recipe.getCookingTime();
} // }
//
@Override // @Override
protected float getExperience() { // protected float getExperience() {
return recipe.getExperience(); // return recipe.getExperience();
} // }
//
//
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) { // static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
EMIPlugin.addAllRecipes( // EMIPlugin.addAllRecipes(
emiRegistry, manager, BetterEnd.LOGGER, // emiRegistry, manager, BetterEnd.LOGGER,
RecipeType.BLASTING, EMIBlastingRecipe::new // RecipeType.BLASTING, EMIBlastingRecipe::new
); // );
} // }
} //}

View file

@ -1,131 +1,131 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
import org.betterx.betterend.BetterEnd; //import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.recipe.builders.InfusionRecipe; //import org.betterx.betterend.recipe.builders.InfusionRecipe;
import org.betterx.ui.ColorUtil; //import org.betterx.ui.ColorUtil;
//
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; //import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence; //import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.item.crafting.RecipeManager; //import net.minecraft.world.item.crafting.RecipeManager;
//
import dev.emi.emi.api.EmiRegistry; //import dev.emi.emi.api.EmiRegistry;
import dev.emi.emi.api.recipe.EmiRecipe; //import dev.emi.emi.api.recipe.EmiRecipe;
import dev.emi.emi.api.recipe.EmiRecipeCategory; //import dev.emi.emi.api.recipe.EmiRecipeCategory;
import dev.emi.emi.api.render.EmiTexture; //import dev.emi.emi.api.render.EmiTexture;
import dev.emi.emi.api.stack.EmiIngredient; //import dev.emi.emi.api.stack.EmiIngredient;
import dev.emi.emi.api.stack.EmiStack; //import dev.emi.emi.api.stack.EmiStack;
import dev.emi.emi.api.widget.WidgetHolder; //import dev.emi.emi.api.widget.WidgetHolder;
//
import java.util.List; //import java.util.List;
import org.jetbrains.annotations.Nullable; //import org.jetbrains.annotations.Nullable;
//
public class EMIInfusionRecipe implements EmiRecipe { //public class EMIInfusionRecipe implements EmiRecipe {
public final static EmiTexture BACKGROUND = new EmiTexture( // public final static EmiTexture BACKGROUND = new EmiTexture(
BetterEnd.makeID("textures/gui/infusion.png"), // BetterEnd.makeID("textures/gui/infusion.png"),
0, 0, // 0, 0,
84, 84, 84, 84, 84, 84 // 84, 84, 84, 84, 84, 84
); // );
//
public final Component[] ORIENTATIONS = { // public final Component[] ORIENTATIONS = {
Component.translatable("betterend.infusion.north").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.north").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.north_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.north_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.south_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.south_east").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.south").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.south").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.south_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.south_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
Component.translatable("betterend.infusion.north_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)), // Component.translatable("betterend.infusion.north_west").setStyle(Style.EMPTY.withColor(ColorUtil.GRAY)),
}; // };
private final ResourceLocation id; // private final ResourceLocation id;
private final List<EmiIngredient> input; // private final List<EmiIngredient> input;
private final List<EmiStack> output; // private final List<EmiStack> output;
//
public EMIInfusionRecipe(InfusionRecipe recipe) { // public EMIInfusionRecipe(InfusionRecipe recipe) {
this.id = recipe.getId(); // this.id = recipe.getId();
this.input = recipe.getIngredients().stream().map(i -> EmiIngredient.of(i)).toList(); // this.input = recipe.getIngredients().stream().map(i -> EmiIngredient.of(i)).toList();
this.output = List.of(EmiStack.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()))); // this.output = List.of(EmiStack.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())));
} // }
//
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) { // static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
org.betterx.bclib.integration.emi.EMIPlugin.addAllRecipes( // org.betterx.bclib.integration.emi.EMIPlugin.addAllRecipes(
emiRegistry, manager, BetterEnd.LOGGER, // emiRegistry, manager, BetterEnd.LOGGER,
InfusionRecipe.TYPE, EMIInfusionRecipe::new // InfusionRecipe.TYPE, EMIInfusionRecipe::new
); // );
} // }
//
//
@Override // @Override
public EmiRecipeCategory getCategory() { // public EmiRecipeCategory getCategory() {
return EMIPlugin.INFUSION_CATEGORY; // return EMIPlugin.INFUSION_CATEGORY;
} // }
//
@Override // @Override
public @Nullable ResourceLocation getId() { // public @Nullable ResourceLocation getId() {
return id; // return id;
} // }
//
@Override // @Override
public List<EmiIngredient> getInputs() { // public List<EmiIngredient> getInputs() {
return input; // return input;
} // }
//
@Override // @Override
public List<EmiStack> getOutputs() { // public List<EmiStack> getOutputs() {
return output; // return output;
} // }
//
@Override // @Override
public int getDisplayWidth() { // public int getDisplayWidth() {
return 4 + 10 + 84 + 68; // return 4 + 10 + 84 + 68;
} // }
//
@Override // @Override
public int getDisplayHeight() { // public int getDisplayHeight() {
return 4 + 20 + 84; // return 4 + 20 + 84;
} // }
//
@Override // @Override
public void addWidgets(WidgetHolder widgets) { // public void addWidgets(WidgetHolder widgets) {
final int radius = 36; // final int radius = 36;
final int halfSize = 9; // final int halfSize = 9;
final int left = 10; // final int left = 10;
final int top = 17; // final int top = 17;
//
final int cx = left + 84 / 2; // final int cx = left + 84 / 2;
final int cy = top + 84 / 2; // final int cy = top + 84 / 2;
//
final int right = left + 84; // final int right = left + 84;
final int bottom = top + 84; // final int bottom = top + 84;
widgets.addTexture(BACKGROUND, left, top); // widgets.addTexture(BACKGROUND, left, top);
// Add an arrow texture to indicate processing // // Add an arrow texture to indicate processing
widgets.addTexture(EmiTexture.EMPTY_ARROW, right + 10, cy - 8); // widgets.addTexture(EmiTexture.EMPTY_ARROW, right + 10, cy - 8);
//
// Adds an input slot on the left // // Adds an input slot on the left
widgets.add(new TransparentSlotWidget(input.get(0), cx - halfSize, cy - halfSize)); // widgets.add(new TransparentSlotWidget(input.get(0), cx - halfSize, cy - halfSize));
//
FormattedCharSequence str = FormattedCharSequence.forward("N", Style.EMPTY); // FormattedCharSequence str = FormattedCharSequence.forward("N", Style.EMPTY);
widgets.addText(str, cx - Minecraft.getInstance().font.width(str) / 2, 4, ColorUtil.WHITE, true); // widgets.addText(str, cx - Minecraft.getInstance().font.width(str) / 2, 4, ColorUtil.WHITE, true);
double a = Math.PI; // double a = Math.PI;
for (int i = 1; i < input.size(); i++) { // for (int i = 1; i < input.size(); i++) {
widgets.add(new TransparentSlotWidget( // widgets.add(new TransparentSlotWidget(
input.get(i), // input.get(i),
cx - halfSize + (int) (Math.sin(a) * radius), // cx - halfSize + (int) (Math.sin(a) * radius),
cy - halfSize + (int) (Math.cos(a) * radius) // cy - halfSize + (int) (Math.cos(a) * radius)
)).appendTooltip(ORIENTATIONS[i - 1]); // )).appendTooltip(ORIENTATIONS[i - 1]);
a -= Math.PI / 4; // a -= Math.PI / 4;
} // }
//
// Adds an output slot on the right // // Adds an output slot on the right
// Note that output slots need to call `recipeContext` to inform EMI about their recipe context // // Note that output slots need to call `recipeContext` to inform EMI about their recipe context
// This includes being able to resolve recipe trees, favorite stacks with recipe context, and more // // This includes being able to resolve recipe trees, favorite stacks with recipe context, and more
widgets.addSlot(output.get(0), right + 40, cy - (halfSize + 4)).output(true).recipeContext(this); // widgets.addSlot(output.get(0), right + 40, cy - (halfSize + 4)).output(true).recipeContext(this);
} // }
//
@Override // @Override
public boolean supportsRecipeTree() { // public boolean supportsRecipeTree() {
return true; // return true;
} // }
} //}

View file

@ -1,40 +1,40 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
import org.betterx.betterend.BetterEnd; //import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.registry.EndBlocks; //import org.betterx.betterend.registry.EndBlocks;
//
import net.minecraft.world.item.crafting.RecipeManager; //import net.minecraft.world.item.crafting.RecipeManager;
//
import dev.emi.emi.api.EmiRegistry; //import dev.emi.emi.api.EmiRegistry;
import dev.emi.emi.api.recipe.EmiRecipeCategory; //import dev.emi.emi.api.recipe.EmiRecipeCategory;
import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories; //import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories;
import dev.emi.emi.api.stack.EmiStack; //import dev.emi.emi.api.stack.EmiStack;
//
public class EMIPlugin implements dev.emi.emi.api.EmiPlugin { //public class EMIPlugin implements dev.emi.emi.api.EmiPlugin {
public static final EmiStack INFUSION_WORKSTATION = EmiStack.of(EndBlocks.INFUSION_PEDESTAL); // public static final EmiStack INFUSION_WORKSTATION = EmiStack.of(EndBlocks.INFUSION_PEDESTAL);
public static final EmiStack AZURE_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.AZURE_JADESTONE.furnace); // public static final EmiStack AZURE_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.AZURE_JADESTONE.furnace);
public static final EmiStack SANDY_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.SANDY_JADESTONE.furnace); // public static final EmiStack SANDY_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.SANDY_JADESTONE.furnace);
public static final EmiStack VIRID_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.VIRID_JADESTONE.furnace); // public static final EmiStack VIRID_JADESTONE_FURNACE_WORKSTATION = EmiStack.of(EndBlocks.VIRID_JADESTONE.furnace);
//
public static final EmiRecipeCategory INFUSION_CATEGORY = new EmiRecipeCategory( // public static final EmiRecipeCategory INFUSION_CATEGORY = new EmiRecipeCategory(
BetterEnd.makeID("infusion"), // BetterEnd.makeID("infusion"),
INFUSION_WORKSTATION, // INFUSION_WORKSTATION,
org.betterx.bclib.integration.emi.EMIPlugin.getSprite(0, 16) // org.betterx.bclib.integration.emi.EMIPlugin.getSprite(0, 16)
); // );
//
@Override // @Override
public void register(EmiRegistry emiRegistry) { // public void register(EmiRegistry emiRegistry) {
final RecipeManager manager = emiRegistry.getRecipeManager(); // final RecipeManager manager = emiRegistry.getRecipeManager();
emiRegistry.addCategory(INFUSION_CATEGORY); // emiRegistry.addCategory(INFUSION_CATEGORY);
emiRegistry.addWorkstation(INFUSION_CATEGORY, INFUSION_WORKSTATION); // emiRegistry.addWorkstation(INFUSION_CATEGORY, INFUSION_WORKSTATION);
//
EMIInfusionRecipe.addAllRecipes(emiRegistry, manager); // EMIInfusionRecipe.addAllRecipes(emiRegistry, manager);
if (org.betterx.bclib.integration.emi.EMIPlugin.END_ALLOYING_CATEGORY != null) { // if (org.betterx.bclib.integration.emi.EMIPlugin.END_ALLOYING_CATEGORY != null) {
EMIBlastingRecipe.addAllRecipes(emiRegistry, manager); // EMIBlastingRecipe.addAllRecipes(emiRegistry, manager);
} // }
//
emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, AZURE_JADESTONE_FURNACE_WORKSTATION); // emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, AZURE_JADESTONE_FURNACE_WORKSTATION);
emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, SANDY_JADESTONE_FURNACE_WORKSTATION); // emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, SANDY_JADESTONE_FURNACE_WORKSTATION);
emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, VIRID_JADESTONE_FURNACE_WORKSTATION); // emiRegistry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, VIRID_JADESTONE_FURNACE_WORKSTATION);
} // }
} //}

View file

@ -1,91 +1,91 @@
package org.betterx.betterend.integration.emi; package org.betterx.betterend.integration.emi;
import de.ambertation.wunderlib.ui.layout.components.render.RenderHelper; //import de.ambertation.wunderlib.ui.layout.components.render.RenderHelper;
//
import com.mojang.blaze3d.systems.RenderSystem; //import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack; //import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiComponent; //import net.minecraft.client.gui.GuiComponent;
//
import dev.emi.emi.EmiPort; //import dev.emi.emi.EmiPort;
import dev.emi.emi.EmiRenderHelper; //import dev.emi.emi.EmiRenderHelper;
import dev.emi.emi.api.render.EmiRender; //import dev.emi.emi.api.render.EmiRender;
import dev.emi.emi.api.stack.EmiIngredient; //import dev.emi.emi.api.stack.EmiIngredient;
import dev.emi.emi.api.widget.Bounds; //import dev.emi.emi.api.widget.Bounds;
import dev.emi.emi.api.widget.SlotWidget; //import dev.emi.emi.api.widget.SlotWidget;
import dev.emi.emi.config.EmiConfig; //import dev.emi.emi.config.EmiConfig;
//
public class TransparentSlotWidget extends SlotWidget { //public class TransparentSlotWidget extends SlotWidget {
//
public TransparentSlotWidget(EmiIngredient stack, int x, int y) { // public TransparentSlotWidget(EmiIngredient stack, int x, int y) {
super(stack, x, y); // super(stack, x, y);
} // }
//
//
@Override // @Override
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { // public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
Bounds bounds = this.getBounds(); // Bounds bounds = this.getBounds();
EmiPort.setPositionTexShader(); // EmiPort.setPositionTexShader();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); // RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
int width = bounds.width(); // int width = bounds.width();
int height = bounds.height(); // int height = bounds.height();
if (this.drawBack) { // if (this.drawBack) {
if (this.textureId != null) { // if (this.textureId != null) {
RenderSystem.setShaderTexture(0, this.textureId); // RenderSystem.setShaderTexture(0, this.textureId);
GuiComponent.blit( // GuiComponent.blit(
matrices, // matrices,
bounds.x(), bounds.y(), width, height, // bounds.x(), bounds.y(), width, height,
this.u, this.v, width, height, 256, 256 // this.u, this.v, width, height, 256, 256
); // );
} else { // } else {
renderSlot(matrices); // renderSlot(matrices);
} // }
} // }
//
// if (this.getRecipe() == null //// if (this.getRecipe() == null
// && EmiClient.availableForCrafting.containsKey(this.getStack()) //// && EmiClient.availableForCrafting.containsKey(this.getStack())
// && !this.getStack().isEmpty() //// && !this.getStack().isEmpty()
// && !(Boolean) EmiClient.availableForCrafting.get(this.getStack())) { //// && !(Boolean) EmiClient.availableForCrafting.get(this.getStack())) {
// GuiComponent.fill( //// GuiComponent.fill(
//// matrices,
//// bounds.x(), bounds.y(),
//// bounds.x() + bounds.width(), bounds.y() + bounds.height(),
//// 0x44FF0000
//// );
//// }
//
// int xOff = (width - 16) / 2;
// int yOff = (height - 16) / 2;
// this.getStack().render(matrices, bounds.x() + xOff, bounds.y() + yOff, delta);
// if (this.catalyst) {
// EmiRender.renderCatalystIcon(this.getStack(), matrices, this.x + xOff, this.y + yOff);
// }
//
// if (EmiConfig.showHoverOverlay && bounds.contains(mouseX, mouseY)) {
// EmiRenderHelper.drawSlotHightlight(
// matrices, // matrices,
// bounds.x(), bounds.y(), // bounds.x() + 1, bounds.y() + 1,
// bounds.x() + bounds.width(), bounds.y() + bounds.height(), // bounds.width() - 2, bounds.height() - 2
// 0x44FF0000
// ); // );
// } // }
//
int xOff = (width - 16) / 2; // }
int yOff = (height - 16) / 2; //
this.getStack().render(matrices, bounds.x() + xOff, bounds.y() + yOff, delta); // public void renderSlot(PoseStack matrices) {
if (this.catalyst) { // Bounds bounds = this.getBounds();
EmiRender.renderCatalystIcon(this.getStack(), matrices, this.x + xOff, this.y + yOff); // int width = bounds.width();
} // int height = bounds.height();
//
if (EmiConfig.showHoverOverlay && bounds.contains(mouseX, mouseY)) { // GuiComponent.fill(matrices, bounds.x(), bounds.y(), bounds.x() + width, bounds.y() + height, 0xB08b8b8b);
EmiRenderHelper.drawSlotHightlight( // RenderHelper.outline(
matrices, // matrices,
bounds.x() + 1, bounds.y() + 1, // bounds.x(),
bounds.width() - 2, bounds.height() - 2 // bounds.y(),
); // bounds.x() + width,
} // bounds.y() + height,
// 0xFA373737,
} // 0xFAFFFFFF
// );
public void renderSlot(PoseStack matrices) { // RenderHelper.vLine(matrices, bounds.x() + width - 1, bounds.y(), bounds.y(), 0xFA8B8B8B);
Bounds bounds = this.getBounds(); // RenderHelper.hLine(matrices, bounds.x(), bounds.x(), bounds.y() + bounds.height() - 1, 0xFA8B8B8B);
int width = bounds.width(); // }
int height = bounds.height(); //}
GuiComponent.fill(matrices, bounds.x(), bounds.y(), bounds.x() + width, bounds.y() + height, 0xB08b8b8b);
RenderHelper.outline(
matrices,
bounds.x(),
bounds.y(),
bounds.x() + width,
bounds.y() + height,
0xFA373737,
0xFAFFFFFF
);
RenderHelper.vLine(matrices, bounds.x() + width - 1, bounds.y(), bounds.y(), 0xFA8B8B8B);
RenderHelper.hLine(matrices, bounds.x(), bounds.x(), bounds.y() + bounds.height() - 1, 0xFA8B8B8B);
}
}

View file

@ -1,88 +1,88 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
//
import org.betterx.betterend.registry.EndBlocks; //import org.betterx.betterend.registry.EndBlocks;
//
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
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.client.gui.widgets.Widget; //import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; //import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory; //import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; //import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
//
import java.text.DecimalFormat; //import java.text.DecimalFormat;
import java.util.List; //import java.util.List;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay> { //public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay> {
private final EntryStack ICON; // private final EntryStack ICON;
//
REIAlloyingCategory(EntryStack icon) { // REIAlloyingCategory(EntryStack icon) {
ICON = icon; // ICON = icon;
} // }
//
@Override // @Override
public @NotNull CategoryIdentifier getCategoryIdentifier() { // public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING; // return REIPlugin.ALLOYING;
} // }
//
@Override // @Override
public @NotNull Component getTitle() { // public @NotNull Component getTitle() {
return Component.translatable(EndBlocks.END_STONE_SMELTER.getDescriptionId()); // return Component.translatable(EndBlocks.END_STONE_SMELTER.getDescriptionId());
} // }
//
@Override // @Override
public @NotNull EntryStack getIcon() { // public @NotNull EntryStack getIcon() {
return ICON; // return ICON;
} // }
//
@Override // @Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) { // public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); // Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime(); // double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##"); // DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList(); // List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); // widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); // widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)) // widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20))
.animationDurationMS(10000)); // .animationDurationMS(10000));
widgets.add(Widgets.createLabel( // widgets.add(Widgets.createLabel(
new Point(bounds.x + bounds.width - 5, bounds.y + 5), // new Point(bounds.x + bounds.width - 5, bounds.y + 5),
Component.translatable( // Component.translatable(
"category.rei.cooking.time&xp", // "category.rei.cooking.time&xp",
df.format(display.getXp()), // df.format(display.getXp()),
df.format(smeltTime / 20D) // df.format(smeltTime / 20D)
) // )
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); // ).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)) // widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8))
.animationDurationTicks(smeltTime)); // .animationDurationTicks(smeltTime));
List<EntryIngredient> inputEntries = display.getInputEntries(); // List<EntryIngredient> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)) // widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1))
.entries(inputEntries.get(0)) // .entries(inputEntries.get(0))
.markInput()); // .markInput());
if (inputEntries.size() > 1) { // if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)) // widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(inputEntries.get(1)) // .entries(inputEntries.get(1))
.markInput()); // .markInput());
} else { // } else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)) // widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(Lists.newArrayList()) // .entries(Lists.newArrayList())
.markInput()); // .markInput());
} // }
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)) // widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9))
.entries(display.getOutputEntries().get(0)) // .entries(display.getOutputEntries().get(0))
.disableBackground() // .disableBackground()
.markOutput()); // .markOutput());
return widgets; // return widgets;
} // }
//
@Override // @Override
public int getDisplayHeight() { // public int getDisplayHeight() {
return 49; // return 49;
} // }
} //}

View file

@ -1,109 +1,109 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.bclib.recipes.AlloyingRecipe; //import org.betterx.bclib.recipes.AlloyingRecipe;
import org.betterx.betterend.blocks.entities.EndStoneSmelterBlockEntity; //import org.betterx.betterend.blocks.entities.EndStoneSmelterBlockEntity;
//
import net.minecraft.ChatFormatting; //import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; //import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.Recipe; //import net.minecraft.world.item.crafting.Recipe;
//
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; //import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; //import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients; //import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks; //import me.shedaniel.rei.api.common.util.EntryStacks;
//
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
import java.util.Optional; //import java.util.Optional;
import java.util.stream.Collectors; //import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDisplay { //public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
//
private static final List<EntryStack> fuel; // private static final List<EntryStack> fuel;
//
private final Recipe<?> recipe; // private final Recipe<?> recipe;
private final float xp; // private final float xp;
private final double smeltTime; // private final double smeltTime;
//
//
public REIAlloyingDisplay(AlloyingRecipe recipe) { // public REIAlloyingDisplay(AlloyingRecipe recipe) {
this(recipe, recipe.getExperience(), recipe.getSmeltTime()); // this(recipe, recipe.getExperience(), recipe.getSmeltTime());
} // }
//
protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) { // protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) {
super( // super(
EntryIngredients.ofIngredients(recipe.getIngredients()), // EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()))) // Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
); // );
this.recipe = recipe; // this.recipe = recipe;
this.xp = xp; // this.xp = xp;
this.smeltTime = smeltTime; // this.smeltTime = smeltTime;
} // }
//
//
public static List<EntryStack> getFuel() { // public static List<EntryStack> getFuel() {
return fuel; // return fuel;
} // }
//
@Override // @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { // public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); // return Optional.ofNullable(recipe).map(Recipe::getId);
} // }
//
@Override // @Override
public CategoryIdentifier<?> getCategoryIdentifier() { // public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.ALLOYING; // return REIPlugin.ALLOYING;
} // }
//
// @Override // // @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() { // // public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input; // // return this.input;
// } // // }
//
public float getXp() { // public float getXp() {
return this.xp; // return this.xp;
} // }
//
public double getSmeltTime() { // public double getSmeltTime() {
return this.smeltTime; // return this.smeltTime;
} // }
//
public Optional<Recipe<?>> getOptionalRecipe() { // public Optional<Recipe<?>> getOptionalRecipe() {
return Optional.ofNullable(recipe); // return Optional.ofNullable(recipe);
} // }
//
@Override // @Override
public int getWidth() { // public int getWidth() {
return 2; // return 2;
} // }
//
@Override // @Override
public int getHeight() { // public int getHeight() {
return 1; // return 1;
} // }
//
// @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;
// } // // }
//
static { // static {
fuel = EndStoneSmelterBlockEntity.availableFuels() // fuel = EndStoneSmelterBlockEntity.availableFuels()
.keySet() // .keySet()
.stream() // .stream()
.map(Item::getDefaultInstance) // .map(Item::getDefaultInstance)
.map(EntryStacks::of) // .map(EntryStacks::of)
.map(e -> e.setting( // .map(e -> e.setting(
EntryStack.Settings.TOOLTIP_APPEND_EXTRA, // EntryStack.Settings.TOOLTIP_APPEND_EXTRA,
stack -> Collections.singletonList(Component.translatable( // stack -> Collections.singletonList(Component.translatable(
"category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW)) // "category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW))
)) // ))
.collect(Collectors.toList()); // .collect(Collectors.toList());
} // }
} //}

View file

@ -1,104 +1,104 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import com.mojang.blaze3d.vertex.PoseStack; //import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Items; //import net.minecraft.world.item.Items;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
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.client.gui.DisplayRenderer; //import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.widgets.*; //import me.shedaniel.rei.api.client.gui.widgets.*;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory; //import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryStacks; //import me.shedaniel.rei.api.common.util.EntryStacks;
//
import java.text.DecimalFormat; //import java.text.DecimalFormat;
import java.util.List; //import java.util.List;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; //import org.jetbrains.annotations.Nullable;
//
public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelDisplay> { //public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelDisplay> {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##"); // private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
//
@Override // @Override
public @NotNull CategoryIdentifier getCategoryIdentifier() { // public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING_FUEL; // return REIPlugin.ALLOYING_FUEL;
} // }
//
@Override // @Override
public @NotNull Component getTitle() { // public @NotNull Component getTitle() {
return Component.translatable("category.rei.fuel"); // return Component.translatable("category.rei.fuel");
} // }
//
@Override // @Override
public int getDisplayHeight() { // public int getDisplayHeight() {
return 49; // return 49;
} // }
//
@Override // @Override
public @NotNull EntryStack getIcon() { // public @NotNull EntryStack getIcon() {
return EntryStacks.of(Items.LAVA_BUCKET); // return EntryStacks.of(Items.LAVA_BUCKET);
} // }
//
@Override // @Override
public List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) { // public List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17); // Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime()); // String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList(); // List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); // widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel( // widgets.add(Widgets.createLabel(
new Point(bounds.x + 26, bounds.getMaxY() - 15), // new Point(bounds.x + 26, bounds.getMaxY() - 15),
Component.translatable("category.rei.fuel.time", burnTime) // Component.translatable("category.rei.fuel.time", burnTime)
).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned()); // ).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)) // widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1))
.animationDurationTicks(recipeDisplay.getFuelTime())); // .animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)) // widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18))
.entries(recipeDisplay.getInputEntries().get(0)) // .entries(recipeDisplay.getInputEntries().get(0))
.markInput()); // .markInput());
return widgets; // return widgets;
} // }
//
@Override // @Override
public DisplayRenderer getDisplayRenderer(REIAlloyingFuelDisplay recipe) { // public DisplayRenderer getDisplayRenderer(REIAlloyingFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)) // Slot slot = Widgets.createSlot(new Point(0, 0))
.entries(recipe.getInputEntries().get(0)) // .entries(recipe.getInputEntries().get(0))
.disableBackground() // .disableBackground()
.disableHighlight(); // .disableHighlight();
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d); // String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
return new DisplayRenderer() { // return new DisplayRenderer() {
private final Component text = Component.translatable( // private final Component text = Component.translatable(
"category.rei.fuel.time_short.items", // "category.rei.fuel.time_short.items",
burnItems // burnItems
); // );
//
@Override // @Override
public int getHeight() { // public int getHeight() {
return 22; // return 22;
} // }
//
@Nullable // @Nullable
@Override // @Override
public Tooltip getTooltip(TooltipContext ctx) { // public Tooltip getTooltip(TooltipContext ctx) {
if (slot.containsMouse(ctx.getPoint())) return slot.getCurrentTooltip(ctx); // if (slot.containsMouse(ctx.getPoint())) return slot.getCurrentTooltip(ctx);
return null; // return null;
} // }
//
@Override // @Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { // public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50); // slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2); // slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta); // slot.render(matrices, mouseX, mouseY, delta);
Minecraft.getInstance().font.drawShadow( // Minecraft.getInstance().font.drawShadow(
matrices, // matrices,
text.getVisualOrderText(), // text.getVisualOrderText(),
bounds.x + 25, // bounds.x + 25,
bounds.y + 8, // bounds.y + 8,
-1 // -1
); // );
} // }
}; // };
} // }
} //}

View file

@ -1,27 +1,27 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; //import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryIngredient; //import me.shedaniel.rei.api.common.entry.EntryIngredient;
//
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
//
public class REIAlloyingFuelDisplay extends BasicDisplay { //public class REIAlloyingFuelDisplay extends BasicDisplay {
private final int fuelTime; // private final int fuelTime;
//
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, int fuelTime) { // public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, int fuelTime) {
super(fuel, Collections.emptyList()); // super(fuel, Collections.emptyList());
this.fuelTime = fuelTime; // this.fuelTime = fuelTime;
} // }
//
@Override // @Override
public CategoryIdentifier<?> getCategoryIdentifier() { // public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.ALLOYING_FUEL; // return REIPlugin.ALLOYING_FUEL;
} // }
//
public int getFuelTime() { // public int getFuelTime() {
return fuelTime; // return fuelTime;
} // }
//
} //}

View file

@ -1,91 +1,91 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.betterend.blocks.basis.EndAnvilBlock; //import org.betterx.betterend.blocks.basis.EndAnvilBlock;
//
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem; //import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack; //import net.minecraft.world.item.ItemStack;
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 com.google.common.collect.Lists; //import com.google.common.collect.Lists;
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.client.gui.widgets.Widget; //import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; //import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory; //import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; //import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
//
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
import java.util.stream.Collectors; //import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> { //public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> {
private final EntryStack<?>[] ANVILS; // private final EntryStack<?>[] ANVILS;
//
REIAnvilCategory(EntryStack<?>[] anvils) { // REIAnvilCategory(EntryStack<?>[] anvils) {
ANVILS = anvils; // ANVILS = anvils;
} // }
//
@Override // @Override
public CategoryIdentifier<REIAnvilDisplay> getCategoryIdentifier() { // public CategoryIdentifier<REIAnvilDisplay> getCategoryIdentifier() {
return REIPlugin.SMITHING; // return REIPlugin.SMITHING;
} // }
//
@Override // @Override
public @NotNull Component getTitle() { // public @NotNull Component getTitle() {
return Component.translatable(Blocks.ANVIL.getDescriptionId()); // return Component.translatable(Blocks.ANVIL.getDescriptionId());
} // }
//
@Override // @Override
public @NotNull EntryStack<?> getIcon() { // public @NotNull EntryStack<?> getIcon() {
return ANVILS[0]; // return 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);
List<Widget> widgets = Lists.newArrayList(); // List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); // widgets.add(Widgets.createRecipeBase(bounds));
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<EntryIngredient> inputEntries = display.getInputEntries(); // List<EntryIngredient> inputEntries = display.getInputEntries();
EntryIngredient materials = inputEntries.get(1); // EntryIngredient materials = inputEntries.get(1);
int anvilLevel = display.getAnvilLevel(); // int anvilLevel = display.getAnvilLevel();
List<EntryStack<?>> anvils = Arrays.stream(ANVILS).filter(anvil -> { // List<EntryStack<?>> anvils = Arrays.stream(ANVILS).filter(anvil -> {
Object value = anvil.getValue(); // Object value = anvil.getValue();
if (value instanceof ItemStack) { // if (value instanceof ItemStack) {
value = ((ItemStack) value).getItem(); // value = ((ItemStack) value).getItem();
} // }
Block block = ((BlockItem) value).getBlock(); // Block block = ((BlockItem) value).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());
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4))); // widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
widgets.add(Widgets.createLabel( // widgets.add(Widgets.createLabel(
new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15), // new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
Component.translatable("category.rei.damage.amount&dmg", display.getDamage()) // Component.translatable("category.rei.damage.amount&dmg", display.getDamage())
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); // ).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)) // widgets.add(Widgets.createSlot(new Point(x + 61, y + 5))
.entries(display.getOutputEntries().get(0)) // .entries(display.getOutputEntries().get(0))
.disableBackground() // .disableBackground()
.markOutput()); // .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;
} // }
//
@Override // @Override
public int getDisplayHeight() { // public int getDisplayHeight() {
return 60; // return 60;
} // }
} //}

View file

@ -1,65 +1,65 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.bclib.recipes.AnvilRecipe; //import org.betterx.bclib.recipes.AnvilRecipe;
//
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; //import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe; //import net.minecraft.world.item.crafting.Recipe;
//
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; //import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; //import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.util.EntryIngredients; //import me.shedaniel.rei.api.common.util.EntryIngredients;
//
import java.util.Collections; //import java.util.Collections;
import java.util.Optional; //import java.util.Optional;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay { //public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
//
private final AnvilRecipe recipe; // private final AnvilRecipe recipe;
//
public REIAnvilDisplay(AnvilRecipe recipe) { // public REIAnvilDisplay(AnvilRecipe recipe) {
super( // super(
EntryIngredients.ofIngredients(recipe.getIngredients()), // EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()))) // Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
); // );
this.recipe = recipe; // this.recipe = recipe;
//
inputs.get(1).forEach(entryStack -> { // inputs.get(1).forEach(entryStack -> {
if (entryStack.getValue() instanceof ItemStack itemStack) { // if (entryStack.getValue() instanceof ItemStack itemStack) {
itemStack.setCount(recipe.getInputCount()); // itemStack.setCount(recipe.getInputCount());
} // }
}); // });
} // }
//
public int getDamage() { // public int getDamage() {
return recipe.getDamage(); // return recipe.getDamage();
} // }
//
public int getAnvilLevel() { // public int getAnvilLevel() {
return recipe.getAnvilLevel(); // return recipe.getAnvilLevel();
} // }
//
@Override // @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { // public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); // return Optional.ofNullable(recipe).map(Recipe::getId);
} // }
//
@Override // @Override
public CategoryIdentifier<?> getCategoryIdentifier() { // public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.SMITHING; // return REIPlugin.SMITHING;
} // }
//
@Override // @Override
public int getWidth() { // public int getWidth() {
return 2; // return 2;
} // }
//
@Override // @Override
public int getHeight() { // public int getHeight() {
return 1; // return 1;
} // }
} //}

View file

@ -1,9 +1,9 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import net.minecraft.world.item.crafting.BlastingRecipe; //import net.minecraft.world.item.crafting.BlastingRecipe;
//
public class REIBlastingDisplay extends REIAlloyingDisplay { //public class REIBlastingDisplay extends REIAlloyingDisplay {
public REIBlastingDisplay(BlastingRecipe recipe) { // public REIBlastingDisplay(BlastingRecipe recipe) {
super(recipe, recipe.getExperience(), recipe.getCookingTime()); // super(recipe, recipe.getExperience(), recipe.getCookingTime());
} // }
} //}

View file

@ -1,112 +1,112 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.betterend.BetterEnd; //import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.registry.EndBlocks; //import org.betterx.betterend.registry.EndBlocks;
//
import net.minecraft.network.chat.Component; //import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
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.client.gui.widgets.Widget; //import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; //import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory; //import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; //import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIInfusionCategory implements DisplayCategory<REIInfusionDisplay> { //public class REIInfusionCategory implements DisplayCategory<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");
private final EntryStack ICON; // private final EntryStack ICON;
//
REIInfusionCategory(EntryStack icon) { // REIInfusionCategory(EntryStack icon) {
ICON = icon; // ICON = icon;
} // }
//
@Override // @Override
public @NotNull CategoryIdentifier getCategoryIdentifier() { // public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.INFUSION; // return REIPlugin.INFUSION;
} // }
//
@Override // @Override
public @NotNull Component getTitle() { // public @NotNull Component getTitle() {
return Component.translatable(EndBlocks.INFUSION_PEDESTAL.getDescriptionId()); // return Component.translatable(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
} // }
//
@Override // @Override
public @NotNull EntryStack getIcon() { // public @NotNull EntryStack getIcon() {
return ICON; // return ICON;
} // }
//
@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<EntryIngredient> inputEntries = display.getInputEntries(); // List<EntryIngredient> inputEntries = display.getInputEntries();
List<EntryIngredient> outputEntries = display.getOutputEntries(); // List<EntryIngredient> outputEntries = display.getOutputEntries();
if (inputEntries.size() < 9) { // if (inputEntries.size() < 9) {
List<EntryIngredient> newList = new ArrayList<EntryIngredient>(9); // List<EntryIngredient> newList = new ArrayList<EntryIngredient>(9);
newList.addAll(inputEntries); // newList.addAll(inputEntries);
for (int i = inputEntries.size(); i < 9; i++) { // for (int i = inputEntries.size(); i < 9; i++) {
newList.add(EntryIngredient.empty()); // newList.add(EntryIngredient.empty());
} // }
inputEntries = newList; // inputEntries = newList;
} // }
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)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28))
.entries(inputEntries.get(1)) // .entries(inputEntries.get(1))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y))
.entries(inputEntries.get(3)) // .entries(inputEntries.get(3))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28))
.entries(inputEntries.get(5)) // .entries(inputEntries.get(5))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y))
.entries(inputEntries.get(7)) // .entries(inputEntries.get(7))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24))
.entries(inputEntries.get(2)) // .entries(inputEntries.get(2))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24))
.entries(inputEntries.get(4)) // .entries(inputEntries.get(4))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24))
.entries(inputEntries.get(6)) // .entries(inputEntries.get(6))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24))
.entries(inputEntries.get(8)) // .entries(inputEntries.get(8))
.disableBackground() // .disableBackground()
.markInput()); // .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)) // widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y))
.entries(outputEntries.get(0)) // .entries(outputEntries.get(0))
.disableBackground() // .disableBackground()
.markOutput()); // .markOutput());
widgets.add(Widgets.createLabel( // widgets.add(Widgets.createLabel(
new Point(bounds.getMaxX() - 5, bounds.y + 6), // new Point(bounds.getMaxX() - 5, bounds.y + 6),
Component.translatable("category.rei.infusion.time&val", display.getInfusionTime()) // Component.translatable("category.rei.infusion.time&val", display.getInfusionTime())
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); // ).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
return widgets; // return widgets;
} // }
//
@Override // @Override
public int getDisplayHeight() { // public int getDisplayHeight() {
return 104; // return 104;
} // }
} //}
//

View file

@ -1,65 +1,65 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.betterend.recipe.builders.InfusionRecipe; //import org.betterx.betterend.recipe.builders.InfusionRecipe;
//
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe; //import net.minecraft.world.item.crafting.Recipe;
//
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; //import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; //import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.util.EntryIngredients; //import me.shedaniel.rei.api.common.util.EntryIngredients;
//
import java.util.Collections; //import java.util.Collections;
import java.util.Optional; //import java.util.Optional;
import org.jetbrains.annotations.NotNull; //import org.jetbrains.annotations.NotNull;
//
public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay { //public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
//
private final InfusionRecipe recipe; // private final InfusionRecipe recipe;
private final int time; // private final int time;
//
public REIInfusionDisplay(InfusionRecipe recipe) { // public REIInfusionDisplay(InfusionRecipe recipe) {
super( // super(
EntryIngredients.ofIngredients(recipe.getIngredients()), // EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()))) // Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
); // );
this.recipe = recipe; // this.recipe = recipe;
this.time = recipe.getInfusionTime(); // this.time = recipe.getInfusionTime();
} // }
//
public int getInfusionTime() { // public int getInfusionTime() {
return this.time; // return this.time;
} // }
//
@Override // @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { // public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); // return Optional.ofNullable(recipe).map(Recipe::getId);
} // }
//
@Override // @Override
public CategoryIdentifier<?> getCategoryIdentifier() { // public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.INFUSION; // return REIPlugin.INFUSION;
} // }
//
// @Override // // @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() { // // public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input; // // return this.input;
// } // // }
//
@Override // @Override
public int getWidth() { // public int getWidth() {
return 0; // return 0;
} // }
//
@Override // @Override
public int getHeight() { // public int getHeight() {
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;
//} // //}
} //}

View file

@ -1,106 +1,106 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
import org.betterx.bclib.blocks.BaseFurnaceBlock; //import org.betterx.bclib.blocks.BaseFurnaceBlock;
import org.betterx.bclib.recipes.AlloyingRecipe; //import org.betterx.bclib.recipes.AlloyingRecipe;
import org.betterx.bclib.recipes.AnvilRecipe; //import org.betterx.bclib.recipes.AnvilRecipe;
import org.betterx.betterend.BetterEnd; //import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.blocks.basis.EndAnvilBlock; //import org.betterx.betterend.blocks.basis.EndAnvilBlock;
import org.betterx.betterend.recipe.builders.InfusionRecipe; //import org.betterx.betterend.recipe.builders.InfusionRecipe;
import org.betterx.betterend.registry.EndBlocks; //import org.betterx.betterend.registry.EndBlocks;
//
import net.minecraft.resources.ResourceLocation; //import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; //import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.BlastingRecipe; //import net.minecraft.world.item.crafting.BlastingRecipe;
import net.minecraft.world.item.crafting.RecipeType; //import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.Blocks; //import net.minecraft.world.level.block.Blocks;
//
import net.fabricmc.fabric.api.registry.FuelRegistry; //import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl; //import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
//
import com.google.common.collect.Lists; //import com.google.common.collect.Lists;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin; //import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; //import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; //import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; //import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; //import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; //import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients; //import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks; //import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.BuiltinPlugin; //import me.shedaniel.rei.plugin.common.BuiltinPlugin;
//
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
import java.util.stream.Collectors; //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 ////https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
public class REIPlugin implements REIClientPlugin { //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 CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of( // public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of(
BetterEnd.MOD_ID, // BetterEnd.MOD_ID,
"alloying_fuel" // "alloying_fuel"
); // );
public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of( // public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of(
BetterEnd.MOD_ID, // BetterEnd.MOD_ID,
AlloyingRecipe.GROUP // AlloyingRecipe.GROUP
); // );
public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of( // public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of(
BetterEnd.MOD_ID, // BetterEnd.MOD_ID,
AnvilRecipe.ID.getPath() // AnvilRecipe.ID.getPath()
); // );
public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of( // public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of(
BetterEnd.MOD_ID, // BetterEnd.MOD_ID,
InfusionRecipe.GROUP // InfusionRecipe.GROUP
); // );
//
@Override // @Override
public void registerDisplays(DisplayRegistry registry) { // public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(AlloyingRecipe.class, AlloyingRecipe.TYPE, REIAlloyingDisplay::new); // registry.registerRecipeFiller(AlloyingRecipe.class, AlloyingRecipe.TYPE, REIAlloyingDisplay::new);
registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new); // registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new);
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new); // registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new); // registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
//
if (FuelRegistry.INSTANCE instanceof FuelRegistryImpl fabricImpl) { // if (FuelRegistry.INSTANCE instanceof FuelRegistryImpl fabricImpl) {
fabricImpl.getFuelTimes().forEach((item, time) -> { // fabricImpl.getFuelTimes().forEach((item, time) -> {
if (time >= 2000) { // if (time >= 2000) {
final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item)); // final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
registry.add(new REIAlloyingFuelDisplay(list, time)); // registry.add(new REIAlloyingFuelDisplay(list, time));
} // }
}); // });
} // }
} // }
//
@Override // @Override
public void registerCategories(CategoryRegistry registry) { // public void registerCategories(CategoryRegistry registry) {
EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER); // EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
EntryStack<ItemStack> infusionRitual = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL); // EntryStack<ItemStack> infusionRitual = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
List<EntryStack<?>> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks() // List<EntryStack<?>> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks()
.stream() // .stream()
.filter(EndAnvilBlock.class::isInstance) // .filter(EndAnvilBlock.class::isInstance)
.collect(Collectors.toList()))); // .collect(Collectors.toList())));
anvils.add(0, EntryStacks.of(Blocks.ANVIL)); // anvils.add(0, EntryStacks.of(Blocks.ANVIL));
List<EntryStack<?>> ITEM_FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks() // List<EntryStack<?>> ITEM_FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks()
.stream() // .stream()
.filter(BaseFurnaceBlock.class::isInstance) // .filter(BaseFurnaceBlock.class::isInstance)
.collect(Collectors.toList()))); // .collect(Collectors.toList())));
EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]); // EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]);
EntryStack<?>[] ITEM_FURNACESArray = ITEM_FURNACES.toArray(new EntryStack[0]); // EntryStack<?>[] ITEM_FURNACESArray = ITEM_FURNACES.toArray(new EntryStack[0]);
//
registry.add( // registry.add(
new REIAlloyingFuelCategory(), // new REIAlloyingFuelCategory(),
new REIAlloyingCategory(endStoneSmelter), // new REIAlloyingCategory(endStoneSmelter),
new REIInfusionCategory(infusionRitual), // new REIInfusionCategory(infusionRitual),
new REIAnvilCategory(anvilsArray) // new REIAnvilCategory(anvilsArray)
); // );
//
registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter); // registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter);
registry.addWorkstations(ALLOYING, endStoneSmelter); // registry.addWorkstations(ALLOYING, endStoneSmelter);
registry.addWorkstations(INFUSION, infusionRitual); // registry.addWorkstations(INFUSION, infusionRitual);
registry.addWorkstations(SMITHING, anvilsArray); // registry.addWorkstations(SMITHING, anvilsArray);
registry.removePlusButton(ALLOYING_FUEL); // registry.removePlusButton(ALLOYING_FUEL);
registry.removePlusButton(SMITHING); // registry.removePlusButton(SMITHING);
//
registry.addWorkstations(BuiltinPlugin.SMELTING, ITEM_FURNACESArray); // registry.addWorkstations(BuiltinPlugin.SMELTING, ITEM_FURNACESArray);
registry.addWorkstations(BuiltinPlugin.FUEL, ITEM_FURNACESArray); // registry.addWorkstations(BuiltinPlugin.FUEL, ITEM_FURNACESArray);
} // }
} //}

View file

@ -1,88 +1,88 @@
package org.betterx.betterend.integration.trinkets; package org.betterx.betterend.integration.trinkets;
import org.betterx.bclib.items.elytra.BCLElytraItem; //import org.betterx.bclib.items.elytra.BCLElytraItem;
import org.betterx.bclib.items.elytra.BCLElytraUtils; //import org.betterx.bclib.items.elytra.BCLElytraUtils;
//
import net.minecraft.util.Tuple; //import net.minecraft.util.Tuple;
import net.minecraft.world.entity.EquipmentSlot; //import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; //import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ElytraItem; //import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.Item; //import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; //import net.minecraft.world.item.ItemStack;
//
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents; //import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem; //import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
//
import dev.emi.trinkets.api.SlotReference; //import dev.emi.trinkets.api.SlotReference;
import dev.emi.trinkets.api.TrinketComponent; //import dev.emi.trinkets.api.TrinketComponent;
import dev.emi.trinkets.api.TrinketsApi; //import dev.emi.trinkets.api.TrinketsApi;
//
import java.util.List; //import java.util.List;
import java.util.Optional; //import java.util.Optional;
//
public class Elytra { //public class Elytra {
private static boolean isElytra(ItemStack stack) { // private static boolean isElytra(ItemStack stack) {
return stack.getItem() instanceof ElytraItem // return stack.getItem() instanceof ElytraItem
|| stack.getItem() instanceof FabricElytraItem; // || stack.getItem() instanceof FabricElytraItem;
} // }
//
public static void register() { // public static void register() {
BCLElytraUtils.slotProvider = (entity, slotGetter) -> { // BCLElytraUtils.slotProvider = (entity, slotGetter) -> {
ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST); // ItemStack itemStack = slotGetter.apply(EquipmentSlot.CHEST);
if (isElytra(itemStack)) return itemStack; // if (isElytra(itemStack)) return itemStack;
//
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity); // Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) { // if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped = // List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra); // oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
if (!equipped.isEmpty()) return equipped.get(0).getB(); // if (!equipped.isEmpty()) return equipped.get(0).getB();
} // }
return null; // return null;
}; // };
//
BCLElytraUtils.onBreak = (entity, chestStack) -> { // BCLElytraUtils.onBreak = (entity, chestStack) -> {
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity); // Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) { // if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped = // List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra); // oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
for (Tuple<SlotReference, ItemStack> slot : equipped) { // for (Tuple<SlotReference, ItemStack> slot : equipped) {
ItemStack slotStack = slot.getB(); // ItemStack slotStack = slot.getB();
if (slotStack == chestStack) { // if (slotStack == chestStack) {
TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity); // TrinketsApi.onTrinketBroken(slotStack, slot.getA(), entity);
} // }
} // }
} // }
}; // };
//
EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket); // EntityElytraEvents.CUSTOM.register(Elytra::useElytraTrinket);
} // }
//
private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) { // private static boolean useElytraTrinket(LivingEntity entity, boolean tickElytra) {
Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity); // Optional<TrinketComponent> oTrinketComponent = TrinketsApi.getTrinketComponent(entity);
if (oTrinketComponent.isPresent()) { // if (oTrinketComponent.isPresent()) {
List<Tuple<SlotReference, ItemStack>> equipped = // List<Tuple<SlotReference, ItemStack>> equipped =
oTrinketComponent.get().getEquipped(Elytra::isElytra); // oTrinketComponent.get().getEquipped(Elytra::isElytra);
//
for (Tuple<SlotReference, ItemStack> slot : equipped) { // for (Tuple<SlotReference, ItemStack> slot : equipped) {
ItemStack stack = slot.getB(); // ItemStack stack = slot.getB();
Item item = stack.getItem(); // Item item = stack.getItem();
//
if (item instanceof ElytraItem) { // if (item instanceof ElytraItem) {
if (ElytraItem.isFlyEnabled(stack)) { // if (ElytraItem.isFlyEnabled(stack)) {
BCLElytraItem.vanillaElytraTick(entity, stack); // BCLElytraItem.vanillaElytraTick(entity, stack);
return true; // return true;
} // }
} else if (item instanceof FabricElytraItem fabricElytraItem) { // } else if (item instanceof FabricElytraItem fabricElytraItem) {
if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) { // if (fabricElytraItem.useCustomElytra(entity, stack, tickElytra)) {
return true; // return true;
} // }
} // }
} // }
} // }
return false; // return false;
} // }
} //}
//

View file

@ -1,22 +1,22 @@
package org.betterx.betterend.integration.trinkets; package org.betterx.betterend.integration.trinkets;
import net.minecraft.world.item.ElytraItem; //import net.minecraft.world.item.ElytraItem;
//
import net.fabricmc.api.EnvType; //import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; //import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents; //import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem; //import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem;
//
import dev.emi.trinkets.api.TrinketsApi; //import dev.emi.trinkets.api.TrinketsApi;
//
@Environment(EnvType.CLIENT) //@Environment(EnvType.CLIENT)
public class ElytraClient { //public class ElytraClient {
public static void register() { // public static void register() {
LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi // LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register((player) -> TrinketsApi
.getTrinketComponent(player) // .getTrinketComponent(player)
.map(trinketComponent -> trinketComponent.getEquipped( // .map(trinketComponent -> trinketComponent.getEquipped(
stack -> stack.getItem() instanceof ElytraItem || // stack -> stack.getItem() instanceof ElytraItem ||
stack.getItem() instanceof FabricElytraItem // stack.getItem() instanceof FabricElytraItem
).size() == 0).orElse(true)); // ).size() == 0).orElse(true));
} // }
} //}