Skip to content

Commit

Permalink
Fixes #2322
Browse files Browse the repository at this point in the history
- The fluid portion of the FluidTagIngredient is empty, so I made a work
around until it is fixed in FLib.
  • Loading branch information
PocketSizedWeeb committed Apr 20, 2024
1 parent 6d79204 commit 21a012d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.lothrazar.cyclic.block.generatorfluid;

import java.util.List;

import com.google.gson.JsonObject;
import com.lothrazar.cyclic.ModCyclic;
import com.lothrazar.cyclic.registry.CyclicRecipeType;
Expand All @@ -10,13 +12,16 @@
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistries;

public class RecipeGeneratorFluid implements Recipe<TileGeneratorFluid> {

Expand Down Expand Up @@ -61,6 +66,12 @@ public FluidStack getRecipeFluid() {
return fluidIng.getFluidStack();
}

public List<Fluid> getFluidsFromTag() {
TagKey<Fluid> tag = ForgeRegistries.FLUIDS.tags().createTagKey(new ResourceLocation(this.fluidIng.getTag()));
List<Fluid> list = ForgeRegistries.FLUIDS.tags().getTag(tag).stream().toList();
return list;
}

@Override
public boolean matches(TileGeneratorFluid inv, Level worldIn) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private ArrayList<Fluid> indexFluidsFromRecipes() {
ArrayList<Fluid> fluids = new ArrayList<>();
for (RecipeGeneratorFluid recipe : recipes) {
fluids.add(recipe.getRecipeFluid().getFluid());
fluids.addAll(recipe.getFluidsFromTag());
}
return fluids;
}
Expand Down

0 comments on commit 21a012d

Please sign in to comment.