| 1 | package net.minecraft.world.level.block;
|
| 2 |
|
| 3 | import java.util.List;
|
| 4 | import net.minecraft.core.BlockPos;
|
| 5 | import net.minecraft.core.Holder;
|
| 6 | import net.minecraft.util.Mth;
|
| 7 | import net.minecraft.world.effect.MobEffect;
|
| 8 | import net.minecraft.world.effect.MobEffectInstance;
|
| 9 | import net.minecraft.world.item.component.SuspiciousStewEffects;
|
| 10 | import net.minecraft.world.level.BlockGetter;
|
| 11 | import net.minecraft.world.level.block.state.BlockBehaviour;
|
| 12 | import net.minecraft.world.level.block.state.BlockState;
|
| 13 | import net.minecraft.world.phys.shapes.CollisionContext;
|
| 14 | import net.minecraft.world.phys.shapes.VoxelShape;
|
| 15 | import org.jspecify.annotations.Nullable;
|
| 16 |
|
| 17 | public class FlowerBlock extends VegetationBlock implements SuspiciousEffectHolder {
|
| 18 | private static final VoxelShape SHAPE = Block.column(6.0, 0.0, 10.0);
|
| 19 | private final SuspiciousStewEffects suspiciousStewEffects;
|
| 20 |
|
| 21 | public FlowerBlock(final Holder<MobEffect> suspiciousStewEffect, final float effectSeconds, final BlockBehaviour.Properties properties) {
|
| 22 | this(makeEffectList(suspiciousStewEffect, effectSeconds), properties);
|
| 23 | }
|
| 24 |
|
| 25 | public FlowerBlock(final SuspiciousStewEffects suspiciousStewEffects, final BlockBehaviour.Properties properties) {
|
| 26 | super(properties);
|
| 27 | this.suspiciousStewEffects = suspiciousStewEffects;
|
| 28 | }
|
| 29 |
|
| 30 | protected static SuspiciousStewEffects makeEffectList(final Holder<MobEffect> suspiciousStewEffect, final float effectSeconds) {
|
| 31 | return new SuspiciousStewEffects(List.of(new SuspiciousStewEffects.Entry(suspiciousStewEffect, Mth.floor(effectSeconds * 20.0F))));
|
| 32 | }
|
| 33 |
|
| 34 | @Override
|
| 35 | protected VoxelShape getShape(final BlockState state, final BlockGetter level, final BlockPos pos, final CollisionContext context) {
|
| 36 | return SHAPE.move(state.getOffset(pos));
|
| 37 | }
|
| 38 |
|
| 39 | @Override
|
| 40 | public SuspiciousStewEffects getSuspiciousEffects() {
|
| 41 | return this.suspiciousStewEffects;
|
| 42 | }
|
| 43 |
|
| 44 | public @Nullable MobEffectInstance getBeeInteractionEffect() {
|
| 45 | return null;
|
| 46 | }
|
| 47 | }
|
| 48 |
|