Jump to content

[1.6.4] How do I add armor piercing to my weapon?


Recommended Posts

Posted

Well, try to find a way to shortcut the damage reduction!

I would not suggest damaging the entity directly, but scaling up your damage done by the item to effectively ignore the armor value... (WARNING: Requires basic algebra)

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Posted

The way I did it was to create a new static DamageSource class:

public static class DamageSourceArmorBreak extends EntityDamageSource {
public DamageSourceArmorBreak(String name, Entity entity) {
super(name, entity);
setDamageBypassesArmor();
}
}

Then I listen for the LivingHurtEvent, check if the source of the damage is a player using, in this case, a special skill (substitute your weapon), and then damage the entity with my new damage source instead.

DirtyEntityAccessor.damageEntity((EntityLivingBase) event.entity, DamageUtils.causeArmorBreakDamage(player), event.ammount);
event.ammount = 0.0F; // set to 0 and/or cancel the event so entity not damaged twice

DirtyEntityAccessor is just a class that I placed in the net.minecraft.entity folder that allows me to call the protected 'damageEntity' method:

public class DirtyEntityAccessor {
public static void damageEntity(EntityLivingBase target, DamageSource source, float amount) {
target.damageEntity(source, amount);
}
}

Thanks again to diesieben07 for his help with that particular solution.

Posted
  On 1/28/2014 at 1:51 AM, coolAlias said:

The way I did it was to create a new static DamageSource class:

public static class DamageSourceArmorBreak extends EntityDamageSource {
public DamageSourceArmorBreak(String name, Entity entity) {
super(name, entity);
setDamageBypassesArmor();
}
}

Then I listen for the LivingHurtEvent, check if the source of the damage is a player using, in this case, a special skill (substitute your weapon), and then damage the entity with my new damage source instead.

DirtyEntityAccessor.damageEntity((EntityLivingBase) event.entity, DamageUtils.causeArmorBreakDamage(player), event.ammount);
event.ammount = 0.0F; // set to 0 and/or cancel the event so entity not damaged twice

DirtyEntityAccessor is just a class that I placed in the net.minecraft.entity folder that allows me to call the protected 'damageEntity' method:

public class DirtyEntityAccessor {
public static void damageEntity(EntityLivingBase target, DamageSource source, float amount) {
target.damageEntity(source, amount);
}
}

Thanks again to diesieben07 for his help with that particular solution.

 

Where do i put the 2nd code?

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...

×   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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I want to change some things about a specific mod. I made some small mods for myself before, but I don't know how to use other mods as a dependencie and add the repositories. My build.gradle file looks something like this:   repositories { flatDir { dirs 'libs' } } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation fg.deobf("libs:create-1.20.1:0.5.1.f") implementation fg.deobf("libs:create-stuff-additions1.20.1:2.0.4a") } I have the folder libs in my root folder. If I start the gradlew.exe, I get the following output: > Configure project : Java: 17.0.15, JVM: 17.0.15+6 (Eclipse Adoptium), Arch: amd64 files(...) dependencies are not deobfuscated. Use a flatDir repository instead: https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Cannot deobfuscate dependency of type DefaultSelfResolvingDependency_Decorated, using obfuscated version! files(...) dependencies are not deobfuscated. Use a flatDir repository instead: https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Cannot deobfuscate dependency of type DefaultSelfResolvingDependency_Decorated, using obfuscated version! I don't know why this warning occurs or how to fix it. If I try to build the whole thing, I get the same message, but this time as an error and the build process crashes. I looked at the gradle dependencies website (https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html), but everything I tried did not work.   I use the Minecaft version 1.20.1 and the Forge version 47.2.17. Both mods don't have other dependencies and work perfectly fine if I start the game normaly.   Can someone explain to me why it does not work and/or where I can get help? Something like a documentation would be enough.
    • im just going to play without shaders(my friends will be dissapointed)
    • crashed the game // Embeddium instance tainted by mods: [oculus] // Please do not reach out for Embeddium support without removing these mods first. // ------- // Why did you do that? flywheel is needed for oculus but when i go into mc it then says sodium is 0.5.3(rubidum fork of sodium ported to forge)
    • oh wait i think i found the error  rubidium wasnt installed for oculus . IT WAS RUBIDIUM????????????????????
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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