The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2012
Posts:
192
Location:
On Earth
Minecraft:
Nathmon565
Member Details
So I was curious as to whether or not I could have a potion effect deal damage from a custom source in set intervals. Something like 1/2 heart every 30 seconds, or 600 ticks. The potion effect I am currently using works just fine and I just want to modify when damage gets dealt from the potion.
and turn the "...world.rand.nextInt(600) == 0)" into something that is not random? I don't really know how to do that without using timers (which I have never touched before)... Any help would be appreciated.
Rollback Post to RevisionRollBack
"But even the word 'hopeless' has 'hope' in it! And if you rearrange the letters, it spells 'peeslosh'!" - BattleBlock Theater
Override Potion#isReady to check if duration (the number of ticks the effect has left) is divisible by X (i.e. duration % X == 0), where X is the interval at which the potion should damage the entity. Override Potion#performEffect to damage the entity.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2012
Posts:
192
Location:
On Earth
Minecraft:
Nathmon565
Member Details
I haven't really used Overrides much before on my own. I tried my best setting it up, but I'm pretty sure I did it wrong. I learn visually when I see others' code and I can usually adjust it to how I want.
@Override(Potion.isReady) {
duration % 600 == 0}
I mean... I tried... It didn't work (probably obvious). Being honest, I have very little idea how to set up @ and deal with any of the stuff here. Could you either tell me how to format it, or direct me to a tutorial? Thanks for your help.
Rollback Post to RevisionRollBack
"But even the word 'hopeless' has 'hope' in it! And if you rearrange the letters, it spells 'peeslosh'!" - BattleBlock Theater
This is very basic Java knowledge that you should already have before making a mod.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So I was curious as to whether or not I could have a potion effect deal damage from a custom source in set intervals. Something like 1/2 heart every 30 seconds, or 600 ticks. The potion effect I am currently using works just fine and I just want to modify when damage gets dealt from the potion.
Would it be possible to take
and turn the "...world.rand.nextInt(600) == 0)" into something that is not random? I don't really know how to do that without using timers (which I have never touched before)... Any help would be appreciated.
"But even the word 'hopeless' has 'hope' in it! And if you rearrange the letters, it spells 'peeslosh'!" - BattleBlock Theater
Override Potion#isReady to check if duration (the number of ticks the effect has left) is divisible by X (i.e. duration % X == 0), where X is the interval at which the potion should damage the entity. Override Potion#performEffect to damage the entity.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I haven't really used Overrides much before on my own. I tried my best setting it up, but I'm pretty sure I did it wrong. I learn visually when I see others' code and I can usually adjust it to how I want.
I mean... I tried... It didn't work (probably obvious). Being honest, I have very little idea how to set up @ and deal with any of the stuff here. Could you either tell me how to format it, or direct me to a tutorial? Thanks for your help.
"But even the word 'hopeless' has 'hope' in it! And if you rearrange the letters, it spells 'peeslosh'!" - BattleBlock Theater
Java has a tutorial on overriding methods here.
This is very basic Java knowledge that you should already have before making a mod.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.