55 lines
1.7 KiB
Java
55 lines
1.7 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.server.level.ServerLevel;
|
|
import net.minecraft.util.RandomSource;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.LevelReader;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.Blocks;
|
|
import net.minecraft.world.level.block.BonemealableBlock;
|
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
public class RootedDirtBlock
|
|
extends Block
|
|
implements BonemealableBlock {
|
|
public static final MapCodec<RootedDirtBlock> CODEC = RootedDirtBlock.simpleCodec(RootedDirtBlock::new);
|
|
|
|
public MapCodec<RootedDirtBlock> codec() {
|
|
return CODEC;
|
|
}
|
|
|
|
public RootedDirtBlock(BlockBehaviour.Properties properties) {
|
|
super(properties);
|
|
}
|
|
|
|
@Override
|
|
public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) {
|
|
return level.getBlockState(pos.below()).isAir();
|
|
}
|
|
|
|
@Override
|
|
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
|
level.setBlockAndUpdate(pos.below(), Blocks.HANGING_ROOTS.defaultBlockState());
|
|
}
|
|
|
|
@Override
|
|
public BlockPos getParticlePos(BlockPos blockPos) {
|
|
return blockPos.below();
|
|
}
|
|
}
|
|
|