Posted May 15, 201510 yr I tried using this code to throw an entity as soon as i left click with the item. The problem is, it doesnt consume the last item. It only does when i hit an entity with it. is there any other way to make it? public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { //--stack.stackSize; if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; --player.getHeldItem().stackSize; if (!entityLiving.worldObj.isRemote) { EntityWolf wolf = new EntityWolf(player.worldObj); wolf.setLocationAndAngles(player.posX + Math.random(), player.posY + 1.5D, player.posZ + Math.random(), player.rotationYaw, player.rotationPitch); player.worldObj.spawnEntityInWorld(wolf); } } return false; }
May 15, 201510 yr Author Thanks a lot :3 Finally i can throw my sandvich and eat it <- little example what it looks like.
May 15, 201510 yr Thanks alot :3 http://4.bp.blogspot.com/_D_Z-D2tzi14/S8TRIo4br3I/AAAAAAAACv4/Zh7_GcMlRKo/s1600/ALOT.png[/img] http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html Had to be done. 1.7.10 is no longer supported by forge, you are on your own.
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.