2025-11-24 22:52:51 +03:00

65 lines
2.4 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.serialization.MapCodec
*/
package net.minecraft.world.level.block;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.ScheduledTickAccess;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BubbleColumnBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
public class MagmaBlock
extends Block {
public static final MapCodec<MagmaBlock> CODEC = MagmaBlock.simpleCodec(MagmaBlock::new);
private static final int BUBBLE_COLUMN_CHECK_DELAY = 20;
public MapCodec<MagmaBlock> codec() {
return CODEC;
}
public MagmaBlock(BlockBehaviour.Properties properties) {
super(properties);
}
@Override
public void stepOn(Level level, BlockPos pos, BlockState onState, Entity entity) {
if (!entity.isSteppingCarefully() && entity instanceof LivingEntity) {
entity.hurt(level.damageSources().hotFloor(), 1.0f);
}
super.stepOn(level, pos, onState, entity);
}
@Override
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
BubbleColumnBlock.updateColumn(level, pos.above(), state);
}
@Override
protected BlockState updateShape(BlockState state, LevelReader level, ScheduledTickAccess ticks, BlockPos pos, Direction directionToNeighbour, BlockPos neighbourPos, BlockState neighbourState, RandomSource random) {
if (directionToNeighbour == Direction.UP && neighbourState.is(Blocks.WATER)) {
ticks.scheduleTick(pos, this, 20);
}
return super.updateShape(state, level, ticks, pos, directionToNeighbour, neighbourPos, neighbourState, random);
}
@Override
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) {
level.scheduleTick(pos, this, 20);
}
}