fix: fix really dumb bug in forge

This commit is contained in:
LordMZTE 2023-12-04 18:03:38 +01:00
parent 2366f7822c
commit 8d59c22714
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,35 @@
package net.anvilcraft.ntx4core.mixin.common;
import java.util.function.Supplier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.fluid.Fluid;
import net.minecraftforge.fluids.ForgeFlowingFluid;
/**
* This fixes a bug in forge where `ForgeFlowingFluid.matchesType` would always assume
* that this.flowing != null.
*
* Fixes: https://github.com/Creators-of-Create/Create/issues/3712
*/
@Mixin(ForgeFlowingFluid.class)
public class ForgeFlowingFluidMixin {
@Shadow(remap = false)
private Supplier<? extends Fluid> flowing;
@Shadow(remap = false)
private Supplier<? extends Fluid> still;
/**
* @reason Forge has a bullshit implementation here that NPEs when this.flowing is
* null.
* @author LordMZTE
*/
@Overwrite
public boolean matchesType(Fluid fluid) {
return (still != null && still.get() == fluid)
|| (flowing != null && flowing.get() == fluid);
}
}

View file

@ -4,7 +4,8 @@
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"mixins": [
"accessor.StructureFeatureAccessor"
"accessor.StructureFeatureAccessor",
"common.ForgeFlowingFluidMixin"
],
"client": [
"client.SplashOverlayMixin",