Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.lunafalls.fluid;
- import net.neoforged.neoforge.fluids.BaseFlowingFluid;
- import net.minecraft.world.entity.LivingEntity;
- import net.minecraft.world.level.material.FluidState;
- import net.minecraft.world.level.material.Fluid;
- import net.minecraft.world.level.block.state.StateDefinition;
- import net.minecraft.world.level.block.state.BlockState; // Import BlockState
- import net.minecraft.world.level.block.LiquidBlock;
- import net.minecraft.core.particles.ParticleTypes;
- import net.minecraft.core.particles.ParticleOptions;
- import net.minecraft.core.BlockPos;
- import net.minecraft.world.level.BlockGetter;
- import net.minecraft.world.level.Level;
- import net.minecraft.world.level.block.Blocks; // Import for Blocks
- import net.minecraft.world.level.material.Fluids; // Import for Fluids
- import net.mcreator.lunafalls.init.LunafallsModItems;
- import net.mcreator.lunafalls.init.LunafallsModFluids;
- import net.mcreator.lunafalls.init.LunafallsModFluidTypes;
- import net.mcreator.lunafalls.init.LunafallsModBlocks;
- public abstract class FoamingFluid extends BaseFlowingFluid {
- public static final BaseFlowingFluid.Properties PROPERTIES = new BaseFlowingFluid.Properties(() -> LunafallsModFluidTypes.BUBBLE_TYPE.get(), () -> LunafallsModFluids.BUBBLE.get(), () -> LunafallsModFluids.FLOWING_BUBBLE.get())
- .explosionResistance(10000f).tickRate(1).slopeFindDistance(1).bucket(() -> LunafallsModItems.BUBBLE_BUCKET.get()).block(() -> (LiquidBlock) LunafallsModBlocks.BUBBLE.get());
- private FoamingFluid() {
- super(PROPERTIES);
- }
- @Override
- public ParticleOptions getDripParticle() {
- return ParticleTypes.CLOUD;
- }
- // Check if the fluid is surrounded by water on all sides
- private boolean isSurroundedByWater(Level level, BlockPos pos) {
- FluidState fluidBelow = level.getFluidState(pos.below());
- FluidState fluidAbove = level.getFluidState(pos.above());
- FluidState fluidNorth = level.getFluidState(pos.north());
- FluidState fluidSouth = level.getFluidState(pos.south());
- FluidState fluidWest = level.getFluidState(pos.west());
- FluidState fluidEast = level.getFluidState(pos.east());
- return fluidBelow.getType() == Fluids.WATER &&
- fluidAbove.getType() == Fluids.WATER &&
- fluidNorth.getType() == Fluids.WATER &&
- fluidSouth.getType() == Fluids.WATER &&
- fluidWest.getType() == Fluids.WATER &&
- fluidEast.getType() == Fluids.WATER;
- }
- @Override
- protected void spread(Level level, BlockPos pos, FluidState fluidState) {
- // Prevent downward flow
- BlockPos belowPos = pos.below();
- if (!level.getFluidState(belowPos).isEmpty()) {
- // Check if the fluid is surrounded by water on all sides
- if (isSurroundedByWater(level, pos)) {
- // Turn into an air bubble
- level.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
- } else {
- // Normal fluid spread behavior
- super.spread(level, pos, fluidState);
- }
- }
- }
- public static class Source extends FoamingFluid {
- public int getAmount(FluidState state) {
- return 8;
- }
- public boolean isSource(FluidState state) {
- return true;
- }
- }
- public static class Flowing extends FoamingFluid {
- protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> builder) {
- super.createFluidStateDefinition(builder);
- builder.add(LEVEL);
- }
- public int getAmount(FluidState state) {
- return state.getValue(LEVEL);
- }
- public boolean isSource(FluidState state) {
- return false;
- }
- }
- }
- reference to the fuid code if you want to go help through code route instead.
- I tried a lot but a lot of new features, stuff has changed since I last posted. I can add in features easily. I just want to make the new biome that I can't do in mcreator biome tab oddly enough to be like minecrafts:deep_lukewarm_ocean. No frozen layer on top needed. Also other misc for the biome
- "ambient_sound": "lunafalls:io",
- "music": {
- "sound": "music_disc.far",
- "min_delay": 12000,
- "max_delay": 24000,
- "replace_current_music": true
- },
- lastly i'll need to create a feature or structure or something cause I also want to generate the liquid again at y=150 to y=200 in a circular spread of an ocean size
- Anyhelp be appreciated, thank you.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement