@@ -5,11 +5,13 @@ import com.sammy.malum.common.events.MalumCodexEvents
5
5
import dev.sterner.VoidBoundClient
6
6
import dev.sterner.api.ClientTickHandler
7
7
import dev.sterner.api.item.ItemAbility
8
+ import dev.sterner.api.util.VoidBoundItemUtils
8
9
import dev.sterner.client.event.*
9
10
import dev.sterner.common.components.VoidBoundPlayerComponent
10
11
import dev.sterner.common.components.VoidBoundWorldComponent
11
12
import dev.sterner.common.item.tool.TidecutterItem
12
13
import dev.sterner.common.item.tool.UpgradableTool
14
+ import io.github.fabricators_of_create.porting_lib.entity.events.living.LivingHurtEvent
13
15
import io.github.fabricators_of_create.porting_lib.event.common.BlockEvents
14
16
import net.fabricmc.api.EnvType
15
17
import net.fabricmc.api.Environment
@@ -26,6 +28,7 @@ import net.minecraft.world.entity.EquipmentSlot
26
28
import net.minecraft.world.entity.ai.attributes.Attribute
27
29
import net.minecraft.world.entity.ai.attributes.AttributeModifier
28
30
import net.minecraft.world.entity.ai.attributes.Attributes
31
+ import net.minecraft.world.entity.player.Player
29
32
import net.minecraft.world.item.ItemStack
30
33
import net.minecraft.world.item.crafting.RecipeType
31
34
import net.minecraft.world.item.crafting.SmeltingRecipe
@@ -41,7 +44,21 @@ object VoidBoundEvents {
41
44
BlockEvents .BLOCK_BREAK .register(VoidBoundWorldComponent .Companion ::removeWard)
42
45
BlockEvents .BLOCK_BREAK .register(TidecutterItem .Companion ::breakBlock)
43
46
47
+ LivingHurtEvent .HURT .register{
48
+ val attacker = it.source.entity
49
+ if (attacker is Player ) {
50
+ val item = attacker.mainHandItem
51
+ val bl = VoidBoundItemUtils .getActiveAbility(item) == ItemAbility .VAMPIRISM
52
+ if (bl) {
53
+ attacker.heal(attacker.random.nextInt(2 ).toFloat())
54
+ }
44
55
56
+ val bl2 = VoidBoundItemUtils .getActiveAbility(item) == ItemAbility .OPENER
57
+ if (bl2 && it.entity.health / it.entity.maxHealth > 0.95 ) {
58
+ it.amount * = 1.5f
59
+ }
60
+ }
61
+ }
45
62
46
63
/* *
47
64
* Add extra damage to UpgradableTools when it has extra damage
0 commit comments