Skip to content

Commit

Permalink
Merge pull request #92 from FTBTeam/1.20.4/dev
Browse files Browse the repository at this point in the history
1.20.4/dev
  • Loading branch information
desht authored Jun 7, 2024
2 parents e0fa938 + 68f958e commit 01bba51
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public record PositionedIngredient(Object ingredient, Rect2i area, boolean tooltip) {
public static Optional<PositionedIngredient> of(Object ingredient, Widget widget, boolean tooltip) {
return Optional.of(new PositionedIngredient(ingredient, new Rect2i(widget.getPosX(), widget.getPosY(), widget.getWidth(), widget.getHeight()), tooltip));
return Optional.of(new PositionedIngredient(ingredient, new Rect2i(widget.getX(), widget.getY(), widget.getWidth(), widget.getHeight()), tooltip));
}

public static Optional<PositionedIngredient> of(Object ingredient, Widget widget) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftblibrary.integration.fabric;


import dev.architectury.fluid.FluidStack;
import dev.ftb.mods.ftblibrary.integration.JEIIntegration;
import dev.ftb.mods.ftblibrary.util.client.PositionedIngredient;
import mezz.jei.api.fabric.constants.FabricTypes;
Expand All @@ -13,10 +14,12 @@

public class JEIIntegrationImpl {
public static Optional<IClickableIngredient<?>> handleExtraIngredientTypes(IJeiRuntime runtime, PositionedIngredient underMouse) {
if (underMouse.ingredient() instanceof IJeiFluidIngredient stack) {
Optional<ITypedIngredient<IJeiFluidIngredient>> typed = runtime.getIngredientManager().createTypedIngredient(FabricTypes.FLUID_STACK, stack);
if (typed.isPresent()) {
return Optional.of(new JEIIntegration.ClickableIngredient<>(typed.get(), underMouse.area()));
if (underMouse.ingredient() instanceof FluidStack stack) {
if (runtime.getJeiHelpers().getPlatformFluidHelper().create(stack.getFluid(), stack.getAmount()) instanceof IJeiFluidIngredient ingr) {
Optional<ITypedIngredient<IJeiFluidIngredient>> typed = runtime.getIngredientManager().createTypedIngredient(FabricTypes.FLUID_STACK, ingr);
if (typed.isPresent()) {
return Optional.of(new JEIIntegration.ClickableIngredient<>(typed.get(), underMouse.area()));
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

# Mod
mod_id=ftblibrary
mod_version=2004.2.3
mod_version=2004.2.4
mod_author=FTB Team

# Maven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

public class JEIIntegrationImpl {
public static Optional<IClickableIngredient<?>> handleExtraIngredientTypes(IJeiRuntime runtime, PositionedIngredient underMouse) {
if (underMouse.ingredient() instanceof FluidStack stack) {
Optional<ITypedIngredient<FluidStack>> typed = runtime.getIngredientManager().createTypedIngredient(NeoForgeTypes.FLUID_STACK, stack);
if (underMouse.ingredient() instanceof dev.architectury.fluid.FluidStack archStack) {
FluidStack neoStack = new FluidStack(archStack.getFluid(), (int) archStack.getAmount());
Optional<ITypedIngredient<FluidStack>> typed = runtime.getIngredientManager().createTypedIngredient(NeoForgeTypes.FLUID_STACK, neoStack);
if (typed.isPresent()) {
return Optional.of(new JEIIntegration.ClickableIngredient<>(typed.get(), underMouse.area()));
}
Expand Down

0 comments on commit 01bba51

Please sign in to comment.