|
22 | 22 | import net.minecraft.sounds.SoundEvents; |
23 | 23 | import net.minecraft.sounds.SoundSource; |
24 | 24 | import net.minecraft.util.RandomSource; |
| 25 | +import net.minecraft.world.InteractionHand; |
| 26 | +import net.minecraft.world.InteractionResult; |
25 | 27 | import net.minecraft.world.entity.player.Player; |
| 28 | +import net.minecraft.world.level.Level; |
| 29 | +import net.minecraft.world.level.block.state.BlockState; |
| 30 | +import net.minecraft.world.phys.BlockHitResult; |
| 31 | +import net.minecraftforge.fluids.FluidUtil; |
26 | 32 |
|
27 | 33 | import javax.annotation.ParametersAreNonnullByDefault; |
28 | 34 |
|
@@ -84,4 +90,19 @@ public void animateTick(RandomSource random) { |
84 | 90 | getLevel().addParticle(ParticleTypes.FLAME, x, y, z, 0, 0, 0); |
85 | 91 | } |
86 | 92 | } |
| 93 | + |
| 94 | + @Override |
| 95 | + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, |
| 96 | + BlockHitResult hit) { |
| 97 | + if (!isRemote()) { |
| 98 | + if (super.onUse(state, world, pos, player, hand, hit) == InteractionResult.SUCCESS) { |
| 99 | + return InteractionResult.SUCCESS; |
| 100 | + } |
| 101 | + if (FluidUtil.interactWithFluidHandler(player, hand, exportFluids)) { |
| 102 | + return InteractionResult.SUCCESS; |
| 103 | + } |
| 104 | + return InteractionResult.PASS; |
| 105 | + } |
| 106 | + return super.onUse(state, world, pos, player, hand, hit); |
| 107 | + } |
87 | 108 | } |
0 commit comments