Allow interacting with essence storage as fluid tank
This commit is contained in:
parent
e53676a91f
commit
0b5ff224f8
@ -23,6 +23,7 @@ import net.minecraft.world.level.material.PushReaction
|
|||||||
import net.minecraft.world.phys.BlockHitResult
|
import net.minecraft.world.phys.BlockHitResult
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext
|
import net.minecraft.world.phys.shapes.CollisionContext
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape
|
import net.minecraft.world.phys.shapes.VoxelShape
|
||||||
|
import net.neoforged.neoforge.fluids.FluidUtil
|
||||||
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
|
||||||
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
import ru.dbotthepony.mc.otm.block.addSimpleDescription
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity
|
||||||
@ -32,6 +33,7 @@ import ru.dbotthepony.mc.otm.client.minecraft
|
|||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.get
|
import ru.dbotthepony.mc.otm.core.get
|
||||||
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
import ru.dbotthepony.mc.otm.core.util.getLevelFromXp
|
||||||
|
import ru.dbotthepony.mc.otm.item.EssenceServoItem
|
||||||
import ru.dbotthepony.mc.otm.registry.game.MItems
|
import ru.dbotthepony.mc.otm.registry.game.MItems
|
||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||||
|
|
||||||
@ -65,8 +67,12 @@ class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun useItemOn(itemStack: ItemStack, blockState: BlockState, level: Level, blockPos: BlockPos, ply: Player, hand: InteractionHand, blockHitResult: BlockHitResult): ItemInteractionResult {
|
override fun useItemOn(itemStack: ItemStack, blockState: BlockState, level: Level, blockPos: BlockPos, ply: Player, hand: InteractionHand, blockHitResult: BlockHitResult): ItemInteractionResult {
|
||||||
if (itemStack.item == MItems.ESSENCE_SERVO) {
|
if (itemStack.item is EssenceServoItem) {
|
||||||
return MItems.ESSENCE_SERVO.useServo(ply, blockPos)
|
return (itemStack.item as EssenceServoItem).useServo(ply, blockPos)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FluidUtil.interactWithFluidHandler(ply, hand, level, blockPos, blockHitResult.direction)) {
|
||||||
|
return ItemInteractionResult.sidedSuccess(level.isClientSide)
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.useItemOn(itemStack, blockState, level, blockPos, ply, hand, blockHitResult)
|
return super.useItemOn(itemStack, blockState, level, blockPos, ply, hand, blockHitResult)
|
||||||
|
Loading…
Reference in New Issue
Block a user