-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using fists for knockback is op #7
Comments
I was aware of this when I was playing around with it a while ago, and I implemented a countermeasure specifically for this. from EntityHandler.java @SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerAttack(AttackEntityEvent event) {
if (!event.isCanceled()) {
EntityPlayer player = event.getEntityPlayer();
if (player.getEntityWorld().isRemote) {
return;
}
float str = player.getCooledAttackStrength(0);
if (str <= NodamiConfig.attackCancelThreshold) {
event.setCanceled(true);
return;
}
if (str <= NodamiConfig.knockbackCancelThreshold) {
// Don't worry, it's only magic
player.hurtTime = -1;
}
}
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onKnockback(LivingKnockBackEvent event) {
if (!event.isCanceled()) {
Entity attacker = event.getAttacker();
if (attacker != null && !attacker.getEntityWorld().isRemote) {
// IT'S ONLY MAGIC
if (attacker instanceof EntityPlayer && ((EntityPlayer) attacker).hurtTime == -1) {
event.setCanceled(true);
((EntityPlayer) attacker).hurtTime = 0;
}
}
}
} from NodamiConfig.java private static void syncConfig() {
// line30-33
attackCancelThreshold = config.getFloat("attackCancelThreshold", "thresholds", 0.1f, -0.1f, 1, "How weak a player's attack can be before it gets nullified, from 0 (0%, cancels multiple attacks on the same tick) to 1 (100%, players cannot attack), or -0.1 (disables this feature)");
knockbackCancelThreshold = config.getFloat("knockbackCancelThreshold", "thresholds", 0.75f, -0.1f, 1, "How weak a player's attack can be before the knockback gets nullified, from 0 (0%, cancels multiple attacks on the same tick) to 1 (100%, no knockback), or -0.1 (disables this feature)");
// line 36-44
} Despite being a very bootleg implementation, I've tested this quite extensively and so far it works fine for me. Could you give me more detail as to how you were able to knockback enemies with weak attacks even with the default configs. Give me a list of mods you're using alongside aswell, since this may very well be due to mod intereactions. |
im pretty sure it was because the player has a base attack time of 4 which is really fast, and by removing iframes on all entities all my punch or non-tool items i could hit them like 3 times a second for what the game thought was a fully charged attack despite doing 1 dmg a hit, testing with weapons that reduce my attack speed worked as intended however |
im doing some mapmaking and this mod was absolutely perfect for what i needed, but ive found out that if you just punch enemies rapidly you can just knock them back as much as you need and even deal more damage than slow weapons, ive tried many things to fix this like making the players base attack speed less but that never works, and setting the config to give iframes when i attack npcs somewhat works but isnt the best solution
The text was updated successfully, but these errors were encountered: