REI Compat

This commit is contained in:
Vos
2025-11-23 17:43:27 -06:00
parent c9318421b4
commit 188ebe8bef
8 changed files with 141 additions and 1 deletions
+7
View File
@@ -16,6 +16,8 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven { url "https://maven.shedaniel.me" }
}
fabricApi {
@@ -32,6 +34,11 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:16.0.777"
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:16.0.777"
modApi "dev.architectury:architectury-fabric:13.0.8"
modApi "me.shedaniel.cloth:cloth-config-fabric:15.0.140"
}
+1 -1
View File
@@ -13,6 +13,6 @@ loom_version=1.13-SNAPSHOT
fabric_version=0.116.7+1.21.1
# Mod Properties
mod_version=1.1.0
mod_version=1.2.0
maven_group=com.acethewildfire.acesbs
archives_base_name=acesbs
@@ -0,0 +1,35 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.recipe.EntropicStabilizerRecipe;
import com.acethewildfire.acesbs.recipe.ModRecipies;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
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.screen.ScreenRegistry;
import me.shedaniel.rei.api.common.util.EntryStacks;
import java.awt.*;
public class AcesBSREIClient implements REIClientPlugin {
@Override
public void registerCategories(CategoryRegistry registry) {
registry.add(new EntropicStabilizerCategory());
registry.addWorkstations(EntropicStabilizerCategory.ENTROPIC_STABILIZER, EntryStacks.of(ModBlocks.ENTROPIC_STABILIZER));
}
@Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(EntropicStabilizerRecipe.class, ModRecipies.ENTROPIC_STABILIZER_TYPE, EntropicStabilizerDisplay::new);
}
@Override
public void registerScreens(ScreenRegistry registry) {
registry.registerClickArea(screen -> new Rectangle(((screen.width - 176) / 2) + 78,
((screen.height - 166) / 2) + 30, 20, 25 ), EntropicStabilizerScreen.class, EntropicStabilizerCategory.ENTROPIC_STABILIZER);
}
}
@@ -0,0 +1,60 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.AcesBS;
import com.acethewildfire.acesbs.block.ModBlocks;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import java.util.LinkedList;
import java.util.List;
public class EntropicStabilizerCategory implements DisplayCategory<BasicDisplay> {
public static final Identifier GUI_TEXTURE =
Identifier.of(AcesBS.MOD_ID, "textures/gui/entropic_stabilizer/entropic_stabilizer_gui_rei.png");
public static final CategoryIdentifier<EntropicStabilizerDisplay> ENTROPIC_STABILIZER =
CategoryIdentifier.of(AcesBS.MOD_ID, "entropic_stabilizer");
@Override
public CategoryIdentifier<? extends BasicDisplay> getCategoryIdentifier() {
return ENTROPIC_STABILIZER;
}
@Override
public Text getTitle() {
return Text.translatable("block.acesbs.entropic_stabilizer");
}
@Override
public Renderer getIcon() {
return EntryStacks.of(ModBlocks.ENTROPIC_STABILIZER.asItem().getDefaultStack());
}
@Override
public List<Widget> setupDisplay(BasicDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 41);
List<Widget> widgets = new LinkedList<>();
widgets.add(Widgets.createTexturedWidget(GUI_TEXTURE, new Rectangle(startPoint.x, startPoint.y, 175, 82)));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 56, startPoint.y + 17)).entries(display.getInputEntries().get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 116, startPoint.y + 35)).entries(display.getOutputEntries().get(0)).markOutput());
return widgets;
}
@Override
public int getDisplayHeight() {
return 90;
}
}
@@ -0,0 +1,34 @@
package com.acethewildfire.acesbs.compat;
import com.acethewildfire.acesbs.block.custom.EntropicStabilizer;
import com.acethewildfire.acesbs.recipe.EntropicStabilizerRecipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.registry.RecipeManagerContext;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.recipe.RecipeEntry;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;
public class EntropicStabilizerDisplay extends BasicDisplay {
private RecipeEntry<?> recipe;
private float xp;
private double cookTime;
public EntropicStabilizerDisplay(RecipeEntry<EntropicStabilizerRecipe> recipe){
super(
List.of(EntryIngredients.ofIngredient(recipe.value().getIngredients().get(0))),
List.of(EntryIngredient.of(EntryStacks.of(recipe.value().getResult(null)))));
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return EntropicStabilizerCategory.ENTROPIC_STABILIZER;
}
}
@@ -80,5 +80,6 @@ public record EntropicStabilizerRecipe(Ingredient inputItem, ItemStack output) i
public PacketCodec<RegistryByteBuf, EntropicStabilizerRecipe> packetCodec() {
return STREAM_CODEC;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

+3
View File
@@ -24,6 +24,9 @@
],
"client": [
"com.acethewildfire.acesbs.AcesBSClient"
],
"rei_client": [
"com.acethewildfire.acesbs.compat.AcesBSREIClient"
]
},
"mixins": [