/* * 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.world.MenuProvider; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; 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.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import org.jspecify.annotations.Nullable; public abstract class BaseEntityBlock extends Block implements EntityBlock { protected BaseEntityBlock(BlockBehaviour.Properties properties) { super(properties); } protected abstract MapCodec codec(); @Override protected boolean triggerEvent(BlockState state, Level level, BlockPos pos, int b0, int b1) { super.triggerEvent(state, level, pos, b0, b1); BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity == null) { return false; } return blockEntity.triggerEvent(b0, b1); } @Override protected @Nullable MenuProvider getMenuProvider(BlockState state, Level level, BlockPos pos) { BlockEntity blockEntity = level.getBlockEntity(pos); return blockEntity instanceof MenuProvider ? (MenuProvider)((Object)blockEntity) : null; } protected static @Nullable BlockEntityTicker createTickerHelper(BlockEntityType actual, BlockEntityType expected, BlockEntityTicker ticker) { return expected == actual ? ticker : null; } }