Add fluid container interaction with infinite water source block
This commit is contained in:
parent
0a1cb62479
commit
b0dc5baa71
@ -1,6 +1,9 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.decorative
|
package ru.dbotthepony.mc.otm.block.decorative
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
import net.minecraft.world.InteractionHand
|
||||||
|
import net.minecraft.world.InteractionResult
|
||||||
|
import net.minecraft.world.entity.player.Player
|
||||||
import net.minecraft.world.level.Level
|
import net.minecraft.world.level.Level
|
||||||
import net.minecraft.world.level.block.EntityBlock
|
import net.minecraft.world.level.block.EntityBlock
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity
|
import net.minecraft.world.level.block.entity.BlockEntity
|
||||||
@ -9,6 +12,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
|||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
import net.minecraft.world.level.material.MapColor
|
import net.minecraft.world.level.material.MapColor
|
||||||
import net.minecraft.world.level.material.PushReaction
|
import net.minecraft.world.level.material.PushReaction
|
||||||
|
import net.minecraft.world.phys.BlockHitResult
|
||||||
|
import net.minecraftforge.fluids.FluidUtil
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.decorative.InfiniteWaterSourceBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.decorative.InfiniteWaterSourceBlockEntity
|
||||||
|
|
||||||
@ -17,6 +22,15 @@ class InfiniteWaterSourceBlock : RotatableMatteryBlock(Properties.of().destroyTi
|
|||||||
return InfiniteWaterSourceBlockEntity(p_153215_, p_153216_)
|
return InfiniteWaterSourceBlockEntity(p_153215_, p_153216_)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("OVERRIDE_DEPRECATION")
|
||||||
|
override fun use(blockState: BlockState, level: Level, blockPos: BlockPos, ply: Player, hand: InteractionHand, blockHitResult: BlockHitResult): InteractionResult {
|
||||||
|
if (FluidUtil.interactWithFluidHandler(ply, hand, level, blockPos, blockHitResult.direction)) {
|
||||||
|
return InteractionResult.sidedSuccess(level.isClientSide)
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.use(blockState, level, blockPos, ply, hand, blockHitResult)
|
||||||
|
}
|
||||||
|
|
||||||
override fun <T : BlockEntity> getTicker(p_153212_: Level, p_153213_: BlockState, p_153214_: BlockEntityType<T>): BlockEntityTicker<T>? {
|
override fun <T : BlockEntity> getTicker(p_153212_: Level, p_153213_: BlockState, p_153214_: BlockEntityType<T>): BlockEntityTicker<T>? {
|
||||||
if (p_153212_.isClientSide)
|
if (p_153212_.isClientSide)
|
||||||
return null
|
return null
|
||||||
|
Loading…
Reference in New Issue
Block a user