Posted November 18, 20204 yr Hi, so I'm trying to make a sword that has an AD depending on the current time (ticks). The sword's attack damage should increment slowly from 0 at midnight towards 20 at noon and then drop back towards 0.(values are irellevant) Any ideas about how I would do that? I thought about only incrementing the AD every 600 or 300 ticks (30/15 seconds) so that I would only change it after the AD would hit a certain round value (1 or 0.5), but I don't really know how I would implement that. (The rest of the mod is empty, this would be the only thing in it) I'm new to modding with forge. Also new to modding. I'm ok with Java. Thanks for the help. Edited November 18, 20204 yr by d3us
November 18, 20204 yr You can use LivingHurtEvent and check if the attacker (DamageSource#getTrueSource, it can be null) is holding the sword, then modify the damage according to the time (World#getDayTime or something) there. Or you can override Item#getAttributeModifers and apply the calculations there.
November 18, 20204 yr Author 37 minutes ago, poopoodice said: You can use LivingHurtEvent and check if the attacker (DamageSource#getTrueSource, it can be null) is holding the sword, then modify the damage according to the time (World#getDayTime or something) there. Or you can override Item#getAttributeModifers and apply the calculations there. Thanks, I'll try it. Genius idea about it only changing when being held, but that would mean i would have to find a way to make the user keeps track of sword damage or ingame time.(Maybe also change sword texture based on time?) Edited November 18, 20204 yr by d3us
November 18, 20204 yr LivingHurtEvent only triggers when a living is being attacked, where you can recalculate the corresponding damage when the attacker is holding your sword. If you want to change sword texture based on the time, check out ItemModelProperties, the provider has world as one of its parameter which you can also apply the game time logic there as well. Edited November 18, 20204 yr by poopoodice
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.