Skip to content

Commit

Permalink
Merge pull request #91 from FTBTeam/dev
Browse files Browse the repository at this point in the history
2006.1.1
  • Loading branch information
desht authored Jun 4, 2024
2 parents 6bce739 + c2453bf commit d154345
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.ftb.mods.ftblibrary.integration;

import dev.architectury.fluid.FluidStack;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.platform.Platform;
import dev.ftb.mods.ftblibrary.FTBLibrary;
Expand All @@ -17,7 +16,6 @@
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.handlers.IGlobalGuiHandler;
import mezz.jei.api.ingredients.IIngredientTypeWithSubtypes;
import mezz.jei.api.ingredients.ITypedIngredient;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.runtime.IClickableIngredient;
Expand All @@ -29,7 +27,6 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.material.Fluid;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
Expand Down Expand Up @@ -82,12 +79,15 @@ public Optional<IClickableIngredient<?>> getClickableIngredientUnderMouse(double
if (typed.isPresent()) {
return Optional.of(new ClickableIngredient<>(typed.get(), underMouse.area()));
}
} else if (underMouse.ingredient() instanceof FluidStack stack) {
// This should work if Arch has setup their fluidstack properly
Optional<ITypedIngredient<FluidStack>> typed = runtime.getIngredientManager().createTypedIngredient(FLUID_STACK, stack);
if (typed.isPresent()) {
return Optional.of(new ClickableIngredient<>(typed.get(), underMouse.area()));
}
// TODO this could work, but an Arch FLUID_STACK needs to be registered with JEI
// and this is non-trivial to do. The handleExtraIngredientTypes fallback below
// works fine for native FluidStacks on NeoForge/Fabric/Forge
// } else if (underMouse.ingredient() instanceof FluidStack stack) {
// // This should work if Arch has setup their fluidstack properly
// Optional<ITypedIngredient<FluidStack>> typed = runtime.getIngredientManager().createTypedIngredient(FLUID_STACK, stack);
// if (typed.isPresent()) {
// return Optional.of(new ClickableIngredient<>(typed.get(), underMouse.area()));
// }
} else {
// Allow us to fallback onto Fluid handlers for the native implementations
return handleExtraIngredientTypes(runtime, underMouse);
Expand Down Expand Up @@ -143,24 +143,25 @@ public Rect2i getArea() {
}
}

/**
* Wrapper around Archs fluid stack to provide JEI with the correct type for each platform
* @implNote This might not work.
*/
public static final IIngredientTypeWithSubtypes<Fluid, FluidStack> FLUID_STACK = new IIngredientTypeWithSubtypes<>() {
@Override
public Class<? extends FluidStack> getIngredientClass() {
return FluidStack.class;
}

@Override
public Class<? extends Fluid> getIngredientBaseClass() {
return Fluid.class;
}

@Override
public Fluid getBase(FluidStack ingredient) {
return ingredient.getFluid();
}
};
// TODO see above TODO about registering an Arch fluid stack ingredient type
// /**
// * Wrapper around Archs fluid stack to provide JEI with the correct type for each platform
// * @implNote This might not work.
// */
// public static final IIngredientTypeWithSubtypes<Fluid, FluidStack> FLUID_STACK = new IIngredientTypeWithSubtypes<>() {
// @Override
// public Class<? extends FluidStack> getIngredientClass() {
// return FluidStack.class;
// }
//
// @Override
// public Class<? extends Fluid> getIngredientBaseClass() {
// return Fluid.class;
// }
//
// @Override
// public Fluid getBase(FluidStack ingredient) {
// return ingredient.getFluid();
// }
// };
}
4 changes: 2 additions & 2 deletions 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=2006.1.0
mod_version=2006.1.1
mod_author=FTB Team

# Maven
Expand All @@ -20,7 +20,7 @@ neoforge_loader_version=1
fabric_loader_version=0.15.10
fabric_api_version=0.99.0+1.20.6

architectury_version=12.1.2
architectury_version=12.1.3

# There are too many of these now
rei_version=15.0.728
Expand Down

0 comments on commit d154345

Please sign in to comment.