Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BounceShroomBlock extends BaseEntityBlock {
- protected static final VoxelShape SHAPE = Shapes.join(Block.box(5, 0, 5, 11, 3, 11), Block.box(1, 2.5, 1, 15, 9.5, 15), BooleanOp.OR);
- protected BounceShroomBlock(Properties pProperties) {
- super(pProperties);
- }
- @Nullable
- @Override
- public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
- return EQBlockEntities.BOUNCE_SHROOM.get().create(pPos, pState);
- }
- @Override
- public RenderShape getRenderShape(BlockState pState) {
- return RenderShape.ENTITYBLOCK_ANIMATED;
- }
- @Override
- public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
- return SHAPE;
- }
- @Override
- public void stepOn(Level pLevel, BlockPos pPos, BlockState pState, Entity pEntity) {
- BounceShroomBlockEntity blockEntity = (BounceShroomBlockEntity) pLevel.getBlockEntity(pPos);
- pEntity.resetFallDistance();
- if(!pEntity.isShiftKeyDown()) {
- blockEntity.setBounce(true);
- TaskScheduler.schedule(() -> pEntity.setDeltaMovement(new Vec3(0, 1, 0)),4);
- }
- super.stepOn(pLevel, pPos, pState, pEntity);
- }
- @Nullable
- @Override
- public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, BlockState pState, BlockEntityType<T> pBlockEntityType) {
- return createTickerHelper(pBlockEntityType, EQBlockEntities.BOUNCE_SHROOM.get(), BounceShroomBlockEntity::tick);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement