Skip to content

Commit

Permalink
maybe working fluids
Browse files Browse the repository at this point in the history
  • Loading branch information
Soumeh committed Dec 8, 2024
1 parent 684cbd5 commit 4e56cf2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -20,6 +21,7 @@ public static Identifier of(String path) {
@Override
public void onInitialize() {
ModItems.init();
ModFluids.init();
ModBlocks.init();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Fluid> key = RegistryKey.of(RegistryKeys.FLUID, id);
return Registry.register(Registries.FLUID, key, fluid);
}

}

0 comments on commit 4e56cf2

Please sign in to comment.