CryingObsidianBlock .java

net.minecraft.world.level.block.CryingObsidianBlock (class, 33 lines): extends Block. members: animateTick. imports: ParticleTypes.

net.minecraft.world.level.blockclass33 linescommonextends Block1.4 KB

API Surface (1)

void animateTick(final BlockState state, final Level level, final BlockPos pos, final RandomSource random)

Code Graph: Dependencies (8)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

CryingObsidianBlock.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.core.Direction;
5
import net.minecraft.core.particles.ParticleTypes;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.level.Level;
8
import net.minecraft.world.level.block.state.BlockBehaviour;
9
import net.minecraft.world.level.block.state.BlockState;
10
11
public class CryingObsidianBlock extends Block {
12
	public CryingObsidianBlock(final BlockBehaviour.Properties properties) {
13
		super(properties);
14
	}
15
16
	@Override
17
	public void animateTick(final BlockState state, final Level level, final BlockPos pos, final RandomSource random) {
18
		if (random.nextInt(5) == 0) {
19
			Direction dir = Direction.getRandom(random);
20
			if (dir != Direction.UP) {
21
				BlockPos relativePos = pos.relative(dir);
22
				BlockState blockState = level.getBlockState(relativePos);
23
				if (!state.canOcclude() || !blockState.isFaceSturdy(level, relativePos, dir.getOpposite())) {
24
					double xOffset = dir.getStepX() == 0 ? random.nextDouble() : 0.5 + dir.getStepX() * 0.6;
25
					double yOffset = dir.getStepY() == 0 ? random.nextDouble() : 0.5 + dir.getStepY() * 0.6;
26
					double zOffset = dir.getStepZ() == 0 ? random.nextDouble() : 0.5 + dir.getStepZ() * 0.6;
27
					level.addParticle(ParticleTypes.DRIPPING_OBSIDIAN_TEAR, pos.getX() + xOffset, pos.getY() + yOffset, pos.getZ() + zOffset, 0.0, 0.0, 0.0);
28
				}
29
			}
30
		}
31
	}
32
}
33

Decompiled Minecraft 26.3 source of CryingObsidianBlock (net/minecraft/world/level/block/CryingObsidianBlock.java) with Mojang official mappings, stored verbatim on the site.