• 0

    posted a message on Looking for some advanced tutorials...
    Where i can find some advanced tutorials(like OpenGL,Custom models for entitys,creation of sounds)?
    And sorry for bad inglish.
    Posted in: Modification Development
  • 0

    posted a message on How i can create a new song?
    Which program i can use to create a new song?
    Posted in: Modification Development
  • 0

    posted a message on How to make a gun/ammo system? (ModLoader)
    Quote from hiloser12221

    Oh yeah, for the entity thing, use this code to spawn in the entity (if using my entitybullet code)

    par2World.spawnEntityInWorld(new EntityBullet(par2World, par3EntityPlayer, damage, accuracy));

    The parameters damage and accuracy are ints, so add those parameters to the ItemGun constructor. Your ItemGun class should have 2 private ints (damage and accuracy) and the constructor should include the ints like this:
    public class ItemGun extends Item implements ITextureProvider
    {
    	private int damage;
    	private int accuracy;
    	private Item clip;
    	private int rateOfFire;
    	private int recoil;
    	private int reloadTime;
    	private int shootDelay;
    	public String type;
    	private String sound;
    	private static boolean mouseHeld;
    	private static boolean lastMouseHeld;
    
    	/**
    	 *
    	 * @param i the id of the gun
    	 * @param l damage of bullte (in half hears)
    	 * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    	 * @param item bullet (or might be changed to clip) that provides ammo
    	 * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    	 * @param j recoil of gun
    	 * @param k reload time of gun in ticks
    	 * @param p time between shots
    	 * @param type type of gun, can't seem to get this to do anything
    	 * @param s sound the gun plays, again I can't seem to get this to do anything
    	 */
    	public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    	{
    		super(i);
    		maxStackSize = 1;
    		damage = l;
    		//TODO fix the accuracy not having affect
    		accuracy = i1;
    		clip = item;
    		rateOfFire = rof;
    		recoil = j;
    		reloadTime = k;
    		shootDelay = p;
    		type = s;
    		sound = s1;
    	}


    Edit: that ITextureProvider is only if you are using forge.

    This work(In ModLoader)?:
    EntityBullet:
    package net.minecraft.src;
    import java.util.List;
    import java.util.Random;
    public class EntityBullet extends Entity
    {
    	 private int xTile;
    	 private int yTile;
    	 private int zTile;
    	 private int inTile;
    	 private int inData;
    	 private boolean inGround;
    	 public boolean doesArrowBelongToPlayer;
    	 /** Seems to be some sort of timer for animating an arrow. */
    	 public int arrowShake;
    	 /** The owner of this arrow. */
    	 public Entity shootingEntity;
    	 private int ticksInGround;
    	 private int ticksInAir;
    	 private double damage;
    	 private int field_46027_au;
    	 /** Is this arrow a critical hit? (Controls particles and damage) */
    	 public boolean arrowCritical;
    	 public EntityBullet(World par1World)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 setSize(0.5F, 0.5F);
    	 }
    	 public EntityBullet(World par1World, double par2, double par4, double par6)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 setSize(0.5F, 0.5F);
    			 setPosition(par2, par4, par6);
    			 yOffset = 0.0F;
    	 }
    	 public EntityBullet(World par1World, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, float par4, float par5)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 shootingEntity = par2EntityLiving;
    			 doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
    			 posY = (par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight()) - 0.10000000149011612D;
    			 double d = par3EntityLiving.posX - par2EntityLiving.posX;
    			 double d1 = (par3EntityLiving.posY + (double)par3EntityLiving.getEyeHeight()) - 0.69999998807907104D - posY;
    			 double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ;
    			 double d3 = MathHelper.sqrt_double(d * d + d2 * d2);
    			 if (d3 < 9.9999999999999995E-008D)
    			 {
    					 return;
    			 }
    			 else
    			 {
    					 float f = (float)((Math.atan2(d2, d) * 180D) / Math.PI) - 90F;
    					 float f1 = (float)(-((Math.atan2(d1, d3) * 180D) / Math.PI));
    					 double d4 = d / d3;
    					 double d5 = d2 / d3;
    					 setLocationAndAngles(par2EntityLiving.posX + d4, posY, par2EntityLiving.posZ + d5, f, f1);
    					 yOffset = 0.0F;
    					 float f2 = (float)d3 * 0.2F;
    					 setArrowHeading(d, d1 + (double)f2, d2, par4, par5);
    					 return;
    			 }
    	 }
    	 public EntityBullet(World par1World, EntityLiving par2EntityLiving, float par3, double damageValue, String type)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = damageValue;
    			 arrowCritical = false;
    			 shootingEntity = par2EntityLiving;
    			 doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
    			 if(type.equals("Normal")){
    
    setSize(0.1F, 0.1F);
    
    }else if(type.equals("Shotgun")){
    
    setSize(0.25F, 0.25F);
    
    }else{
    
    setSize(0.1F, 0.1F);
    }
    			 setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
    			 posX -= MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
    			 posY -= 0.10000000149011612D;
    			 posZ -= MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
    			 setPosition(posX, posY, posZ);
    			 yOffset = 0.0F;
    			 motionX = -MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
    			 motionZ = MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
    			 motionY = -MathHelper.sin((rotationPitch / 180F) * (float)Math.PI);
    			 setArrowHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
    	 }
    	 protected void entityInit()
    	 {
    	 }
    	 /**
    		 * Uses the provided coordinates as a heading and determines the velocity from it with the set force and random
    		 * variance. Args: x, y, z, force, forceVariation
    		 */
    	 public void setArrowHeading(double par1, double par3, double par5, float par7, float par8)
    	 {
    			 float f = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
    			 par1 /= f;
    			 par3 /= f;
    			 par5 /= f;
    			 par1 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par3 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par5 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par1 *= par7;
    			 par3 *= par7;
    			 par5 *= par7;
    			 motionX = par1;
    			 motionY = par3;
    			 motionZ = par5;
    			 float f1 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
    			 prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
    			 prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f1) * 180D) / Math.PI);
    			 ticksInGround = 0;
    	 }
    	 /**
    		 * Sets the velocity to the args. Args: x, y, z
    		 */
    	 public void setVelocity(double par1, double par3, double par5)
    	 {
    			 motionX = par1;
    			 motionY = par3;
    			 motionZ = par5;
    			 if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
    			 {
    					 float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
    					 prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch;
    					 prevRotationYaw = rotationYaw;
    					 setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
    					 ticksInGround = 0;
    			 }
    	 }
    	 /**
    		 * Called to update the entity's position/logic.
    		 */
    	 public void onUpdate()
    	 {
    			 super.onUpdate();
    			 if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
    			 {
    					 float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    					 prevRotationYaw = rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch = (float)((Math.atan2(motionY, f) * 180D) / Math.PI);
    			 }
    			 int i = worldObj.getBlockId(xTile, yTile, zTile);
    			 if (i > 0)
    			 {
    					 Block.blocksList[i].setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
    					 AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
    					 if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3D.createVector(posX, posY, posZ)))
    					 {
    							 //inGround = true;
    						 setDead();
    					 }
    			 }
    			 if (arrowShake > 0)
    			 {
    					 arrowShake--;
    			 }
    			 if (inGround)
    			 {
    					 int j = worldObj.getBlockId(xTile, yTile, zTile);
    					 int k = worldObj.getBlockMetadata(xTile, yTile, zTile);
    					 if (j != inTile || k != inData)
    					 {
    							 inGround = false;
    							 motionX *= rand.nextFloat() * 0.2F;
    							 motionY *= rand.nextFloat() * 0.2F;
    							 motionZ *= rand.nextFloat() * 0.2F;
    							 ticksInGround = 0;
    							 ticksInAir = 0;
    							 return;
    					 }
    					 ticksInGround++;
    					 if (ticksInGround <= 0)
    					 {
    							 setDead();
    					 }
    					 return;
    			 }
    			 ticksInAir++;
    			 Vec3D vec3d = Vec3D.createVector(posX, posY, posZ);
    			 Vec3D vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
    			 MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks_do_do(vec3d, vec3d1, false, true);
    			 vec3d = Vec3D.createVector(posX, posY, posZ);
    			 vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
    			 if (movingobjectposition != null)
    			 {
    					 vec3d1 = Vec3D.createVector(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
    			 }
    			 Entity entity = null;
    			 List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
    			 double d = 0.0D;
    			 for (int l = 0; l < list.size(); l++)
    			 {
    					 Entity entity1 = (Entity)list.get(l);
    					 if (!entity1.canBeCollidedWith() || entity1 == shootingEntity && ticksInAir < 5)
    					 {
    							 continue;
    					 }
    					 float f5 = 0.3F;
    					 AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f5, f5, f5);
    					 MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);
    					 if (movingobjectposition1 == null)
    					 {
    							 continue;
    					 }
    					 double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
    					 if (d1 < d || d == 0.0D)
    					 {
    							 entity = entity1;
    							 d = d1;
    					 }
    			 }
    			 if (entity != null)
    			 {
    					 movingobjectposition = new MovingObjectPosition(entity);
    			 }
    			 if (movingobjectposition != null)
    			 {
    					 if (movingobjectposition.entityHit != null)
    					 {
    							 float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
    							 int j1 = (int)Math.ceil((double)f1 * damage);
    							 if (arrowCritical)
    							 {
    									 j1 += rand.nextInt(j1 / 2 + 2);
    							 }
    							 DamageSource damagesource = null;
    							 if (shootingEntity == null)
    							 {
    									 damagesource = DamageSource.causeThrownDamage(this, this);
    							 }
    							 else
    							 {
    									 damagesource = DamageSource.causeThrownDamage(this, shootingEntity);
    							 }
    							 if (isBurning())
    							 {
    									 movingobjectposition.entityHit.setFire(5);
    							 }
    							 if (movingobjectposition.entityHit.attackEntityFrom(damagesource, j1))
    							 {
    									 if (movingobjectposition.entityHit instanceof EntityLiving)
    									 {
    											 ((EntityLiving)movingobjectposition.entityHit).arrowHitTempCounter++;
    											 if (field_46027_au > 0)
    											 {
    													 float f7 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    													 if (f7 > 0.0F)
    													 {
    															 movingobjectposition.entityHit.addVelocity((motionX * (double)field_46027_au * 0.60000002384185791D) / (double)f7, 0.10000000000000001D, (motionZ * (double)field_46027_au * 0.60000002384185791D) / (double)f7);
    													 }
    											 }
    									 }
    									 setDead();
    							 }
    							 else
    							 {
    									 motionX *= -0.10000000149011612D;
    									 motionY *= -0.10000000149011612D;
    									 motionZ *= -0.10000000149011612D;
    									 rotationYaw += 180F;
    									 prevRotationYaw += 180F;
    									 ticksInAir = 0;
    							 }
    					 }
    					 else
    					 {
    							 xTile = movingobjectposition.blockX;
    							 yTile = movingobjectposition.blockY;
    							 zTile = movingobjectposition.blockZ;
    							 inTile = worldObj.getBlockId(xTile, yTile, zTile);
    							 inData = worldObj.getBlockMetadata(xTile, yTile, zTile);
    							 motionX = (float)(movingobjectposition.hitVec.xCoord - posX);
    							 motionY = (float)(movingobjectposition.hitVec.yCoord - posY);
    							 motionZ = (float)(movingobjectposition.hitVec.zCoord - posZ);
    							 float f2 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
    							 posX -= (motionX / (double)f2) * 0.05000000074505806D;
    							 posY -= (motionY / (double)f2) * 0.05000000074505806D;
    							 posZ -= (motionZ / (double)f2) * 0.05000000074505806D;
    							 setDead();
    							 arrowShake = 7;
    							 arrowCritical = false;
    					 }
    			 }
    			 if (arrowCritical)
    			 {
    					 for (int i1 = 0; i1 < 4; i1++)
    					 {
    							 worldObj.spawnParticle("crit", posX + (motionX * (double)i1) / 4D, posY + (motionY * (double)i1) / 4D, posZ + (motionZ * (double)i1) / 4D, -motionX, -motionY + 0.20000000000000001D, -motionZ);
    					 }
    			 }
    			 posX += motionX;
    			 posY += motionY;
    			 posZ += motionZ;
    			 float f3 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    			 rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
    			 for (rotationPitch = (float)((Math.atan2(motionY, f3) * 180D) / Math.PI); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) { }
    			 for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) { }
    			 for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) { }
    			 for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) { }
    			 rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
    			 rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
    			 float f4 = 0.99F;
    			 float f6 = 0.05F;
    			 if (isInWater())
    			 {
    					 for (int k1 = 0; k1 < 4; k1++)
    					 {
    							 float f8 = 0.25F;
    							 worldObj.spawnParticle("bubble", posX - motionX * (double)f8, posY - motionY * (double)f8, posZ - motionZ * (double)f8, motionX, motionY, motionZ);
    					 }
    					 f4 = 0.8F;
    			 }
    			 motionX *= f4;
    			 motionY *= f4;
    			 motionZ *= f4;
    			 motionY -= f6;
    			 setPosition(posX, posY, posZ);
    	 }
    	 /**
    		 * (abstract) Protected helper method to write subclass entity data to NBT.
    		 */
    	 public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    	 {
    			 par1NBTTagCompound.setShort("xTile", (short)xTile);
    			 par1NBTTagCompound.setShort("yTile", (short)yTile);
    			 par1NBTTagCompound.setShort("zTile", (short)zTile);
    			 par1NBTTagCompound.setByte("inTile", (byte)inTile);
    			 par1NBTTagCompound.setByte("inData", (byte)inData);
    			 par1NBTTagCompound.setByte("shake", (byte)arrowShake);
    			 par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
    			 par1NBTTagCompound.setBoolean("player", doesArrowBelongToPlayer);
    			 par1NBTTagCompound.setDouble("damage", damage);
    	 }
    	 /**
    		 * (abstract) Protected helper method to read subclass entity data from NBT.
    		 */
    	 public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    	 {
    			 xTile = par1NBTTagCompound.getShort("xTile");
    			 yTile = par1NBTTagCompound.getShort("yTile");
    			 zTile = par1NBTTagCompound.getShort("zTile");
    			 inTile = par1NBTTagCompound.getByte("inTile") & 0xff;
    			 inData = par1NBTTagCompound.getByte("inData") & 0xff;
    			 arrowShake = par1NBTTagCompound.getByte("shake") & 0xff;
    			 inGround = par1NBTTagCompound.getByte("inGround") == 1;
    			 doesArrowBelongToPlayer = par1NBTTagCompound.getBoolean("player");
    			 if (par1NBTTagCompound.hasKey("damage"))
    			 {
    					 damage = par1NBTTagCompound.getDouble("damage");
    			 }
    	 }
    	 /**
    		 * Called by a player entity when they collide with an entity
    		 */
    	 public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
    	 {
    			 if (worldObj.isRemote)
    			 {
    					 return;
    			 }
    			 if (inGround && doesArrowBelongToPlayer && arrowShake <= 0 && par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1)))
    			 {
    					 par1EntityPlayer.onItemPickup(this, 1);
    					 setDead();
    			 }
    	 }
    	 public float getShadowSize()
    	 {
    			 return 0.0F;
    	 }
    	 public void setDamage(double par1)
    	 {
    			 damage = par1;
    	 }
    	 public double getDamage()
    	 {
    			 return damage;
    	 }
    	 public void func_46023_b(int par1)
    	 {
    			 field_46027_au = par1;
    	 }
    	 /**
    		 * If returns false, the item will not inflict any damage against entities.
    		 */
    	 public boolean canAttackWithItem()
    	 {
    			 return false;
    	 }
    }

    ItemGun:
    public class ItemGun extends Item implements
    {
    	 private int damage;
    	 private int accuracy;
    	 private Item clip;
    	 private int rateOfFire;
    	 private int recoil;
    	 private int reloadTime;
    	 private int shootDelay;
    	 public String type;
    	 private String sound;
    	 private static boolean mouseHeld;
    	 private static boolean lastMouseHeld;
    	 /**
    		 *
    		 * @param i the id of the gun
    		 * @param l damage of bullte (in half hears)
    		 * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    		 * @param item bullet (or might be changed to clip) that provides ammo
    		 * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    		 * @param j recoil of gun
    		 * @param k reload time of gun in ticks
    		 * @param p time between shots
    		 * @param type type of gun, can't seem to get this to do anything
    		 * @param s sound the gun plays, again I can't seem to get this to do anything
    		 */
    	 public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    	 {
    			 super(i);
    			 maxStackSize = 1;
    			 damage = l;
    			 //TODO fix the accuracy not having affect
    			 accuracy = i1;
    			 clip = item;
    			 rateOfFire = rof;
    			 recoil = j;
    			 reloadTime = k;
    			 shootDelay = p;
    			 type = s;
    			 sound = s1;
    	 }

    Mod_*****:
    package net.minecraft.src;
    public class mod_***** extends BaseMod{
    public static final Item pistolclip = new Item(386).setItemName("Pistol Clip");
    public static final Item pistol = new ItemGun(387, (byte)5).setItemName("Gun");
    public void load(){
    
    pistolclip.iconIndex = ModLoader.addOverride("/gui/items.png", "/zombiecraft/Item/magnum.png");
    pistol.iconIndex = ModLoader.addOverride("/gui/items.png", "/zombiecraft/Item/magnum.png");
    
    ModLoader.addName(pistolclip, "Pistol Mag");
    ModLoader.addName(pistol, "Magnum");
    
    //I added some 'Cheat' recipies XD. Just so I don't have to get resources in survival to test lol
    ModLoader.addRecipe(new ItemStack(Item.ingotIron, 64), new Object[]{
    
    "##", Character.valueOf('#'), Block.dirt
    });
    ModLoader.addRecipe(new ItemStack(Item.gunpowder, 64), new Object[]{
    
    " # ", "###", "###", Character.valueOf('#'), Block.dirt
    });
    
    ModLoader.addShapelessRecipe(new ItemStack(pistolclip, 10), new Object[]{
    
    Item.gunpowder, Item.ingotIron
    });
    
    ModLoader.addRecipe(new ItemStack(pistol, 1), new Object[]{
    
    "###", " #", " #", Character.valueOf('#'), Item.ingotIron
    });
    }
    public String getVersion(){
    
    return "1.2.5";
    }
    }


    I will change somethings,like names rates of speed,but...

    public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    {
    super(i);
    maxStackSize = 1;
    damage = l;
    //This works in ModLoader?
    accuracy = i1; //All this things will work Normaly?
    clip = item;
    rateOfFire = rof;
    recoil = j;
    reloadTime = k;
    shootDelay = p;
    type = s;
    sound = s1;
    }
    This will work?:
    super(i);
    maxStackSize = 1;
    damage = 5;
    accuracy = 11; //This works?
    clip = 7;
    rateOfFire = 10;
    recoil = 10;
    reloadTime = 12;
    shootDelay = 10;
    type = s;
    sound = s1
    Thank you and
    sorry for my bad inglish
    Quote from hiloser12221

    Oh yeah, for the entity thing, use this code to spawn in the entity (if using my entitybullet code)

    par2World.spawnEntityInWorld(new EntityBullet(par2World, par3EntityPlayer, damage, accuracy));

    The parameters damage and accuracy are ints, so add those parameters to the ItemGun constructor. Your ItemGun class should have 2 private ints (damage and accuracy) and the constructor should include the ints like this:
    public class ItemGun extends Item implements
    {
    	private int damage;
    	private int accuracy;
    	private Item clip;
    	private int rateOfFire;
    	private int recoil;
    	private int reloadTime;
    	private int shootDelay;
    	public String type;
    	private String sound;
    	private static boolean mouseHeld;
    	private static boolean lastMouseHeld;
    
    	/**
    	 *
    	 * @param i the id of the gun
    	 * @param l damage of bullte (in half hears)
    	 * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    	 * @param item bullet (or might be changed to clip) that provides ammo
    	 * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    	 * @param j recoil of gun
    	 * @param k reload time of gun in ticks
    	 * @param p time between shots
    	 * @param type type of gun, can't seem to get this to do anything
    	 * @param s sound the gun plays, again I can't seem to get this to do anything
    	 */
    	public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    	{
    		super(i);
    		maxStackSize = 1;
    		damage = l;
    		//TODO fix the accuracy not having affect
    		accuracy = i1;
    		clip = item;
    		rateOfFire = rof;
    		recoil = j;
    		reloadTime = k;
    		shootDelay = p;
    		type = s;
    		sound = s1;
    	}


    Edit: that ITextureProvider is only if you are using forge.

    This work(In ModLoader)?:
    EntityBullet:
    package net.minecraft.src;
    import java.util.List;
    import java.util.Random;
    public class EntityBullet extends Entity
    {
    	 private int xTile;
    	 private int yTile;
    	 private int zTile;
    	 private int inTile;
    	 private int inData;
    	 private boolean inGround;
    	 public boolean doesArrowBelongToPlayer;
    	 /** Seems to be some sort of timer for animating an arrow. */
    	 public int arrowShake;
    	 /** The owner of this arrow. */
    	 public Entity shootingEntity;
    	 private int ticksInGround;
    	 private int ticksInAir;
    	 private double damage;
    	 private int field_46027_au;
    	 /** Is this arrow a critical hit? (Controls particles and damage) */
    	 public boolean arrowCritical;
    	 public EntityBullet(World par1World)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 setSize(0.5F, 0.5F);
    	 }
    	 public EntityBullet(World par1World, double par2, double par4, double par6)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 setSize(0.5F, 0.5F);
    			 setPosition(par2, par4, par6);
    			 yOffset = 0.0F;
    	 }
    	 public EntityBullet(World par1World, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, float par4, float par5)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = 2D;
    			 arrowCritical = false;
    			 shootingEntity = par2EntityLiving;
    			 doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
    			 posY = (par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight()) - 0.10000000149011612D;
    			 double d = par3EntityLiving.posX - par2EntityLiving.posX;
    			 double d1 = (par3EntityLiving.posY + (double)par3EntityLiving.getEyeHeight()) - 0.69999998807907104D - posY;
    			 double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ;
    			 double d3 = MathHelper.sqrt_double(d * d + d2 * d2);
    			 if (d3 < 9.9999999999999995E-008D)
    			 {
    					 return;
    			 }
    			 else
    			 {
    					 float f = (float)((Math.atan2(d2, d) * 180D) / Math.PI) - 90F;
    					 float f1 = (float)(-((Math.atan2(d1, d3) * 180D) / Math.PI));
    					 double d4 = d / d3;
    					 double d5 = d2 / d3;
    					 setLocationAndAngles(par2EntityLiving.posX + d4, posY, par2EntityLiving.posZ + d5, f, f1);
    					 yOffset = 0.0F;
    					 float f2 = (float)d3 * 0.2F;
    					 setArrowHeading(d, d1 + (double)f2, d2, par4, par5);
    					 return;
    			 }
    	 }
    	 public EntityBullet(World par1World, EntityLiving par2EntityLiving, float par3, double damageValue, String type)
    	 {
    			 super(par1World);
    			 xTile = -1;
    			 yTile = -1;
    			 zTile = -1;
    			 inTile = 0;
    			 inData = 0;
    			 inGround = false;
    			 doesArrowBelongToPlayer = false;
    			 arrowShake = 0;
    			 ticksInAir = 0;
    			 damage = damageValue;
    			 arrowCritical = false;
    			 shootingEntity = par2EntityLiving;
    			 doesArrowBelongToPlayer = par2EntityLiving instanceof EntityPlayer;
    			 if(type.equals("Normal")){
    
    setSize(0.1F, 0.1F);
    
    }else if(type.equals("Shotgun")){
    
    setSize(0.25F, 0.25F);
    
    }else{
    
    setSize(0.1F, 0.1F);
    }
    			 setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
    			 posX -= MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
    			 posY -= 0.10000000149011612D;
    			 posZ -= MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * 0.16F;
    			 setPosition(posX, posY, posZ);
    			 yOffset = 0.0F;
    			 motionX = -MathHelper.sin((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
    			 motionZ = MathHelper.cos((rotationYaw / 180F) * (float)Math.PI) * MathHelper.cos((rotationPitch / 180F) * (float)Math.PI);
    			 motionY = -MathHelper.sin((rotationPitch / 180F) * (float)Math.PI);
    			 setArrowHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
    	 }
    	 protected void entityInit()
    	 {
    	 }
    	 /**
    		 * Uses the provided coordinates as a heading and determines the velocity from it with the set force and random
    		 * variance. Args: x, y, z, force, forceVariation
    		 */
    	 public void setArrowHeading(double par1, double par3, double par5, float par7, float par8)
    	 {
    			 float f = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
    			 par1 /= f;
    			 par3 /= f;
    			 par5 /= f;
    			 par1 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par3 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par5 += rand.nextGaussian() * 0.0074999998323619366D * (double)par8;
    			 par1 *= par7;
    			 par3 *= par7;
    			 par5 *= par7;
    			 motionX = par1;
    			 motionY = par3;
    			 motionZ = par5;
    			 float f1 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
    			 prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
    			 prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f1) * 180D) / Math.PI);
    			 ticksInGround = 0;
    	 }
    	 /**
    		 * Sets the velocity to the args. Args: x, y, z
    		 */
    	 public void setVelocity(double par1, double par3, double par5)
    	 {
    			 motionX = par1;
    			 motionY = par3;
    			 motionZ = par5;
    			 if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
    			 {
    					 float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
    					 prevRotationYaw = rotationYaw = (float)((Math.atan2(par1, par5) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch = (float)((Math.atan2(par3, f) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch;
    					 prevRotationYaw = rotationYaw;
    					 setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
    					 ticksInGround = 0;
    			 }
    	 }
    	 /**
    		 * Called to update the entity's position/logic.
    		 */
    	 public void onUpdate()
    	 {
    			 super.onUpdate();
    			 if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
    			 {
    					 float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    					 prevRotationYaw = rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
    					 prevRotationPitch = rotationPitch = (float)((Math.atan2(motionY, f) * 180D) / Math.PI);
    			 }
    			 int i = worldObj.getBlockId(xTile, yTile, zTile);
    			 if (i > 0)
    			 {
    					 Block.blocksList[i].setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
    					 AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
    					 if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3D.createVector(posX, posY, posZ)))
    					 {
    							 //inGround = true;
    						 setDead();
    					 }
    			 }
    			 if (arrowShake > 0)
    			 {
    					 arrowShake--;
    			 }
    			 if (inGround)
    			 {
    					 int j = worldObj.getBlockId(xTile, yTile, zTile);
    					 int k = worldObj.getBlockMetadata(xTile, yTile, zTile);
    					 if (j != inTile || k != inData)
    					 {
    							 inGround = false;
    							 motionX *= rand.nextFloat() * 0.2F;
    							 motionY *= rand.nextFloat() * 0.2F;
    							 motionZ *= rand.nextFloat() * 0.2F;
    							 ticksInGround = 0;
    							 ticksInAir = 0;
    							 return;
    					 }
    					 ticksInGround++;
    					 if (ticksInGround <= 0)
    					 {
    							 setDead();
    					 }
    					 return;
    			 }
    			 ticksInAir++;
    			 Vec3D vec3d = Vec3D.createVector(posX, posY, posZ);
    			 Vec3D vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
    			 MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks_do_do(vec3d, vec3d1, false, true);
    			 vec3d = Vec3D.createVector(posX, posY, posZ);
    			 vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
    			 if (movingobjectposition != null)
    			 {
    					 vec3d1 = Vec3D.createVector(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
    			 }
    			 Entity entity = null;
    			 List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
    			 double d = 0.0D;
    			 for (int l = 0; l < list.size(); l++)
    			 {
    					 Entity entity1 = (Entity)list.get(l);
    					 if (!entity1.canBeCollidedWith() || entity1 == shootingEntity && ticksInAir < 5)
    					 {
    							 continue;
    					 }
    					 float f5 = 0.3F;
    					 AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f5, f5, f5);
    					 MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);
    					 if (movingobjectposition1 == null)
    					 {
    							 continue;
    					 }
    					 double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
    					 if (d1 < d || d == 0.0D)
    					 {
    							 entity = entity1;
    							 d = d1;
    					 }
    			 }
    			 if (entity != null)
    			 {
    					 movingobjectposition = new MovingObjectPosition(entity);
    			 }
    			 if (movingobjectposition != null)
    			 {
    					 if (movingobjectposition.entityHit != null)
    					 {
    							 float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
    							 int j1 = (int)Math.ceil((double)f1 * damage);
    							 if (arrowCritical)
    							 {
    									 j1 += rand.nextInt(j1 / 2 + 2);
    							 }
    							 DamageSource damagesource = null;
    							 if (shootingEntity == null)
    							 {
    									 damagesource = DamageSource.causeThrownDamage(this, this);
    							 }
    							 else
    							 {
    									 damagesource = DamageSource.causeThrownDamage(this, shootingEntity);
    							 }
    							 if (isBurning())
    							 {
    									 movingobjectposition.entityHit.setFire(5);
    							 }
    							 if (movingobjectposition.entityHit.attackEntityFrom(damagesource, j1))
    							 {
    									 if (movingobjectposition.entityHit instanceof EntityLiving)
    									 {
    											 ((EntityLiving)movingobjectposition.entityHit).arrowHitTempCounter++;
    											 if (field_46027_au > 0)
    											 {
    													 float f7 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    													 if (f7 > 0.0F)
    													 {
    															 movingobjectposition.entityHit.addVelocity((motionX * (double)field_46027_au * 0.60000002384185791D) / (double)f7, 0.10000000000000001D, (motionZ * (double)field_46027_au * 0.60000002384185791D) / (double)f7);
    													 }
    											 }
    									 }
    									 setDead();
    							 }
    							 else
    							 {
    									 motionX *= -0.10000000149011612D;
    									 motionY *= -0.10000000149011612D;
    									 motionZ *= -0.10000000149011612D;
    									 rotationYaw += 180F;
    									 prevRotationYaw += 180F;
    									 ticksInAir = 0;
    							 }
    					 }
    					 else
    					 {
    							 xTile = movingobjectposition.blockX;
    							 yTile = movingobjectposition.blockY;
    							 zTile = movingobjectposition.blockZ;
    							 inTile = worldObj.getBlockId(xTile, yTile, zTile);
    							 inData = worldObj.getBlockMetadata(xTile, yTile, zTile);
    							 motionX = (float)(movingobjectposition.hitVec.xCoord - posX);
    							 motionY = (float)(movingobjectposition.hitVec.yCoord - posY);
    							 motionZ = (float)(movingobjectposition.hitVec.zCoord - posZ);
    							 float f2 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
    							 posX -= (motionX / (double)f2) * 0.05000000074505806D;
    							 posY -= (motionY / (double)f2) * 0.05000000074505806D;
    							 posZ -= (motionZ / (double)f2) * 0.05000000074505806D;
    							 setDead();
    							 arrowShake = 7;
    							 arrowCritical = false;
    					 }
    			 }
    			 if (arrowCritical)
    			 {
    					 for (int i1 = 0; i1 < 4; i1++)
    					 {
    							 worldObj.spawnParticle("crit", posX + (motionX * (double)i1) / 4D, posY + (motionY * (double)i1) / 4D, posZ + (motionZ * (double)i1) / 4D, -motionX, -motionY + 0.20000000000000001D, -motionZ);
    					 }
    			 }
    			 posX += motionX;
    			 posY += motionY;
    			 posZ += motionZ;
    			 float f3 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    			 rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
    			 for (rotationPitch = (float)((Math.atan2(motionY, f3) * 180D) / Math.PI); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) { }
    			 for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) { }
    			 for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) { }
    			 for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) { }
    			 rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
    			 rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
    			 float f4 = 0.99F;
    			 float f6 = 0.05F;
    			 if (isInWater())
    			 {
    					 for (int k1 = 0; k1 < 4; k1++)
    					 {
    							 float f8 = 0.25F;
    							 worldObj.spawnParticle("bubble", posX - motionX * (double)f8, posY - motionY * (double)f8, posZ - motionZ * (double)f8, motionX, motionY, motionZ);
    					 }
    					 f4 = 0.8F;
    			 }
    			 motionX *= f4;
    			 motionY *= f4;
    			 motionZ *= f4;
    			 motionY -= f6;
    			 setPosition(posX, posY, posZ);
    	 }
    	 /**
    		 * (abstract) Protected helper method to write subclass entity data to NBT.
    		 */
    	 public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    	 {
    			 par1NBTTagCompound.setShort("xTile", (short)xTile);
    			 par1NBTTagCompound.setShort("yTile", (short)yTile);
    			 par1NBTTagCompound.setShort("zTile", (short)zTile);
    			 par1NBTTagCompound.setByte("inTile", (byte)inTile);
    			 par1NBTTagCompound.setByte("inData", (byte)inData);
    			 par1NBTTagCompound.setByte("shake", (byte)arrowShake);
    			 par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
    			 par1NBTTagCompound.setBoolean("player", doesArrowBelongToPlayer);
    			 par1NBTTagCompound.setDouble("damage", damage);
    	 }
    	 /**
    		 * (abstract) Protected helper method to read subclass entity data from NBT.
    		 */
    	 public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    	 {
    			 xTile = par1NBTTagCompound.getShort("xTile");
    			 yTile = par1NBTTagCompound.getShort("yTile");
    			 zTile = par1NBTTagCompound.getShort("zTile");
    			 inTile = par1NBTTagCompound.getByte("inTile") & 0xff;
    			 inData = par1NBTTagCompound.getByte("inData") & 0xff;
    			 arrowShake = par1NBTTagCompound.getByte("shake") & 0xff;
    			 inGround = par1NBTTagCompound.getByte("inGround") == 1;
    			 doesArrowBelongToPlayer = par1NBTTagCompound.getBoolean("player");
    			 if (par1NBTTagCompound.hasKey("damage"))
    			 {
    					 damage = par1NBTTagCompound.getDouble("damage");
    			 }
    	 }
    	 /**
    		 * Called by a player entity when they collide with an entity
    		 */
    	 public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
    	 {
    			 if (worldObj.isRemote)
    			 {
    					 return;
    			 }
    			 if (inGround && doesArrowBelongToPlayer && arrowShake <= 0 && par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1)))
    			 {
    					 par1EntityPlayer.onItemPickup(this, 1);
    					 setDead();
    			 }
    	 }
    	 public float getShadowSize()
    	 {
    			 return 0.0F;
    	 }
    	 public void setDamage(double par1)
    	 {
    			 damage = par1;
    	 }
    	 public double getDamage()
    	 {
    			 return damage;
    	 }
    	 public void func_46023_b(int par1)
    	 {
    			 field_46027_au = par1;
    	 }
    	 /**
    		 * If returns false, the item will not inflict any damage against entities.
    		 */
    	 public boolean canAttackWithItem()
    	 {
    			 return false;
    	 }
    }

    ItemGun:
    public class ItemGun extends Item implements
    {
    	 private int damage;
    	 private int accuracy;
    	 private Item clip;
    	 private int rateOfFire;
    	 private int recoil;
    	 private int reloadTime;
    	 private int shootDelay;
    	 public String type;
    	 private String sound;
    	 private static boolean mouseHeld;
    	 private static boolean lastMouseHeld;
    	 /**
    		 *
    		 * @param i the id of the gun
    		 * @param l damage of bullte (in half hears)
    		 * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    		 * @param item bullet (or might be changed to clip) that provides ammo
    		 * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    		 * @param j recoil of gun
    		 * @param k reload time of gun in ticks
    		 * @param p time between shots
    		 * @param type type of gun, can't seem to get this to do anything
    		 * @param s sound the gun plays, again I can't seem to get this to do anything
    		 */
    	 public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    	 {
    			 super(i);
    			 maxStackSize = 1;
    			 damage = l;
    			 //TODO fix the accuracy not having affect
    			 accuracy = i1;
    			 clip = item;
    			 rateOfFire = rof;
    			 recoil = j;
    			 reloadTime = k;
    			 shootDelay = p;
    			 type = s;
    			 sound = s1;
    	 }

    Mod_*****:
    package net.minecraft.src;
    public class mod_***** extends BaseMod{
    public static final Item pistolclip = new Item(386).setItemName("Pistol Clip");
    public static final Item pistol = new ItemGun(387, (byte)5).setItemName("Gun");
    public void load(){
    
    pistolclip.iconIndex = ModLoader.addOverride("/gui/items.png", "/zombiecraft/Item/magnum.png");
    pistol.iconIndex = ModLoader.addOverride("/gui/items.png", "/zombiecraft/Item/magnum.png");
    
    ModLoader.addName(pistolclip, "Pistol Mag");
    ModLoader.addName(pistol, "Magnum");
    
    //I added some 'Cheat' recipies XD. Just so I don't have to get resources in survival to test lol
    ModLoader.addRecipe(new ItemStack(Item.ingotIron, 64), new Object[]{
    
    "##", Character.valueOf('#'), Block.dirt
    });
    ModLoader.addRecipe(new ItemStack(Item.gunpowder, 64), new Object[]{
    
    " # ", "###", "###", Character.valueOf('#'), Block.dirt
    });
    
    ModLoader.addShapelessRecipe(new ItemStack(pistolclip, 10), new Object[]{
    
    Item.gunpowder, Item.ingotIron
    });
    
    ModLoader.addRecipe(new ItemStack(pistol, 1), new Object[]{
    
    "###", " #", " #", Character.valueOf('#'), Item.ingotIron
    });
    }
    public String getVersion(){
    
    return "1.2.5";
    }
    }


    I will change somethings,like names rates of speed,but...

    public class ItemGun extends Item implements
    {
    private int damage;
    private int accuracy;
    private Item clip;
    private int rateOfFire;
    private int recoil;
    private int reloadTime;
    private int shootDelay;
    public String type;
    private String sound;
    private static boolean mouseHeld;
    private static boolean lastMouseHeld;

    /**
    *
    * @param i the id of the gun
    * @param l damage of bullte (in half hears)
    * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    * @param item bullet (or might be changed to clip) that provides ammo
    * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    * @param j recoil of gun
    * @param k reload time of gun in ticks
    * @param p time between shots
    * @param type type of gun, can't seem to get this to do anything
    * @param s sound the gun plays, again I can't seem to get this to do anything
    */

    public ItemGun(int i, int l, int i1, Item item, int rof, int j, int k, int p, String s, String s1)
    {
    super(i);
    maxStackSize = 1;
    damage = l;
    //This works in ModLoader?
    accuracy = i1; //All this things will work Normaly?
    clip = item;
    rateOfFire = rof;
    recoil = j;
    reloadTime = k;
    shootDelay = p;
    type = s;
    sound = s1;
    }
    This will work?:
    public class ItemGun extends Item implements
    {
    private int damage;
    private int accuracy;
    private Item clip;
    private int rateOfFire;
    private int recoil;
    private int reloadTime;
    private int shootDelay;
    public String type;
    private String sound;
    private static boolean mouseHeld;
    private static boolean lastMouseHeld;

    /**
    *
    * @param i the id of the gun
    * @param l damage of bullte (in half hears)
    * @param i1 accuracy of bullet (doesn't seem to be a factor, due to EntityBullet code
    * @param item bullet (or might be changed to clip) that provides ammo
    * @param rof rate of fire while the right mouse is being held down, doesn't do anything if rapid right click
    * @param j recoil of gun
    * @param k reload time of gun in ticks
    * @param p time between shots
    * @param type type of gun, can't seem to get this to do anything
    * @param s sound the gun plays, again I can't seem to get this to do anything
    */

    super(i);
    maxStackSize = 1;
    damage = 5;
    accuracy = 11; //This works?
    clip = 7;
    rateOfFire = 10;
    recoil = 10;
    reloadTime = 12;
    shootDelay = 10;
    type = s;
    sound = s1
    Thank you and
    sorry for my bad inglish
    Posted in: Modification Development
  • 0

    posted a message on How i can make the speed of spreading of a block faster?
    I are trying to make a TNT,the new TNT generate one block,this block spread(Very Fast) and after a time stop,like an explosion.
    Posted in: Modification Development
  • 0

    posted a message on How i can make the speed of spreading of a block faster?
    Quote from stevenrs11

    That fast? use scheduleblockupdate(x,y,z,blockid, time in ticks). Its in world.class Or, if you use modloader, there is the

    onTickInGame(float var1, Minecraft var2)

    method, but you have to have ModLoader.setInGameHook(this, true, true); in the load(). Not sure how to use it outside of your mod_****.class, though.

    If you use the setblockwithnotify(x,y,z,blockid) method to spread, you get massive lag with something spreading this fast. Also, wrap setblock with if(!remote) to help with crazy glitches.

    Sorry,but i don't know how i can make this...
    Posted in: Modification Development
  • 0

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    Quote from TheInstitution

    o problem, Im sure I could just whip up a written tutorial. Staring a new program..written tutorials by myself and some of my subscribers. That im sure will come up soon.

    Ok,
    thank you the insitutions.
    Your tutorials are awesomes and helped me so much...
    Posted in: Tutorials
  • 0

    posted a message on How i can make the speed of spreading of a block faster?
    How i can make a faster spread of a block(maybe 1/8 of a second)?
    And how i can make the spreading stop,after a time?
    Sorry for bad inglish...
    Posted in: Modification Development
  • 0

    posted a message on Learning to use OpenGL
    I have to learn OpenGL too,but i dont find a good tutorial too ;_;.
    Sorry for bad inglish
    Posted in: Modification Development
  • 0

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    The Instituitions,
    You can make a tutorial of how to create a new explosion.class and customize then(algorithns,% of drops)
    and how to use the new explosion.class in your TNT?
    Sorry for bad inglish.
    Posted in: Tutorials
  • 0

    posted a message on How i can make a new explosion algorthim?
    How i can make a new explosion algorithms(and customize them)?
    Posted in: Modification Development
  • 0

    posted a message on TNT rendering problem
    I have a problem in the render of a TNT,The TNT is spawned in the player position using an item,but doens't appears.
    files:
    mod_MoreTNTsAndExplosives:
    package net.minecraft.src;
    import java.util.Map;public class mod_MoreTNTsAndExplosives extends BaseMod
    { public static final Item MoabCaller = new MoabCaller(2100).setItemName("MoabCaller");
    public void load()
    {
    		 MoabCaller.iconIndex = ModLoader.addOverride("/gui/items.png", "/MoreTNTsAndExplosives/Items/MoabCaller.png");
    		 ModLoader.addName(MoabCaller, "Moab Caller");
    		 ModLoader.addRecipe(new ItemStack(MoabCaller, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
    }
    public static final Block MoabExplosive = (new MoabExplosive (null, 222, ModLoader.addOverride("/terrain.png", "/MoreTNTsAndExplosives/Blocks/Moab/Moab.png"), 0).setBlockName("MoabExplosive"));
    public void addRenderer(Map map)
    	
    	 {
    			
    			 map.put(EntityMoabPrimed.class, new RenderMoabExplosive());
    	 }
    public String getVersion()
    {
    								 return "1.3.2";
    }
    }

    EntityMoabPrimed:
    package net.minecraft.src;
    
    public class EntityMoabPrimed extends Entity
    {
    
    	 public EntityMoabPrimed (World world)
    	 {
    			 super(world);
    			 fuse = 0;
    			 preventEntitySpawning = true;
    			 setSize(0.98F, 0.98F);
    			 yOffset = height / 2.0F;
    	 }
    	
    	 public EntityMoabPrimed (World world, double d, double d1, double d2)
    	 {
    			 this(world);
    			 setPosition (d, d1, d2);
    			 float f = (float)(Math.random()* 3.141592741012732D * 2D);
    			 motionX = -MathHelper.sin((f * 3.141593F) / 180F) * 0.02F;
    			 motionY = 0.20000000298023224D;
    			 motionZ = -MathHelper.cos(( f * 3.141593F) / 180F) * 0.02F;
    			 fuse = 100;
    			 prevPosX = d;
    			 prevPosY = d1;
    			 prevPosZ = d2;
    	
    	
    	 }
    	
    	 protected void entityUnit()
    	 {
    			
    	 }
    	
    	 protected boolean canTriggerWalking()
    	 {
    			 return false;
    	 }
    
    	 public boolean canBeCollidedWith()
    	 {
    			 return !isDead;
    	 }
    
    	 public void onUpdate()
    	 {
    			
    			 prevPosX = posX;
    			 prevPosY = posY;
    			 prevPosZ = posZ;
    			 motionY -= 0.039999999105930328D;
    			 moveEntity(motionX, motionY, motionZ);
    			 motionX *= 0.98000001907348633D;
    			 motionY *= 0.98000001907348633D;
    			 motionZ *= 0.98000001907348633D;
    			
    			 if(onGround)
    			 {
    					 motionX *= 0.69999998807907104D;
    					 motionZ *= 0.69999998807907104D;
    					 motionY += -0.5D;
    			 }
    			
    	 if(fuse -- <= 0)
    	 {
    			 setDead();
    			 explode();
    	 }
    	 //CODE WRITTEN BY THEINSTITUTIONS
    	 else
    	 {
    			 worldObj.spawnParticle("", posX, posY + 0.5D, posZ, 0.0D, 0.0F, 0.0D);
    	 }
    	
    	 }
    
    	 private void explode()
    	 {
    			 float f = 2F; //Only 2F for testing
    			 worldObj.createExplosion(null, posX, posY, posZ, f);
    	 }
    	
    	 protected void writeEntityToNBT(NBTTagCompound tut)
    	 {
    			 tut.setByte("Fuse", (byte)fuse);
    	 }
    	
    	 protected void readEntityFromNBT(NBTTagCompound tut)
    	 {
    			 fuse = tut.getByte("Fuse");
    	 }
    	
    	 public float getShadowSize()
    	 {
    			 return 0.0F;
    	 }
    	
    	 public int fuse;
    
    	
    	 protected void entityInit()
    	 {
    	
    			
    	 }
    }

    RenderMoabExplosive:
    package net.minecraft.src;
    
    import org.lwjgl.opengl.GL11;
    
    public class RenderMoabExplosive extends Render
    {
    
    private RenderBlocks blockRenderer;
    
    public RenderMoabExplosive()
    {
    	 blockRenderer = new RenderBlocks();
    	 shadowSize = 0.5F;
    }
    
    public void func_153_a(EntityMoabPrimed entityfirebombprimed, double d, double d1, double d2,
    		 float f, float f1)
    {
    	 GL11.glPushMatrix();
    	 GL11.glTranslatef((float)d, (float)d1, (float)d2);
    	 if(((float)entityfirebombprimed.fuse - f1) + 1.0F < 10F)
    	 {
    		 float f2 = 1.0F - (((float)entityfirebombprimed.fuse - f1) + 1.0F) / 10F;
    		 if(f2 < 0.0F)
    		 {
    			 f2 = 0.0F;
    		 }
    		 if(f2 > 1.0F)
    		 {
    			 f2 = 1.0F;
    		 }
    		 f2 *= f2;
    		 f2 *= f2;
    		 float f4 = 1.0F + f2 * 0.3F;
    		 GL11.glScalef(f4, f4, f4);
    	 }
    	 float f3 = (1.0F - (((float)entityfirebombprimed.fuse - f1) + 1.0F) / 100F) * 0.8F;
    	 loadTexture("/terrain.png");
    	 blockRenderer.renderBlockAsItem(mod_MoreTNTsAndExplosives.MoabExplosive, 0, entityfirebombprimed.getBrightness(f1));
    	 if((entityfirebombprimed.fuse / 5) % 2 == 0)
    	 {
    		 GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    		 GL11.glDisable(2896 /*GL_LIGHTING*/);
    		 GL11.glEnable(3042 /*GL_BLEND*/);
    		 GL11.glBlendFunc(770, 772);
    		 GL11.glColor4f(1.0F, 1.0F, 1.0F, f3);
    		 blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);
    		 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    		 GL11.glDisable(3042 /*GL_BLEND*/);
    		 GL11.glEnable(2896 /*GL_LIGHTING*/);
    		 GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
    	 }
    	 GL11.glPopMatrix();
    }
    
    public void doRender(Entity entity, double d, double d1, double d2,
    		 float f, float f1)
    {
    	 func_153_a((EntityMoabPrimed)entity, d, d1, d2, f, f1);
    }
    }

    MoabExplosive:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class MoabExplosive extends Block
    {
    public MoabExplosive(int par1, int par2)
    {
    	 super(par1, par2, Material.tnt);
    }
    
    
    public void onBlockAdded(World par1World, int par2, int par3, int par4)
    {
    	 super.onBlockAdded(par1World, par2, par3, par4);
    
    	 if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
    	 {
    		 onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
    		 par1World.setBlockWithNotify(par2, par3, par4, 0);
    	 }
    }
    
    /**
    	 * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
    	 * their own) Args: x, y, z, neighbor blockID
    	 */
    public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
    {
    	 if (par5 > 0 && Block.blocksList[par5].canProvidePower() && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))
    	 {
    		 onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
    		 par1World.setBlockWithNotify(par2, par3, par4, 0);
    	 }
    }
    
    /**
    	 * Returns the quantity of items to drop on block destruction.
    	 */
    public int quantityDropped(Random par1Random)
    {
    	 return 0;
    }
    
    /**
    	 * Called upon the block being destroyed by an explosion
    	 */
    public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4)
    {
    	 if (par1World.isRemote)
    	 {
    		 return;
    	 }
    	 else
    	 {
    		 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(par1World, (float)par2 + 0.5F, (float)par3 + 0.5F, (float)par4 + 0.5F);
    		 entitytntprimed.fuse = par1World.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
    		 par1World.spawnEntityInWorld(entitytntprimed);
    		 return;
    	 }
    }
    
    /**
    	 * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData
    	 */
    public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5)
    {
    	 if (par1World.isRemote)
    	 {
    		 return;
    	 }
    
    	 if ((par5 & 1) == 0)
    	 {
    		 dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Block.tnt.blockID, 1, 0));
    	 }
    	 else
    	 {
    		 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(par1World, (float)par2 + 0.5F, (float)par3 + 0.5F, (float)par4 + 0.5F);
    		 par1World.spawnEntityInWorld(entitytntprimed);
    		 par1World.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F);
    	 }
    }
    
    /**
    	 * Called when the block is clicked by a player. Args: x, y, z, entityPlayer
    	 */
    public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
    {
    	 super.onBlockClicked(par1World, par2, par3, par4, par5EntityPlayer);
    }
    
    /**
    	 * Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the
    	 * block.
    	 */
    public boolean blockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer)
    {
    	 if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.shiftedIndex)
    	 {
    		 onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);
    		 par1World.setBlockWithNotify(par2, par3, par4, 0);
    		 return true;
    	 }
    	 else
    	 {
    		 return super.blockActivated(par1World, par2, par3, par4, par5EntityPlayer);
    	 }
    }
    
    /**
    	 * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
    	 * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
    	 */
    protected ItemStack createStackedBlock(int par1)
    {
    	 return null;
    }
    }

    MoabCaller:
    package net.minecraft.src;
    public class MoabCaller extends Item
    {
    				 public MoabCaller(int i)
    				 {
    						 super(i);
    						 maxStackSize = 1;									 
    				 }
    			   
    				
    
    	    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    	    {
    			    if(!world.isRemote)
    			    {
    					    EntityMoabPrimed tnt= new EntityMoabPrimed(world, entityplayer.posX, entityplayer.posY, entityplayer.posZ);
    					    world.spawnEntityInWorld(tnt);
    			    }
    			    return itemstack;
    	    }
    {
    }
    }

    If you know the solution please help me,and sorry for bad inglish.
    Posted in: Modification Development
  • 0

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    Quote from whiteghoul

    yup it is work,
    use the entityTNTPrimed class, just copy and paste it to your entity class file...

    Thank you.
    Posted in: Tutorials
  • 0

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    TheInstitutions,
    Your explosives tutorial works on 1.3.2
    if not,
    The entity part works?
    Posted in: Tutorials
  • 0

    posted a message on How i can make algorithms for Explosives?
    Thank you for the help.
    Posted in: Modification Development
  • 0

    posted a message on How i can make algorithms for Explosives?
    I guess this is wrong:

    mod_file:
    package net.minecraft.src;
    public class mod_MoreTNTsAndExplosives extends BaseMod
    { public static final Item MoabCaller = new MoabCaller(210).setItemName("MoabCaller");
    
    public void load()
    {
    	 MoabCaller.iconIndex = ModLoader.addOverride("/gui/items.png", "/image.png");
    	 ModLoader.addName(MoabCaller, "In-Game Name Here");
    	 ModLoader.addRecipe(new ItemStack(MoabCaller, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt}); 
    }
    
    public String getVersion()
    {
    				 return "1.3.2";
    }
    }


    MoabCallerfile:
    package net.minecraft.src;
    public class MoabCaller extends Item
    {
    		 public MoabCaller(int i)
    		 {
    						 super(i);
    						 maxStackSize = 1;					
    		 }
    		
    		 public ItemStack onItemRightClick(ItemStack par1ItemStack)
    		 {
    	 Player.posX
    	 Player.posY;
    	 Player.posZ;
    		 if (!par1World.isRemote)
    {
    EntityTNTPrimed tnt= new EntityTNTPrimed(world, X, Y, Z);
    world.spawnEntityInWorld(tnt);
    }
    }
    }

    Sorry for so many errors,i dont know so much about a bit Advanced Modding...
    Sorry for bad inglish.
    Posted in: Modification Development
  • To post a comment, please .