Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

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.

  • 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 by d3us

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

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.