SlimeBlock .java

net.minecraft.world.level.block.SlimeBlock (class, 32 lines): extends HalfTransparentBlock. members: stepOn, fallOn. imports: BlockBehaviour.

net.minecraft.world.level.blockclass32 linescommonextends HalfTransparentBlock1.1 KB

API Surface (2)

void fallOn(final Level level, final BlockState state, final BlockPos pos, final Entity entity, final double fallDistance)
void stepOn(final Level level, final BlockPos pos, final BlockState onState, final Entity entity)

Code Graph: Dependencies (6)

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

Full Source

SlimeBlock.java32 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.world.entity.Entity;
5
import net.minecraft.world.level.Level;
6
import net.minecraft.world.level.block.state.BlockBehaviour;
7
import net.minecraft.world.level.block.state.BlockState;
8
9
public class SlimeBlock extends HalfTransparentBlock {
10
	public SlimeBlock(final BlockBehaviour.Properties properties) {
11
		super(properties);
12
	}
13
14
	@Override
15
	public void fallOn(final Level level, final BlockState state, final BlockPos pos, final Entity entity, final double fallDistance) {
16
		if (!entity.isSuppressingBounce()) {
17
			entity.causeFallDamage(fallDistance, 0.0F, level.damageSources().fall());
18
		}
19
	}
20
21
	@Override
22
	public void stepOn(final Level level, final BlockPos pos, final BlockState onState, final Entity entity) {
23
		double absDeltaY = Math.abs(entity.getDeltaMovement().y);
24
		if (absDeltaY < 0.1 && !entity.isSteppingCarefully()) {
25
			double scale = 0.4 + absDeltaY * 0.2;
26
			entity.setDeltaMovement(entity.getDeltaMovement().multiply(scale, 1.0, scale));
27
		}
28
29
		super.stepOn(level, pos, onState, entity);
30
	}
31
}
32

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