Well all armour pieces share the same class, so you just need to be careful with how you use the onArmorTick method, since all armour pieces worn will call the same code. You just need to code it how you want it to work, and bear in mind that you won't need to run the changes up to 4 times per tick (once for each armour pieces worn).
Hi! I've been working on something similar to this for a while, so I was pleasantly surprised to find this thread while browsing the forums. My case is similar to his, in that I'm changing damage when something happens (mine is based on the day-night cycle), and I saw the post about Multimaps. We haven't gotten there in my Java class, so can anyone expound or give a quick rundown on those or the tooltip changes? Google hasn't helped me much in this case :7
Hi! I've been working on something similar to this for a while, so I was pleasantly surprised to find this thread while browsing the forums. My case is similar to his, in that I'm changing damage when something happens (mine is based on the day-night cycle), and I saw the post about Multimaps. We haven't gotten there in my Java class, so can anyone expound or give a quick rundown on those or the tooltip changes? Google hasn't helped me much in this case :7
The tooltip change is quite easy actually, just add this on your item class:
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
super.addInformation(stack, player, list, par4);
list.add(ModItems.yellow + "Whomsoever takes up this blade");
list.add(ModItems.yellow + "shall wield power eternal. Just");
list.add(ModItems.yellow + "as the blade rends flesh, so must");
list.add(ModItems.yellow + "power scar the spirit");
}
Of course, you can replace the text with whatever you want. The multiple list.add() functions are because I wanted new lines, this can probably be achieved by using "\n" instead if you rather like that.
When it comes to the mulimaps, it's a little bit more complicated. In the event you prefer, typically in the onEntityUpdate event, put something like this:
@SubscribeEvent
public void onEntityLivingUpdate(LivingUpdateEvent event) {
if (event.entityLiving instanceof EntityPlayer) {
event.entityLiving.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1D + CONST * (1+ Math.sin(entity.entityLiving.worldObj.getWorldTime()%FUNCVALUE)));
}
Ps. this is just a suggestion, there might be a better solution, where CONST is the "amplitude" of the damage boost, and FUNCVALUEis a constant you gotta google yourself, which is the length of a minecraft day meassured in ticks. FUNCVALUE will be a value depending on game difficulty I believe.
Pps. You do not have to use a sinus function to determine how the damage boost is done, that is up to you
Rollback Post to RevisionRollBack
Whomsoever takes up this mod shall wield power eternal.
By tooltip, I meant the part of the tooltip that displays the damage dealt by the weapon. I also used a attack damage booster, bc it was easy, but would I be correct in assuming the only way to change the damage shown under the sword is to create an updating tool material? This is my booster.
Read back through my posts on this thread. The damage shown on the tooltip is taken from the attack attributes of the item and the player added together. The item's attribute is set from the Tool Material, but I don't know if you can change the Tool Material on the fly. But you can override the item's attribute like I've shown and set them to whatever you want - even an NBT value on the item if you want.
Read back through my posts on this thread. The damage shown on the tooltip is taken from the attack attributes of the item and the player added together. The item's attribute is set from the Tool Material, but I don't know if you can change the Tool Material on the fly. But you can override the item's attribute like I've shown and set them to whatever you want - even an NBT value on the item if you want.
Actually, am quite sure that the damage shown on an item is the added damage from the tool material and item type alone, a diamond sword does 8 damage as far as I know, which is the players 1 base damage +4 from emerald tool material and +3 from sword. But yes, as you said, I should be able to change that, but I dont mind having it as it is anymore, I made good system for it. Thanks for all your help though, you have been very helpful!
Rollback Post to RevisionRollBack
Whomsoever takes up this mod shall wield power eternal.
If this thread is still active, I have a similar question.
My code is halfway done; I have a multimap that overrides AttributeModifiers. However, in its current state it does this regardless of anything else, and I'd like the condition to be wearing specific armor items.
I can't add the same if block as I did for armor potion effects, as the sword doesn't have those parameters(?) Editing the multimap doesn't seem to work, either. Could anyone help me out?
Well all armour pieces share the same class, so you just need to be careful with how you use the onArmorTick method, since all armour pieces worn will call the same code. You just need to code it how you want it to work, and bear in mind that you won't need to run the changes up to 4 times per tick (once for each armour pieces worn).
But anyways, I'm glad I've been helpful to you
Hi! I've been working on something similar to this for a while, so I was pleasantly surprised to find this thread while browsing the forums. My case is similar to his, in that I'm changing damage when something happens (mine is based on the day-night cycle), and I saw the post about Multimaps. We haven't gotten there in my Java class, so can anyone expound or give a quick rundown on those or the tooltip changes? Google hasn't helped me much in this case :7
[url ="http://www.minecraftforum.net/topic/1066990-hardcore-ender-expansion"]
[I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
[url=http://www.minecraftnoobtest.com/test.php][/url]
To take the test, check out
[url=http://www.minecraftnoobtest.com/test.php]http://minecraftnoobtest.com/test.php[/url]
The tooltip change is quite easy actually, just add this on your item class:
Of course, you can replace the text with whatever you want. The multiple list.add() functions are because I wanted new lines, this can probably be achieved by using "\n" instead if you rather like that.
When it comes to the mulimaps, it's a little bit more complicated. In the event you prefer, typically in the onEntityUpdate event, put something like this:
Ps. this is just a suggestion, there might be a better solution, where CONST is the "amplitude" of the damage boost, and FUNCVALUEis a constant you gotta google yourself, which is the length of a minecraft day meassured in ticks. FUNCVALUE will be a value depending on game difficulty I believe.
Pps. You do not have to use a sinus function to determine how the damage boost is done, that is up to you
By tooltip, I meant the part of the tooltip that displays the damage dealt by the weapon. I also used a attack damage booster, bc it was easy, but would I be correct in assuming the only way to change the damage shown under the sword is to create an updating tool material? This is my booster.
[url ="http://www.minecraftforum.net/topic/1066990-hardcore-ender-expansion"]
[I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
[url=http://www.minecraftnoobtest.com/test.php][/url]
To take the test, check out
[url=http://www.minecraftnoobtest.com/test.php]http://minecraftnoobtest.com/test.php[/url]
Read back through my posts on this thread. The damage shown on the tooltip is taken from the attack attributes of the item and the player added together. The item's attribute is set from the Tool Material, but I don't know if you can change the Tool Material on the fly. But you can override the item's attribute like I've shown and set them to whatever you want - even an NBT value on the item if you want.
Actually, am quite sure that the damage shown on an item is the added damage from the tool material and item type alone, a diamond sword does 8 damage as far as I know, which is the players 1 base damage +4 from emerald tool material and +3 from sword. But yes, as you said, I should be able to change that, but I dont mind having it as it is anymore, I made good system for it. Thanks for all your help though, you have been very helpful!
I kind of like the text in the tooltip better, it makes it more noticeable. Thanks anyways Bright_Spark
[url ="http://www.minecraftforum.net/topic/1066990-hardcore-ender-expansion"]
[I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
[url=http://www.minecraftnoobtest.com/test.php][/url]
To take the test, check out
[url=http://www.minecraftnoobtest.com/test.php]http://minecraftnoobtest.com/test.php[/url]
If this thread is still active, I have a similar question.
My code is halfway done; I have a multimap that overrides AttributeModifiers. However, in its current state it does this regardless of anything else, and I'd like the condition to be wearing specific armor items.
I can't add the same if block as I did for armor potion effects, as the sword doesn't have those parameters(?) Editing the multimap doesn't seem to work, either. Could anyone help me out?