From 4e56cf291cf7a598cffded0fc04cef54a164974c Mon Sep 17 00:00:00 2001 From: soumeh Date: Sun, 8 Dec 2024 12:51:29 +0100 Subject: [PATCH] maybe working fluids --- .../nuclearcrackhead/serverboss/SVBCR.java | 2 ++ .../serverboss/registry/ModBlocks.java | 8 ++--- .../serverboss/registry/ModFluids.java | 35 +++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/nuclearcrackhead/serverboss/registry/ModFluids.java diff --git a/src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java b/src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java index 140c91c..49374e0 100644 --- a/src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java +++ b/src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java @@ -1,6 +1,7 @@ package com.nuclearcrackhead.serverboss; import com.nuclearcrackhead.serverboss.registry.ModBlocks; +import com.nuclearcrackhead.serverboss.registry.ModFluids; import com.nuclearcrackhead.serverboss.registry.ModItems; import net.fabricmc.api.ModInitializer; @@ -20,6 +21,7 @@ public static Identifier of(String path) { @Override public void onInitialize() { ModItems.init(); + ModFluids.init(); ModBlocks.init(); } } \ No newline at end of file diff --git a/src/main/java/com/nuclearcrackhead/serverboss/registry/ModBlocks.java b/src/main/java/com/nuclearcrackhead/serverboss/registry/ModBlocks.java index 3a0f15c..643ad5d 100644 --- a/src/main/java/com/nuclearcrackhead/serverboss/registry/ModBlocks.java +++ b/src/main/java/com/nuclearcrackhead/serverboss/registry/ModBlocks.java @@ -22,10 +22,10 @@ public class ModBlocks { public static void init() {} - public static FlowableFluid RADIOACTIVE_STILL = Registry.register(Registries.FLUID, Identifier.of("svbcr", "radioactive_still"), new RadioactiveFluid.Still()); - public static FlowableFluid RADIOACTIVE_FLOWING = Registry.register(Registries.FLUID, Identifier.of("svbcr", "radioactive_flowing"), new RadioactiveFluid.Flowing()); - public static Block RADIOACTIVE = Registry.register(Registries.BLOCK, Identifier.of("svbcr", "radioactive"), new FluidBlock(RADIOACTIVE_STILL, AbstractBlock.Settings.copy(Blocks.WATER)){}); - + public static Block RADIOACTIVE = register("radioactive", + settings -> new FluidBlock(ModFluids.RADIOACTIVE_STILL, settings), + AbstractBlock.Settings.copy(Blocks.WATER) + ); public static final Block EXAMPLE_BLOCK = register("example_block", ExampleBlock::new, AbstractBlock.Settings.create() ); diff --git a/src/main/java/com/nuclearcrackhead/serverboss/registry/ModFluids.java b/src/main/java/com/nuclearcrackhead/serverboss/registry/ModFluids.java new file mode 100644 index 0000000..1df19e0 --- /dev/null +++ b/src/main/java/com/nuclearcrackhead/serverboss/registry/ModFluids.java @@ -0,0 +1,35 @@ +package com.nuclearcrackhead.serverboss.registry; + +import com.nuclearcrackhead.serverboss.SVBCR; +import com.nuclearcrackhead.serverboss.content.block.Agony; +import com.nuclearcrackhead.serverboss.content.block.ExampleBlock; +import com.nuclearcrackhead.serverboss.content.block.RadioactiveFluid; +import net.minecraft.block.*; +import net.minecraft.fluid.FlowableFluid; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; + +import java.util.function.Function; + +public class ModFluids { + + public static void init() {} + + public static FlowableFluid RADIOACTIVE_STILL = register("radioactive_still", new RadioactiveFluid.Still()); + public static FlowableFluid RADIOACTIVE_FLOWING = register("radioactive_flowing", new RadioactiveFluid.Flowing()); + + public static Fluid register(String path, Fluid fluid) { + Identifier id = SVBCR.of(path); + RegistryKey key = RegistryKey.of(RegistryKeys.FLUID, id); + return Registry.register(Registries.FLUID, key, fluid); + } + +}