ZapterX Posted March 24, 2014 Share Posted March 24, 2014 I am creating a gun mod and I have almost everything set except the guns do not shoot, because I do not know how to make a projectile launch on a left click with an item. Thanks in advance, ZapterX Quote Link to comment Share on other sites More sharing options...
ZapterX Posted March 24, 2014 Author Share Posted March 24, 2014 Thank you, but I have never codded a gun before and wanted to know if you could provide a more specific example. Quote Link to comment Share on other sites More sharing options...
ZapterX Posted March 24, 2014 Author Share Posted March 24, 2014 Where is the code for it? I've been searching in the src. Quote Link to comment Share on other sites More sharing options...
ZapterX Posted March 24, 2014 Author Share Posted March 24, 2014 It says source not found when the files are in the correct locations. Quote Link to comment Share on other sites More sharing options...
ZapterX Posted March 24, 2014 Author Share Posted March 24, 2014 No I have not, would I do that in the command prompt? Quote Link to comment Share on other sites More sharing options...
ZapterX Posted March 25, 2014 Author Share Posted March 25, 2014 I tried running that in gradlew.bat but it would not allow me to type, it auto closed. Quote Link to comment Share on other sites More sharing options...
tiffit Posted March 25, 2014 Share Posted March 25, 2014 This is from the snowball class and might be what your looking for. Just put this in your class for the gun. You probably need to change this around because whenever you right click, the gun dissapears too. /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntitySnowball(par2World, par3EntityPlayer)); } return par1ItemStack; } Quote Link to comment Share on other sites More sharing options...
Numbers32 Posted March 25, 2014 Share Posted March 25, 2014 Here's a tutorial that I found out to come in handy with creating a rifle/gun. http://www.minecraftforge.net/wiki/Tutorials/Basic_Shooter_Item_-_Blaster_Rifle Might help you out as well. Quote Link to comment Share on other sites More sharing options...
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.