Fix most modded fluids not working in our machines

This commit is contained in:
Modmuss50 2018-08-11 20:08:44 +01:00
parent 89beff99c7
commit 84aeeb978c
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
5 changed files with 17 additions and 15 deletions

View file

@ -24,18 +24,18 @@
package techreborn.api.fluidreplicator; package techreborn.api.fluidreplicator;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import reborncore.common.util.FluidUtils;
import techreborn.init.ModItems; import techreborn.init.ModItems;
import techreborn.tiles.multiblock.TileFluidReplicator; import techreborn.tiles.multiblock.TileFluidReplicator;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author drcrazy * @author drcrazy
* *
@ -116,11 +116,11 @@ public class FluidReplicatorRecipe implements Cloneable {
if (fluid == null) { if (fluid == null) {
return false; return false;
} }
if (!fluid.equals(output)) { if (!FluidUtils.fluidEquals(fluid, output)) {
return false; return false;
} }
final Fluid tankFluid = tile.tank.getFluidType(); final Fluid tankFluid = tile.tank.getFluidType();
if (tankFluid != null && !tankFluid.equals(output)) { if (tankFluid != null && !FluidUtils.fluidEquals(tankFluid, fluid)) {
return false; return false;
} }

View file

@ -24,13 +24,13 @@
package techreborn.api.fluidreplicator; package techreborn.api.fluidreplicator;
import net.minecraftforge.fluids.Fluid;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.FluidUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Optional; import java.util.Optional;
import org.apache.commons.lang3.Validate;
import net.minecraftforge.fluids.Fluid;
/** /**
* @author drcrazy * @author drcrazy
* *
@ -73,6 +73,6 @@ public class FluidReplicatorRecipeList {
* @return FluidReplicatorRecipe Recipe for fluid provided * @return FluidReplicatorRecipe Recipe for fluid provided
*/ */
public static Optional<FluidReplicatorRecipe> getRecipeForFluid(Fluid fluid) { public static Optional<FluidReplicatorRecipe> getRecipeForFluid(Fluid fluid) {
return recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny(); return recipes.stream().filter(recipe -> FluidUtils.fluidEquals(recipe.getFluid(), fluid)).findAny();
} }
} }

View file

@ -25,6 +25,7 @@
package techreborn.api.generator; package techreborn.api.generator;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
public class FluidGeneratorRecipe { public class FluidGeneratorRecipe {
private final EFluidGenerator generatorType; private final EFluidGenerator generatorType;
@ -79,7 +80,7 @@ public class FluidGeneratorRecipe {
if (fluid == null) { if (fluid == null) {
if (other.fluid != null) if (other.fluid != null)
return false; return false;
} else if (!fluid.equals(other.fluid)) } else if (!FluidUtils.fluidEquals(other.fluid, fluid))
return false; return false;
if (generatorType != other.generatorType) if (generatorType != other.generatorType)
return false; return false;

View file

@ -26,6 +26,7 @@ package techreborn.api.generator;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
import java.util.HashSet; import java.util.HashSet;
import java.util.Optional; import java.util.Optional;
@ -48,7 +49,7 @@ public class FluidGeneratorRecipeList {
} }
public Optional<FluidGeneratorRecipe> getRecipeForFluid(Fluid fluid) { public Optional<FluidGeneratorRecipe> getRecipeForFluid(Fluid fluid) {
return this.recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny(); return this.recipes.stream().filter(recipe -> FluidUtils.fluidEquals(recipe.getFluid(), fluid)).findAny();
} }
public HashSet<FluidGeneratorRecipe> getRecipes() { public HashSet<FluidGeneratorRecipe> getRecipes() {

View file

@ -90,7 +90,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
} }
if (tank.getFluidAmount() > 0) { if (tank.getFluidAmount() > 0) {
if (currentRecipe == null || !currentRecipe.getFluid().equals(tank.getFluidType())) if (currentRecipe == null || !FluidUtils.fluidEquals(currentRecipe.getFluid(), tank.getFluidType()))
currentRecipe = getRecipes().getRecipeForFluid(tank.getFluidType()).orElse(null); currentRecipe = getRecipes().getRecipeForFluid(tank.getFluidType()).orElse(null);
if (currentRecipe != null) { if (currentRecipe != null) {