perromercenary00 Posted February 17, 2024 Posted February 17, 2024 this little sword like bar i dont know how is called i need to get the value of how much full it is i made some code to increase the horizontal range of mi melee weapons so you don't have to precisely left click on the mob but just close enough to damage it increasing the hitbox of mobs when i attack like 1.5 grow but it has a trouble mi code works regardless of the sword state so you can smacks as fast as your finger allows kinda old minecrafts style i dont want that i want it to work in synchrony whit the sword behave-our in this video i need like 3 hits to kill a zombie whit the vanilla iron sword mi steel sword does the same damage than iron but if i fast click i can damage the zombie like 8 times in the same amount of time the sword only swing like two times to fix this i want to check the state of that sword-like bar way may code only hits if the bar its over 50% or something // ########## ########## ########## ########## @Override public boolean onEntitySwing(ItemStack stack, LivingEntity le) { //System.out.println("onEntitySwing"); if( swordlikebar > 50% ) { searchAndDamageSurroundingEntities(); } return false; } Quote
vemerion Posted February 17, 2024 Posted February 17, 2024 On 2/17/2024 at 12:00 AM, perromercenary00 said: i need to get the value of how much full it is Expand I think the method is 'Player.getAttackStrengthScale();' Quote
perromercenary00 Posted February 17, 2024 Author Posted February 17, 2024 yaa that was // ########## ########## ########## ########## @Override public boolean onEntitySwing(ItemStack stack, LivingEntity le) { //System.out.println("onEntitySwing"); if (le != null && le.isAlive()) { Level warudo = le.level(); ItemStack main = le.getMainHandItem(); ItemStack off = le.getOffhandItem(); float swordlikebar = 0.0F; if( warudo.isClientSide() || !can_do_it(stack)){ // return false; } String world = (warudo.isClientSide())? "Mundo Local" : "Mundo Remoto"; if(le instanceof Player){ Player pe = (Player)le; swordlikebar = pe.getAttackStrengthScale(0.0F); System.out.println(world + " swordlikebar " + swordlikebar); } Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.31999996 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.31999996 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.31999996 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.71999997 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.39999998 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.39999998 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.6399999 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 0.71999997 Mundo Local swordlikebar 0.0 Mundo Remoto swordlikebar 1.0 dont works client side but i dont need that here Quote
Recommended Posts
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.