/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.MapCodec * org.jspecify.annotations.Nullable */ 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.util.valueproviders.ConstantInt; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.SculkCatalystBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import org.jspecify.annotations.Nullable; public class SculkCatalystBlock extends BaseEntityBlock { public static final MapCodec CODEC = SculkCatalystBlock.simpleCodec(SculkCatalystBlock::new); public static final BooleanProperty PULSE = BlockStateProperties.BLOOM; private final IntProvider xpRange = ConstantInt.of(5); public MapCodec codec() { return CODEC; } public SculkCatalystBlock(BlockBehaviour.Properties properties) { super(properties); this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(PULSE, false)); } @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(PULSE); } @Override protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { if (state.getValue(PULSE).booleanValue()) { level.setBlock(pos, (BlockState)state.setValue(PULSE, false), 3); } } @Override public @Nullable BlockEntity newBlockEntity(BlockPos worldPosition, BlockState blockState) { return new SculkCatalystBlockEntity(worldPosition, blockState); } @Override public @Nullable BlockEntityTicker getTicker(Level level, BlockState blockState, BlockEntityType type) { if (level.isClientSide()) { return null; } return SculkCatalystBlock.createTickerHelper(type, BlockEntityType.SCULK_CATALYST, SculkCatalystBlockEntity::serverTick); } @Override protected void spawnAfterBreak(BlockState state, ServerLevel level, BlockPos pos, ItemStack tool, boolean dropExperience) { super.spawnAfterBreak(state, level, pos, tool, dropExperience); if (dropExperience) { this.tryDropExperience(level, pos, tool, this.xpRange); } } }