Posted April 15, 201510 yr good days i wanna stun an entity, or at least inpeding this one to move for a couple of seconds this is what i been triying @Override public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { target.setInWeb(); stack.damageItem(1, attacker); return true; } //############################################################################################3 not work
April 15, 201510 yr It is working I think. The only problem is that it is only aplied for one single tick. Thats why you dont noticed it. So there are multiple solutions to this. 1) create an tickHandler and let it decrease(or increase) a value Every tick. Aply you "stun effect" every tick till the value reahes a certain point. 2) use vanilla! Yep, what I described above is actualy done by vanilla, its called potion effects. you could simply aplly slowness (with level 10 for example) to achieve your goal. note, its not recommended to use ".setInWeb". its better to modify the targets motion Instead. I hope this helped you out! Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
April 16, 201510 yr Why not add a high level SLOW potion effect to the mob? Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
April 16, 201510 yr A couple options: 1. Subscribe to LivingUpdateEvent and cancel it for the mob in question. Pros - mob will not move or attack; Cons - it cancels the mob's update tick, meaning lots of stuff that's supposed to happen doesn't 2. As above, but instead of canceling it, set the mob's position to its previous position, then also subscribe to LivingAttackEvent and cancel it for the mob in question. Pros - mob does not attack and mostly doesn't move, mob still gets its update tick; Cons - more work, mob still moves a little bit, for players you will also want to cancel mouse and keyboard input using the KeyInputEvent and MouseEvent. http://i.imgur.com/NdrFdld.png[/img]
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.