protected void doFireball(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
boolean rightButtonDown = Mouse.isButtonDown(1);
if (isActive() == false)
{
return;
}
if (isActive() == true)
{
if (EntityPlayer.inventory.getCurrentItem() == null && rightButtonDown == true)
{
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(par2World);
par2World.spawnEntityInWorld(new EntitySmallFireball(par2World));
}
}
}
There is no error, but it doesn't work. isActive() is a method defined earlier to determine if the class is active (I had six classes working from a base class that would cycle around them).
Any help? I'm trying to spawn a fireball (blaze-style, not ghast) on a barehanded right click for an elemental mod.
protected void doFireball(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
boolean rightButtonDown = Mouse.isButtonDown(1);
if (isActive() == false)
{
return;
}
if (isActive() == true)
{
if (EntityPlayer.inventory.getCurrentItem() == null && rightButtonDown == true)
{
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(par2World);
par2World.spawnEntityInWorld(new EntitySmallFireball(par2World));
}
}
}
There is no error, but it doesn't work. isActive() is a method defined earlier to determine if the class is active (I had six classes working from a base class that would cycle around them).
Any help? I'm trying to spawn a fireball (blaze-style, not ghast) on a barehanded right click for an elemental mod.
EntitySmallFireball has 3 constructors.
Try using the second one:
public EntitySmallFireball(World world, EntityLiving entityliving, double x, double y, double z)
The parameters x, y, and z will be the coordinates of wherever the fireball is supposed to spawn in the world, which in this case is probably the current location of the Entity that's doing the firing, possibly with a small offset to prevent it from spawning inside the player's head.
I'm having trouble, I'm trying to convert my entity into SMP but when I take out ModLoader.getUniqueEntityID()) I get an error that's underlining ID.
public void load()
{
{
ModLoader.RegisterEntityID(EntityTNTPrimedDispenser.class, "TNT Dispenser", ID);
}
}
[/size][/font][/size][/font][/color]
[color=#000000][font=monospace, monospace][size=x-small][font=arial,helvetica,sans-serif][size=medium] public void addRenderer(Map map)
{
map.put(EntityTNTPrimedDispenser.class, new RenderTNTPrimedDispenser());
}
{
This is what I have.
In multiplayer you have to assign an actual number ID to entities (go look in EntityList to see what IDs are already used), and don't make spam posts in the wrong thread.
Thanks for the help. I've got it working now, but it only fires in one direction. (Partially fix'd by reassigning the skill to an item.) Any fixes for this? It's really bugging me.
Also, how would I bind a key to a command? As in: pressing Z would use an EnumMovingObjectType-style thing to determine if the player is looking at a block or not, and then ignite the block if true (or, if it was an entity, burn it).
Thanks for the help. I've got it working now, but it only fires in one direction. (Partially fix'd by reassigning the skill to an item.) Any fixes for this? It's really bugging me.
Also, how would I bind a key to a command? As in: pressing Z would use an EnumMovingObjectType-style thing to determine if the player is looking at a block or not, and then ignite the block if true (or, if it was an entity, burn it).
I don't know about keybinds currently, but to change the direction it fires in, look inside EntityBlaze at the code it uses when it fires the projectile, and figure out how it gets the direction to shoot in, then adapt that to this situation.
I tried doing that already. **** ton of math, and I still can't figure it out. >_<
Most of the time anything to do with camera position (rotationYaw, etc.) is irrelevant as long as you don't change it. That stuff is just a bunch of fancy trigonometry to determine what direction something is facing and how large its visible area is.
I took a look into EntityBlaze myself just now, and these are the important parts:
Both are in attackEntity(Entity par1Entity, float par2)
...So I'd just look into the attackEntity void and pretty much copy the directional code? Ah, thanks. Unfortunately, I am incapable of working with keybindings (I know there's a Modloader function with it, and since my mod ATM is currently using Modloader, I could use it but I can't figure it out. I'm so incompetent. >_<)
...So I'd just look into the attackEntity void and pretty much copy the directional code? Ah, thanks. Unfortunately, I am incapable of working with keybindings (I know there's a Modloader function with it, and since my mod ATM is currently using Modloader, I could use it but I can't figure it out. I'm so incompetent. >_<)
Don't worry, you'll figure it out, whether you do it now, or later with more experience.
When I first ported my code to Forge after running out of sprites I had a hell of a time trying to add my arrows back in with the provided hooks. I eventually had to give up on trying. Later when I had more experience I had a moment where I realized "HERP DERP all I have to do is this tiny simple thing...DERP" and had it working in ~5 minutes.
Unfortunately I haven't done keybinds either or I'd be a bigger help here.
In multiplayer you have to assign an actual number ID to entities (go look in EntityList to see what IDs are already used), and don't make spam posts in the wrong thread.
OOH Thats where my post went .__. I posted in the wrong thread sorry....
There is no error, but it doesn't work. isActive() is a method defined earlier to determine if the class is active (I had six classes working from a base class that would cycle around them).
Any help? I'm trying to spawn a fireball (blaze-style, not ghast) on a barehanded right click for an elemental mod.
EntitySmallFireball has 3 constructors.
Try using the second one:
The parameters x, y, and z will be the coordinates of wherever the fireball is supposed to spawn in the world, which in this case is probably the current location of the Entity that's doing the firing, possibly with a small offset to prevent it from spawning inside the player's head.
In multiplayer you have to assign an actual number ID to entities (go look in EntityList to see what IDs are already used), and don't make spam posts in the wrong thread.
Change 'EntityPlayer' to par1EntityPlayer
Also, how would I bind a key to a command? As in: pressing Z would use an EnumMovingObjectType-style thing to determine if the player is looking at a block or not, and then ignite the block if true (or, if it was an entity, burn it).
I don't know about keybinds currently, but to change the direction it fires in, look inside EntityBlaze at the code it uses when it fires the projectile, and figure out how it gets the direction to shoot in, then adapt that to this situation.
Most of the time anything to do with camera position (rotationYaw, etc.) is irrelevant as long as you don't change it. That stuff is just a bunch of fancy trigonometry to determine what direction something is facing and how large its visible area is.
I took a look into EntityBlaze myself just now, and these are the important parts:
Both are in attackEntity(Entity par1Entity, float par2)
...So I'd just look into the attackEntity void and pretty much copy the directional code? Ah, thanks. Unfortunately, I am incapable of working with keybindings (I know there's a Modloader function with it, and since my mod ATM is currently using Modloader, I could use it but I can't figure it out. I'm so incompetent. >_<)
Don't worry, you'll figure it out, whether you do it now, or later with more experience.
When I first ported my code to Forge after running out of sprites I had a hell of a time trying to add my arrows back in with the provided hooks. I eventually had to give up on trying. Later when I had more experience I had a moment where I realized "HERP DERP all I have to do is this tiny simple thing...DERP" and had it working in ~5 minutes.
Unfortunately I haven't done keybinds either or I'd be a bigger help here.
OOH Thats where my post went .__. I posted in the wrong thread sorry....