Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.20_Crabs' into 1.20_Crabs
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflame86 committed Dec 1, 2023
2 parents 66119b0 + 8834be7 commit 3a6b48d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/kotlin/dev/hybridlabs/aquatic/block/GiantClamBlock.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
package dev.hybridlabs.aquatic.block

import dev.hybridlabs.aquatic.block.entity.GiantClamBlockEntity
import dev.hybridlabs.aquatic.item.HybridAquaticItems
import net.minecraft.block.*
import net.minecraft.block.entity.BlockEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.fluid.FluidState
import net.minecraft.fluid.Fluids
import net.minecraft.item.ItemPlacementContext
import net.minecraft.item.ItemStack
import net.minecraft.registry.tag.FluidTags
import net.minecraft.sound.SoundCategory
import net.minecraft.sound.SoundEvents
import net.minecraft.state.StateManager
import net.minecraft.state.property.Properties.WATERLOGGED
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
import net.minecraft.util.shape.VoxelShape
import net.minecraft.world.BlockView
import net.minecraft.world.World
import net.minecraft.world.WorldAccess

@Suppress("DEPRECATION")
Expand Down Expand Up @@ -76,6 +85,29 @@ class GiantClamBlock(settings: Settings) : PlantBlock(settings), BlockEntityProv
builder.add(WATERLOGGED)
}

override fun onUse(
state: BlockState,
world: World,
pos: BlockPos?,
player: PlayerEntity,
hand: Hand?,
hit: BlockHitResult?
): ActionResult? {
if (hand == Hand.MAIN_HAND) {
1 + world.random.nextInt(5)
dropStack(world, pos, ItemStack(HybridAquaticItems.PEARL, 1))
world.playSound(
null,
pos,
SoundEvents.ENTITY_SHULKER_CLOSE,
SoundCategory.BLOCKS,
1.0f,
0.8f + world.random.nextFloat() * 0.4f
)
}
return super.onUse(state, world, pos, player, hand, hit)
}

companion object {
private val SHAPE = createCuboidShape(2.0, 0.0, 2.0, 14.0, 8.0, 14.0)
private val COLLISION_SHAPE = createCuboidShape(2.0, 0.0, 2.0, 14.0, 8.0, 14.0)
Expand Down

0 comments on commit 3a6b48d

Please sign in to comment.