Jump to content

[1.16.1]Idea about time-dependant damage in sword?


Recommended Posts

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 by d3us
Link to comment
Share on other sites

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 by d3us
Link to comment
Share on other sites

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 by poopoodice
  • Thanks 1
Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.