This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
I now creates Mod for Minecraft and I created a sword but something did not allow me more than 999,999,999 attack damage and I want more. What to do?
Here's the code I did:
@Override public Multimap getItemAttributeModifiers() { Multimap multimap = HashMultimap.create(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", 999999999, 0)); return multimap; }
Sorry for English
please help me the portal man
You can override ItemSword#hitEntity in your custom sword class which extends ItemSword.
@Override public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { stack.damageItem(1, attacker); return true; }
The int value '1' is the amount of damage you want to be inflicted onto the attacked entity
Thanks spyeedy
Quote from Spyeedy» You can override ItemSword#hitEntity in your custom sword class which extends ItemSword. @Override public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { stack.damageItem(1, attacker); return true; } The int value '1' is the amount of damage you want to be inflicted onto the attacked entity
target.attackEntityFrom(DamageSource source, float damage);
Quote from sky_01» What? No, that's ItemStack#damageItem . The 1 is the amount of durability to take away. Use this to damage the attacked entity: target.attackEntityFrom(DamageSource source, float damage);
What could you possibly need a sword that does more than 999,999,999 damage for?
Quote from Dizzlepop12» What could you possibly need a sword that does more than 999,999,999 damage for?
Can't you like just call setDead() on the attacked entity?
Edit: you can also use Integer.MAX_VALUE
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
I now creates Mod for Minecraft and I created a sword but something did not allow me more than 999,999,999 attack damage and I want more. What to do?
Here's the code I did:
Sorry for English
please help me the portal man
You can override ItemSword#hitEntity in your custom sword class which extends ItemSword.
The int value '1' is the amount of damage you want to be inflicted onto the attacked entity
Thanks spyeedy
What? No, that's ItemStack#damageItem . The 1 is the amount of durability to take away.
Use this to damage the attacked entity:
Oh sorry hehe, well hey, at least i got the method right
What could you possibly need a sword that does more than 999,999,999 damage for?
An OP sword perhaps?
Can't you like just call setDead() on the attacked entity?
Edit: you can also use Integer.MAX_VALUE
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.