Alright, so I have a few problems with the custom bow part. First, the bow sticks on the full drawback animation after I've fired. My images for firebow1, firebow2, firebow3, and firebow4 are the original texture and the three animation textures, respectively. Second, the bow item in my inventory animates when I fire, and I don't want that. Third, the animated bow textures are replacing other textures in my game, like the flint and steel and others. My mod adds quite a few items to the game (69, to be exact), so items.png might be full. If that's the case, I thought Modloader was supposed to expand items.png to fit all additional images? Anyway, any help with these issues would be appreciated.
to fix your animation errors, all i did was move the if statement, and it's animation works perfectly.
I copy/pasted your code and replaced everything with the correct information for my mod, but literally nothing changed. I still have the exact same problem.
This is my code here, tell me if I have any problems.
public static int IronBow = ModLoader.addOverride("/gui/items.png", "/items/IronBowPullReturn.png");
public static int IronBow1 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull1.png");
public static int IronBow2 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull2.png");
public static int IronBow3 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull3.png");
Alright, so I have a few problems with the custom bow part. First, the bow sticks on the full drawback animation after I've fired. My images for firebow1, firebow2, firebow3, and firebow4 are the original texture and the three animation textures, respectively. Second, the bow item in my inventory animates when I fire, and I don't want that. Third, the animated bow textures are replacing other textures in my game, like the flint and steel and others. My mod adds quite a few items to the game (69, to be exact), so items.png might be full. If that's the case, I thought Modloader was supposed to expand items.png to fit all additional images? Anyway, any help with these issues would be appreciated.
I copy/pasted your code and replaced everything with the correct information for my mod, but literally nothing changed. I still have the exact same problem.
This is my code here, tell me if I have any problems.
public static int IronBow = ModLoader.addOverride("/gui/items.png", "/items/IronBowPullReturn.png");
public static int IronBow1 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull1.png");
public static int IronBow2 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull2.png");
public static int IronBow3 = ModLoader.addOverride("/gui/items.png", "/items/IronBowPull3.png");
Ok. This is enough complaining. I'm tired of seeing people who can't figure this out.
I figured it out so I'm just going to post my code and you people can copy it into yours
and change the names (obviously) and have it actually WORK. Your Welcome.
Remember to have your original item image ("insertnamehere.png") and the first image out of four ("insertnamehere1.png") to have the same exact image.
I hope to GOD this fixes peoples problems, or I'm mud.
To everyone having issues with their code please bear in mind that this tutorial has not been updated since January. You may be able to solve your issue yourself by looking at the relevant code in the default bow in updated code to get the new variable name. I'll try to update this when I can.
Here is a fix for the messed up hotbar textures:
[snip]
This is EntityPlayer.java
if you copy the bow's method like i did and replace it with the textures like Stewie did in that order, it will work like a charm.
The reason I settled for the messed up hotbar textures is because editing EntityPlayer is a big nono and means you can't use some very important and popular mods.
I followed your tutorial (in combination with another one), and have a pretty good crossbow mod, however, the draw time minimum is extraordinarily short, so I was wondering how I could set it up so that it only will load after it gets to "critical"; also, I am having troubles with the animated textures: when I go to draw my bow, it changes to the 4th texture in the cycle instantly, and never shows the 1st, 2nd and 3rd.
Rollback Post to RevisionRollBack
If Facebook, Twitter and MySpace were all distroyed, 90% of teenagers would die. If you're one of the 10% that would be laughing, copy this to your signature and hope it happens.
This is EntityPlayer.java
if you copy the bow's method like i did and replace it with the textures like Stewie did in that order, it will work like a charm.
Hey, I'm not sure if anyone still comes here, but I have a problem. I fixed the white box problem, but my actual arrow doesn't show. Only the fire trail is shown. If anyone knows how to fix this, please tell me. Thanks
P.S. Is there a way to substitute fire for lightning on the bow ability?
My arrows are invisible. I dont know what is going on because I have double and tripled checked all the files but still nothing. When I shoot, it takes away one of the arrows and it acts like a real arrow, as in it causes damage to mobs and kills them, but you just cant see it. Any ideas?
If I leave the line:
EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, var7 * 2.0F);
as is then my bow shoots an arrow, but if I change it to say:
EntityNewArrow var8 = new EntityNewArrow(par2World, par3EntityPlayer, var7 * 2.0F);
then my arrow disappears in game.
Hi,
This is one of the tutorials I'm using to learn Java for modding. One of the things I want my first mods (I want a few very small mods that work together) is a set of arrows- the normal one, obviously, One with an improved point for more damage, one with an improved feather for better range, and one with both the improved point and the improved feather.
My question is, How do you add more damage to the improved point arrow? I saw the part that added fire damage in the tutorial, but I don't understand how to add more simple damage.
Also, correct me if I'm wrong, but I'm thinking range can be improved by increasing the initial velocity to, say, f*2.5 or f*3 instead of the listed f*2?
Thank you for your help!
Rollback Post to RevisionRollBack
Sigma_Phi - home of the long-winded answers to questions nobody asked.
Hate to double-post, but I have another question.
How can I make my bow select from a selection of arrows in one's inventory in a set order? I know how the logic works, but I'm not sure how to make it go "If the top priority arrow isn't there, try the second. If the second isn't there, the third. Etc."
Basically, I want my bow to try to use the best arrow, then the second best, scaling down to standard arrows.
Else-if statements look like they could work. Do those work in Minecraft code?
Any Advice?
Rollback Post to RevisionRollBack
Sigma_Phi - home of the long-winded answers to questions nobody asked.
i made a Quarry you know the thingy you put the arrows in well i want my long bow to shoot it but its not shooting it when i shoot it
the texture of the bow doesn't show up yes i puted in RenderQuarry(of mayne) load textures
But it dosen't work
Vec3 vec3d = movingobjectposition.hitVec;
double x = vec3d.xCoord;
double y = vec3d.yCoord;
double z = vec3d.zCoord;
int i = MathHelper.floor_double(x);
int j = MathHelper.floor_double(y);
int k = MathHelper.floor_double(z);
EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D);
entitybolt.setLocationAndAngles(x, y, z, 0, 0.0F);
world.spawnEntityInWorld(entitybolt);
// we'll add code here next
itemstack.setItemDamage(99);
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() > 0)
{
itemstack.damageItem(-1, (EntityLiving)entity);
}
}
I did this by myself but when i use my lightning it spawns its fine but i get fire damage nomatter where im at even if im inside, im using forge. if you could message me on skype that would be great. Skype name: werdwed
I copy/pasted your code and replaced everything with the correct information for my mod, but literally nothing changed. I still have the exact same problem.
This is my code here, tell me if I have any problems.
Ok. This is enough complaining. I'm tired of seeing people who can't figure this out.
I figured it out so I'm just going to post my code and you people can copy it into yours
and change the names (obviously) and have it actually WORK. Your Welcome.
Remember to have your original item image ("insertnamehere.png") and the first image out of four ("insertnamehere1.png") to have the same exact image.
I hope to GOD this fixes peoples problems, or I'm mud.
The reason I settled for the messed up hotbar textures is because editing EntityPlayer is a big nono and means you can't use some very important and popular mods.
this crashes the game for me... any idea why?
P.S. Is there a way to substitute fire for lightning on the bow ability?
Nevermind, I got it to work anyway. I plugged in entityplayer.getItemInUseDuration() instead of func_3205 and I got the same result.
If I leave the line:
EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, var7 * 2.0F);
as is then my bow shoots an arrow, but if I change it to say:
EntityNewArrow var8 = new EntityNewArrow(par2World, par3EntityPlayer, var7 * 2.0F);
then my arrow disappears in game.
This is one of the tutorials I'm using to learn Java for modding. One of the things I want my first mods (I want a few very small mods that work together) is a set of arrows- the normal one, obviously, One with an improved point for more damage, one with an improved feather for better range, and one with both the improved point and the improved feather.
My question is, How do you add more damage to the improved point arrow? I saw the part that added fire damage in the tutorial, but I don't understand how to add more simple damage.
Also, correct me if I'm wrong, but I'm thinking range can be improved by increasing the initial velocity to, say, f*2.5 or f*3 instead of the listed f*2?
Thank you for your help!
Sigma_Phi - home of the long-winded answers to questions nobody asked.
How can I make my bow select from a selection of arrows in one's inventory in a set order? I know how the logic works, but I'm not sure how to make it go "If the top priority arrow isn't there, try the second. If the second isn't there, the third. Etc."
Basically, I want my bow to try to use the best arrow, then the second best, scaling down to standard arrows.
Else-if statements look like they could work. Do those work in Minecraft code?
Any Advice?
Sigma_Phi - home of the long-winded answers to questions nobody asked.
the texture of the bow doesn't show up yes i puted in RenderQuarry(of mayne) load textures
But it dosen't work
My cooldown isnt working at all could you help. Also this thing sets my pants on fire is that my fault or the games? Thanks
package net.minecraft.src;
import java.util.Random;
public class WandLightning extends Item
{
public WandLightning(int i)
{
super(i);
setMaxDamage(100);
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
if(itemstack.getItemDamage() == 0)
{
MovingObjectPosition movingobjectposition = entityplayer.rayTrace(75.0D, 1.0F);
if(movingobjectposition == null)
{
return itemstack;
}
Vec3 vec3d = movingobjectposition.hitVec;
double x = vec3d.xCoord;
double y = vec3d.yCoord;
double z = vec3d.zCoord;
int i = MathHelper.floor_double(x);
int j = MathHelper.floor_double(y);
int k = MathHelper.floor_double(z);
EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D);
entitybolt.setLocationAndAngles(x, y, z, 0, 0.0F);
world.spawnEntityInWorld(entitybolt);
// we'll add code here next
itemstack.setItemDamage(99);
}
return itemstack;
}
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
if(itemstack.getItemDamage() > 0)
{
itemstack.damageItem(-1, (EntityLiving)entity);
}
}
}