- Updated to 1.19 - Added mangrove vertical slabs It has one launch crash that will need to be fixed
62 lines
2.3 KiB
Java
62 lines
2.3 KiB
Java
package tech.nevets.vplus.blocks;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.Material;
|
|
import net.minecraft.particle.ParticleTypes;
|
|
import net.minecraft.sound.BlockSoundGroup;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.Direction;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.Random;
|
|
|
|
public class SaturatedLavaSpongeBlock extends Block {
|
|
|
|
public SaturatedLavaSpongeBlock() {
|
|
super(FabricBlockSettings.of(Material.STONE).strength(0.6F).sounds(BlockSoundGroup.BASALT));
|
|
}
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
|
Direction direction = Direction.random((net.minecraft.util.math.random.Random) random);
|
|
if (direction != Direction.UP) {
|
|
BlockPos blockPos = pos.offset(direction);
|
|
BlockState blockState = world.getBlockState(blockPos);
|
|
if (!state.isOpaque() || !blockState.isSideSolidFullSquare(world, blockPos, direction.getOpposite())) {
|
|
double d = pos.getX();
|
|
double e = pos.getY();
|
|
double f = pos.getZ();
|
|
if (direction == Direction.DOWN) {
|
|
e -= 0.05D;
|
|
d += random.nextDouble();
|
|
f += random.nextDouble();
|
|
} else {
|
|
e += random.nextDouble() * 0.8D;
|
|
if (direction.getAxis() == Direction.Axis.X) {
|
|
f += random.nextDouble();
|
|
if (direction == Direction.EAST) {
|
|
++d;
|
|
} else {
|
|
d += 0.05D;
|
|
}
|
|
} else {
|
|
d += random.nextDouble();
|
|
if (direction == Direction.SOUTH) {
|
|
++f;
|
|
} else {
|
|
f += 0.05D;
|
|
}
|
|
}
|
|
}
|
|
|
|
world.addParticle(ParticleTypes.DRIPPING_LAVA, d, e, f, 0.0D, 0.0D, 0.0D);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|