Add support for other mod IDs with virtual fluids

This commit is contained in:
FortressNebula 2022-04-08 12:26:52 +01:00
parent c7aca258af
commit 385ffb4533

View file

@ -30,6 +30,7 @@ import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -168,12 +169,26 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
Create.asResource("fluid/" + name + "_flow"), attributesFactory, factory)); Create.asResource("fluid/" + name + "_flow"), attributesFactory, factory));
} }
public <T extends ForgeFlowingFluid> FluidBuilder<T, CreateRegistrate> virtualFluid(String name, ResourceLocation still, ResourceLocation flow,
BiFunction<FluidAttributes.Builder, Fluid, FluidAttributes> attributesFactory,
NonNullFunction<ForgeFlowingFluid.Properties, T> factory) {
return entry(name,
c -> new VirtualFluidBuilder<>(self(), self(), name, c, still,
flow, attributesFactory, factory));
}
public FluidBuilder<VirtualFluid, CreateRegistrate> virtualFluid(String name) { public FluidBuilder<VirtualFluid, CreateRegistrate> virtualFluid(String name) {
return entry(name, return entry(name,
c -> new VirtualFluidBuilder<>(self(), self(), name, c, Create.asResource("fluid/" + name + "_still"), c -> new VirtualFluidBuilder<>(self(), self(), name, c, Create.asResource("fluid/" + name + "_still"),
Create.asResource("fluid/" + name + "_flow"), null, VirtualFluid::new)); Create.asResource("fluid/" + name + "_flow"), null, VirtualFluid::new));
} }
public FluidBuilder<VirtualFluid, CreateRegistrate> virtualFluid(String name, ResourceLocation still, ResourceLocation flow) {
return entry(name,
c -> new VirtualFluidBuilder<>(self(), self(), name, c, still,
flow, null, VirtualFluid::new));
}
public FluidBuilder<ForgeFlowingFluid.Flowing, CreateRegistrate> standardFluid(String name) { public FluidBuilder<ForgeFlowingFluid.Flowing, CreateRegistrate> standardFluid(String name) {
return fluid(name, Create.asResource("fluid/" + name + "_still"), Create.asResource("fluid/" + name + "_flow")); return fluid(name, Create.asResource("fluid/" + name + "_still"), Create.asResource("fluid/" + name + "_flow"));
} }