I'm trying to add a weapon that shoots Ghast Fireballs to the game. Here's the line I'm having trouble with:
world.entityJoinedWorld(new EntitySpell(world, entityplayer, d, d1, d2));
I know that these three arguments (d, d1, d2) determine where the fireball goes after it shoots, but how can I get the player's direction?
Everything else about the weapon is set up properly.
EDIT: solved, see last post
Ghast's Fireball Weapon [SOLVED]
Moderator: Moderators
-
- Master Bounty Hunter
- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Ghast's Fireball Weapon [SOLVED]
Last edited by CressAlbane on Tue Dec 13, 2011 8:03 pm, edited 1 time in total.
- bamdur123
- Sergeant Major
- Posts: 243
- Joined: Fri Oct 15, 2010 7:15 pm
- Projects :: Tython-Siege of Darkness Zombie Hotel
- Location: Ohio, USA
Re: Ghast's Fireball Weapon
Is it not compiling? or just undesired results
-
- Master Bounty Hunter
- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Re: Ghast's Fireball Weapon
Undesired results. Everything else about the weapon is set up properly.
- bamdur123
- Sergeant Major
- Posts: 243
- Joined: Fri Oct 15, 2010 7:15 pm
- Projects :: Tython-Siege of Darkness Zombie Hotel
- Location: Ohio, USA
Re: Ghast's Fireball Weapon
not sure if i canhelp you without your source
-
- Master Bounty Hunter
- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Re: Ghast's Fireball Weapon
Code: Select all
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Item, World, EntityPlayer, InventoryPlayer,
// EntityArrow, ItemStack
public class ItemFlamer extends Item
{
public ItemFlamer(int i)
{
super(i);
maxStackSize = 1;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!world.multiplayerWorld)
{
world.entityJoinedWorld(new EntityFireball(world, entityplayer, d, d1, d2));
}
return itemstack;
}
}
Code: Select all
world.entityJoinedWorld(new EntityFireball(world, entityplayer, d, d1, d2));
Hidden/Spoiler:
- bamdur123
- Sergeant Major
- Posts: 243
- Joined: Fri Oct 15, 2010 7:15 pm
- Projects :: Tython-Siege of Darkness Zombie Hotel
- Location: Ohio, USA
Re: Ghast's Fireball Weapon
i think they are variables that need to be defined, iw ould try that, if it doesnt work i suggest taking a look at the entityfireball.java
Code: Select all
public EntityFireball(World world, EntityLiving entityliving, double d, double d1, double d2)
{
super(world);
field_9402_e = -1;
field_9401_f = -1;
field_9400_g = -1;
field_9399_h = 0;
field_9398_i = false;
field_9406_a = 0;
field_9395_l = 0;
field_9397_j = entityliving;
setSize(1.0F, 1.0F);
setLocationAndAngles(entityliving.posX, entityliving.posY, entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch);
setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = motionY = motionZ = 0.0D;
d += rand.nextGaussian() * 0.40000000000000002D;
d1 += rand.nextGaussian() * 0.40000000000000002D;
d2 += rand.nextGaussian() * 0.40000000000000002D;
double d3 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2);
field_9405_b = (d / d3) * 0.10000000000000001D;
field_9404_c = (d1 / d3) * 0.10000000000000001D;
field_9403_d = (d2 / d3) * 0.10000000000000001D;
}
-
- Master Bounty Hunter
- Posts: 1519
- Joined: Fri Dec 18, 2009 8:02 am
- Projects :: CTF Arenas
- Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı
Re: Ghast's Fireball Weapon
Hidden/Spoiler:
The parameters to passed in with a situation like this come from the variables in the Entity class:
Code: Select all
public float rotationYaw;
public float rotationPitch;
public float prevRotationYaw;
public float prevRotationPitch;
Code: Select all
posX, posY, posZ