Skip to content

Commit 3304204

Browse files
committed
TRIPLE_REBOUND
1 parent 5e640a3 commit 3304204

File tree

7 files changed

+53
-36
lines changed

7 files changed

+53
-36
lines changed

src/main/java/dev/sterner/mixin/ReboundEnchantmentMixin.java

-25
This file was deleted.

src/main/kotlin/dev/sterner/api/item/ItemAbility.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ enum class ItemAbility : StringRepresentable {
1818
HARVEST,
1919
OPENER,//TODO re-implement. First hit on a mob deals increased damage and grants a stack of Wrath, lasting a minute, up to 10 stacks. Transforms into Finale when you reach 10 stacks, or sneak right click
2020
FINALE,//TODO implement. Consumes All stacks of Opening Strike, multiplying damage dealt by the amount of stacks total.
21-
TRIPLE_REBOUND,//TODO implement
21+
TRIPLE_REBOUND,
2222
VENGEANCE,//TODO implement. Rebound now actively seeks the target who most recently attacked you, damage taken by the owner of the scythe extends it's flight time. Initial flight time greatly increased
2323
PROPAGATION,//TODO implement, Rebound causes a sweeping attack. Scythe Sweeping now propagates, spreading itself through hordes of enemies like a chain
2424
SPIRIT_VISION; //TODO implement, hallowed goggles ability

src/main/kotlin/dev/sterner/common/components/VoidBoundPlayerItemAbilityComponent.kt

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
package dev.sterner.common.components
22

3+
import com.sammy.malum.common.entity.boomerang.ScytheBoomerangEntity
4+
import com.sammy.malum.registry.common.AttributeRegistry
35
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
46
import dev.onyxstudios.cca.api.v3.component.tick.CommonTickingComponent
57
import dev.sterner.api.item.ItemAbility
68
import dev.sterner.api.util.VoidBoundItemUtils
7-
import dev.sterner.api.util.VoidBoundPlayerUtils
89
import dev.sterner.api.util.VoidBoundUtils
10+
import dev.sterner.mixin_logic.ReboundEnchantmentMixinLogic.logic
911
import dev.sterner.registry.VoidBoundComponentRegistry
1012
import net.minecraft.nbt.CompoundTag
13+
import net.minecraft.server.level.ServerPlayer
1114
import net.minecraft.sounds.SoundEvents
15+
import net.minecraft.stats.Stats
16+
import net.minecraft.world.InteractionHand
1217
import net.minecraft.world.entity.LivingEntity
18+
import net.minecraft.world.entity.ai.attributes.Attributes
1319
import net.minecraft.world.entity.player.Player
20+
import net.minecraft.world.item.ItemStack
21+
import team.lodestar.lodestone.registry.common.LodestoneAttributeRegistry
1422

1523
class VoidBoundPlayerItemAbilityComponent(private val player: Player) : AutoSyncedComponent, CommonTickingComponent {
1624

@@ -65,4 +73,39 @@ class VoidBoundPlayerItemAbilityComponent(private val player: Player) : AutoSync
6573
private fun sync(){
6674
VoidBoundComponentRegistry.VOID_BOUND_PLAYER_ITEM_ABILITY_COMPONENT.sync(player)
6775
}
76+
77+
companion object {
78+
fun onRightClickItem(player: ServerPlayer, interactionHand: InteractionHand?, stack: ItemStack): Boolean {
79+
if (VoidBoundItemUtils.getActiveAbility(stack) == ItemAbility.TRIPLE_REBOUND) {
80+
val level = player.level()
81+
if (!level.isClientSide) {
82+
83+
player.setItemInHand(interactionHand, ItemStack.EMPTY)
84+
val baseDamage = player.attributes.getValue(Attributes.ATTACK_DAMAGE).toFloat()
85+
val magicDamage = player.attributes.getValue(LodestoneAttributeRegistry.MAGIC_DAMAGE.get()).toFloat()
86+
val slot =
87+
if (interactionHand == InteractionHand.OFF_HAND) player.inventory.containerSize - 1 else player.inventory.selected
88+
val entity = ScytheBoomerangEntity(
89+
level,
90+
player.position().x,
91+
player.position().y + (player.bbHeight / 2.0f).toDouble(),
92+
player.position().z
93+
)
94+
entity.setData(player, baseDamage, magicDamage, slot)
95+
entity.item = stack
96+
entity.shootFromRotation(
97+
player, player.xRot, player.yRot, 0.0f,
98+
(1.5 + player.getAttributeValue(AttributeRegistry.SCYTHE_PROFICIENCY.get()) * 0.125).toFloat(), 0.0f
99+
)
100+
level.addFreshEntity(entity)
101+
102+
logic(player, stack, baseDamage, magicDamage)
103+
}
104+
105+
player.awardStat(Stats.ITEM_USED[stack.item])
106+
}
107+
108+
return false
109+
}
110+
}
68111
}

src/main/kotlin/dev/sterner/common/components/VoidBoundRevelationComponent.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class VoidBoundRevelationComponent(private val player: Player) : AutoSyncedCompo
2727
ItemAbility.EARTH_RUMMAGER,
2828
ItemAbility.HARVEST,
2929
ItemAbility.SCORCHING_HEAT,
30-
ItemAbility.SPIRIT_VISION
30+
ItemAbility.SPIRIT_VISION,
31+
ItemAbility.TRIPLE_REBOUND
3132
)
3233
}
3334

@@ -143,10 +144,10 @@ class VoidBoundRevelationComponent(private val player: Player) : AutoSyncedCompo
143144
knowledgeDataSet = KnowledgeData.readFromNbt(tag)
144145

145146
unlockedItemAbilities.clear()
147+
unlockedItemAbilities = ItemAbility.readNbt(tag)
146148
defaultAbilities().forEach {
147149
unlockedItemAbilities.add(it)
148150
}
149-
unlockedItemAbilities = ItemAbility.readNbt(tag)
150151
}
151152

152153
override fun writeToNbt(tag: CompoundTag) {

src/main/kotlin/dev/sterner/registry/VoidBoundEvents.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dev.sterner.api.item.ItemAbility
88
import dev.sterner.api.util.VoidBoundItemUtils
99
import dev.sterner.client.event.*
1010
import dev.sterner.common.components.VoidBoundPlayerComponent
11+
import dev.sterner.common.components.VoidBoundPlayerItemAbilityComponent
1112
import dev.sterner.common.components.VoidBoundWorldComponent
1213
import dev.sterner.common.item.equipment.TidecutterItem
1314
import dev.sterner.common.item.equipment.UpgradableTool
@@ -29,6 +30,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier
2930
import net.minecraft.world.entity.ai.attributes.Attributes
3031
import net.minecraft.world.entity.player.Player
3132
import net.minecraft.world.item.ItemStack
33+
import team.lodestar.lodestone.events.LodestoneInteractionEvent
3234
import java.util.*
3335

3436

@@ -39,7 +41,7 @@ object VoidBoundEvents {
3941
UseEntityCallback.EVENT.register(VoidBoundPlayerComponent.Companion::useEntity)
4042
BlockEvents.BLOCK_BREAK.register(VoidBoundWorldComponent.Companion::removeWard)
4143
BlockEvents.BLOCK_BREAK.register(TidecutterItem.Companion::breakBlock)
42-
44+
LodestoneInteractionEvent.RIGHT_CLICK_ITEM.register(VoidBoundPlayerItemAbilityComponent::onRightClickItem)
4345
LivingHurtEvent.HURT.register {
4446
val attacker = it.source.entity
4547
if (attacker is Player) {

src/main/resources/data/malum/tags/items/soul_hunter_weapon.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"voidbound:earthsong_hoe",
99

1010
"voidbound:ichorium_scythe",
11-
"voidbound:ichorium_axe",
12-
"voidbound:ichorium_pickaxe",
13-
"voidbound:ichorium_shovel",
14-
"voidbound:ichorium_sword",
15-
"voidbound:ichorium_hoe"
11+
"voidbound:ichorium_terraformer",
12+
"voidbound:ichorium_vorpal"
1613
]
1714
}

src/main/resources/voidbound.mixins.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"HoeItemTillablesAccessor",
77
"ItemEntityMixin",
88
"LodestoneBlockEntityRegistryMixin",
9-
"ReboundEnchantmentMixin",
109
"ScytheBoomerangEntityMixin",
1110
"ServerPlayerGameModeMixin",
1211
"ServerPlayerMixin",

0 commit comments

Comments
 (0)