Jump to content

Recommended Posts

Posted

gaaahhh im getting reallly mad cause ive been trying to fix the entity and the sound that the item makes when rightclicked everything works exept then firebolt it doesnt appear and everything is called and no sound is playing, i can see when the firebolt crashes since it explodes. the sound file is in assets/modid/sound

 

here is item wand that throws firebolt

package medieval;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
public class Fire_Wand extends medievalitemsword
{
public Fire_Wand(int ItemID, medievalweaponproperties material)
{
super(ItemID, material);
}

@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2WorldObject,EntityPlayer par3EntityPlayer) {
if(par3EntityPlayer.capabilities.isCreativeMode||par3EntityPlayer.inventory.consumeInventoryItem(Item.redstone.itemID))
{
     par2WorldObject.playSoundAtEntity(par3EntityPlayer, "medieval:fireball1", 2.0F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
     if (!par2WorldObject.isRemote)
     {
     par2WorldObject.spawnEntityInWorld(new medievalfirebolt(par2WorldObject, par3EntityPlayer));
     }
}
return par1ItemStack;
}
public void registerIcons(IconRegister reg) {
this.itemIcon = reg.registerIcon("medieval:firewand");
}
public boolean hasEffect(ItemStack par1ItemStack) {
return true;
}
}

 

 

here is firebolt entity

package medieval;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import medieval.blocks.ores.BlockSapphireOre;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class medievalfirebolt extends EntityThrowable
{


private static final float explosionRadius = 1.0F;
private static final double speed = 1;

public medievalfirebolt(World par1World)
{
     super(par1World);
}
public medievalfirebolt(World par1World, EntityPlayer par3EntityPlayer)
{
     super(par1World, par3EntityPlayer);
}
public medievalfirebolt(World par1World, double par2, double par4, double par6)
{
     super(par1World, par2, par4, par6);
}
     @Override
     protected void onImpact(MovingObjectPosition movingobjectposition)
     {
     this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, true);
     this.setDead();
     }
     @Override
     protected float getGravityVelocity()
     {
return 0;
     }
     {
     this.motionX*=speed;
     this.motionY*=speed;
     this.motionZ*=speed;
}
}

 

 

here is the sound of firebolt

package medieval;
import net.minecraftforge.client.event.sound.SoundEvent;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
public class fireballsound {

@ForgeSubscribe
public void onSound(SoundLoadEvent event)
{
event.manager.addSound("medieval:fireball1.wav");
        


}
}

 

 

and here is the firebolt render

package medieval;

import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
public class Fireboltrender extends Render
{
public Fireboltrender()
{
}
@Override
public void doRender(Entity entity, double d, double d1, double d2, float yaw, float partialTicks)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)d, (float)d1, (float)d2);
GL11.glEnable(32826);
GL11.glScalef(0.5F, 0.5F, 0.5F);
loadTexture("/textures/items/fireball.png");
Tessellator tessellator = Tessellator.instance;
float f2 = (float)((field_20003_a % 16) * 16 + 0) / 16F;
float f3 = (float)((field_20003_a % 16) * 16 + 16) / 16F;
float f4 = (float)((field_20003_a / 16) * 16 + 0) / 16F;
float f5 = (float)((field_20003_a / 16) * 16 + 16) / 16F;
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.25F;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
tessellator.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
tessellator.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
tessellator.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
tessellator.draw();
GL11.glDisable(32826);
GL11.glPopMatrix();
}
private void loadTexture(String string) {


}
int i;
private int field_20003_a = i;
@Override
protected ResourceLocation func_110775_a(Entity entity) {
return null;
}
}

 

and if needed here is the firebolt item

package medieval.items.etc;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import medieval.Medieval;
public class Firebolt extends Item
{

public Firebolt(int i)
{

super(i);
this.setCreativeTab(Medieval.medievaltab);
maxStackSize = 64;


}
public void registerIcons(IconRegister reg) {
this.itemIcon = reg.registerIcon("medieval:fireball");
}
public String Version()
{
return "1.6.2";
}
}

 

i just want to finish :(

I like helping people because i was also in a same problem and i do not like unfinished work, so a thank you will be enough for the people im helping and a thank you to the people that helped me :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.