Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Better way of doing attackEntity?


Gingerbreadman
 Share

Recommended Posts

I am using player controller to attack like 90 entities in one block, the only problem is that it stops attacking them after a while -_-

						if(Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectType.ENTITY) {
						if(Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityBlaze) {
							Minecraft.getMinecraft().playerController.attackEntity(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().objectMouseOver.entityHit);
							Minecraft.getMinecraft().thePlayer.swingItem();
						}

Link to comment
Share on other sites

So fetch all of the entities in a given radius around the player and kill them, or attackEntityFrom with a player-based damage source. You can fetch all of the entities using World#getEntitiesWithinAABB(EntityBlaze.class, player.getEntityBoundingBox().expand(8, 8, 8)) or however far you want.

 

Do it on the server and it will be much faster by not eating up tons of bandwidth with packets.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.