Fix various JEI bugs

- Fix invisible output slots on JEI crook recipes
- Fix JEI bug with sieve recipes overflowing due to JEI API changes
This commit is contained in:
thedarkcolour 2024-10-06 15:22:09 -07:00
parent 92e1b8afff
commit 76bbe62e16
No known key found for this signature in database
GPG Key ID: 86B37B3575FD5976
6 changed files with 18 additions and 27 deletions

View File

@ -133,13 +133,13 @@ dependencies {
compileOnly("curse.maven:jade-324717:5109393")
// JEI OPTIONAL
compileOnly("mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}")
//runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
runtimeOnly("mezz.jei:jei-${mc_version}-neoforge:${jei_version}")
// REI OPTIONAL todo add
compileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}")
compileOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")
// EMI OPTIONAL
compileOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}:api")
runtimeOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}")
//runtimeOnly("dev.emi:emi-neoforge:${emi_version}+${mc_version}")
//implementation("curse.maven:reipc-521393:4837449")
// KubeJS OPTIONAL
implementation("dev.architectury:architectury-neoforge:${architectury_version}")

View File

@ -1,3 +1,7 @@
## Ex Deorum 3.4
- Fix JEI bug with sieve recipes overflowing due to JEI API changes
- Fix invisible output slots on JEI crook recipes
## Ex Deorum 3.3
- Now built against Minecraft 1.21.1
- Add native EMI support.

View File

@ -10,7 +10,7 @@ neo_version=21.1.51
neo_version_range=[21.1,)
loader_version_range=[4,)
jei_version=19.18.3.204
jei_version=19.19.6.236
rei_version=14.0.688
emi_version=1.1.13
cloth_config_version=15.0.127

View File

@ -42,11 +42,8 @@ import thedarkcolour.exdeorum.data.TranslationKeys;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.registry.EBlocks;
import java.text.DecimalFormat;
// client-only logic shared between JEI and EMI
public class ClientXeiUtil {
public static final DecimalFormat FORMATTER = new DecimalFormat();
private static final ItemStack OAK_BARREL = new ItemStack(DefaultMaterials.OAK_BARREL.getItem());
private static final FluidState EMPTY = Fluids.EMPTY.defaultFluidState();
@ -94,6 +91,8 @@ public class ClientXeiUtil {
public static void renderBlock(GuiGraphics guiGraphics, BlockState state, float x, float y, float z, float scale) {
PoseStack poseStack = guiGraphics.pose();
poseStack.pushPose();
poseStack.translate(x, y, z);
poseStack.scale(-scale, -scale, -scale);
poseStack.translate(-0.5F, -0.5F, 0);
@ -102,7 +101,6 @@ public class ClientXeiUtil {
poseStack.mulPose(Axis.YP.rotationDegrees(45f));
poseStack.translate(-0.5F, 0, 0.5F);
poseStack.pushPose();
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
poseStack.translate(0, 0, -1);
@ -174,7 +172,7 @@ public class ClientXeiUtil {
// Takes a decimal probability and returns a user-friendly percentage value
public static Component formatChance(double probability) {
var chance = FORMATTER.format(probability * 100);
var chance = XeiUtil.FORMATTER.format(probability * 100);
return Component.translatable(TranslationKeys.SIEVE_RECIPE_CHANCE, chance).withStyle(ChatFormatting.GRAY);
}

View File

@ -60,10 +60,6 @@ public class XeiUtil {
public static final int BARREL_MIXING_WIDTH = 120;
public static final int BARREL_MIXING_HEIGHT = 18;
// Barrel compost
public static final int BARREL_COMPOST_WIDTH = 120;
public static final int BARREL_COMPOST_HEIGHT = 18;
// Block predicate (Crucible Heat, Sieve)
public static final Component REQUIRES_CERTAIN_STATE = Component.translatable(TranslationKeys.CROOK_CATEGORY_REQUIRES_STATE).withStyle(ChatFormatting.GRAY);

View File

@ -33,24 +33,13 @@ import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
import net.neoforged.neoforge.common.util.Lazy;
import org.apache.commons.lang3.mutable.MutableInt;
import thedarkcolour.exdeorum.compat.ClientXeiUtil;
import thedarkcolour.exdeorum.compat.XeiSieveRecipe;
import thedarkcolour.exdeorum.compat.XeiUtil;
import thedarkcolour.exdeorum.data.TranslationKeys;
import thedarkcolour.exdeorum.material.DefaultMaterials;
class SieveCategory implements IRecipeCategory<XeiSieveRecipe> {
public static final int WIDTH = 162;
public static final int ROW_START = 28;
static {
ClientXeiUtil.FORMATTER.setMinimumFractionDigits(0);
ClientXeiUtil.FORMATTER.setMaximumFractionDigits(3);
}
private final Lazy<IDrawable> background;
private final IDrawable slot;
private final IDrawable row;
private final IDrawable icon;
@ -58,7 +47,6 @@ class SieveCategory implements IRecipeCategory<XeiSieveRecipe> {
private final MutableInt rows;
SieveCategory(IGuiHelper helper, ItemLike icon, Component title, MutableInt rows) {
this.background = Lazy.of(() -> helper.createBlankDrawable(XeiUtil.SIEVE_WIDTH, XeiUtil.SIEVE_ROW_START + XeiUtil.SIEVE_ROW_HEIGHT * rows.intValue()));
this.slot = helper.getSlotDrawable();
this.row = helper.createDrawable(ExDeorumJeiPlugin.EX_DEORUM_JEI_TEXTURE, 0, 0, 162, 18);
this.icon = helper.createDrawableItemStack(new ItemStack(icon));
@ -81,8 +69,13 @@ class SieveCategory implements IRecipeCategory<XeiSieveRecipe> {
}
@Override
public IDrawable getBackground() {
return this.background.get();
public int getWidth() {
return XeiUtil.SIEVE_WIDTH;
}
@Override
public int getHeight() {
return XeiUtil.SIEVE_ROW_START + XeiUtil.SIEVE_ROW_HEIGHT * rows.intValue();
}
@Override
@ -97,7 +90,7 @@ class SieveCategory implements IRecipeCategory<XeiSieveRecipe> {
for (int i = 0; i < recipe.results().size(); i++) {
var result = recipe.results().get(i);
var slot = builder.addSlot(RecipeIngredientRole.OUTPUT, 1 + (i % 9) * 18, 1 + ROW_START + 18 * (i / 9)).addItemStack(result.item);
var slot = builder.addSlot(RecipeIngredientRole.OUTPUT, 1 + (i % 9) * 18, 1 + XeiUtil.SIEVE_ROW_START + 18 * (i / 9)).addItemStack(result.item);
addTooltips(slot, result.byHandOnly, result.provider);
}