Jump to content

Game crash after Makeing bomb


maw79

Recommended Posts

Ok, So i went to make a bomb for my mod loosely based off some code from a earlier forum post and Give Him All Credit for the code i used from him:P

http://www.minecraftforge.net/forum/index.php/topic,1562.0.html

Now every time i run MC from the code it Crashes and

---- Minecraft Crash Report ----

// I bet Cylons wouldn't have this problem.

 

Time: 8/24/12 11:29 AM

Description: Failed to start game

 

cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException

at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:603)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:217)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:447)

at net.minecraft.client.Minecraft.run(Minecraft.java:734)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:308)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:602)

... 4 more

Caused by: java.lang.NullPointerException

at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:189)

at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:181)

at reinforced.common.Reinforced_blocks.load(Reinforced_blocks.java:50)

... 30 more

 

Relevant Details:

- Minecraft Version: 1.3.2

- Operating System: Windows 7 (amd64) version 6.1

- Java Version: 1.7.0_05, Oracle Corporation

- Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

- Memory: 799049360 bytes (762 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

- JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

- LWJGL: 2.4.2

- OpenGL: AMD Radeon HD 6450 GL version 4.2.11733 Compatibility Profile Context, ATI Technologies Inc.

- Is Modded: Definitely; 'forge,fml'

- Type: Client

- Texture Pack: Default

- Profiler Position: N/A (disabled)

 

My code :

my block Register

 

naquadahbomb = new Naquadabomb(402,2).setStepSound(Block.soundPowderFootstep).setHardness(3F).setResistance(1.0F).setBlockName("Naquadah Bomb");

GameRegistry.registerBlock(naquadahbomb);

LanguageRegistry.addName(naquadahbomb, "Naquadah Bomb");

GameRegistry.addRecipe(new ItemStack(Reinforced_blocks.naquadahbomb), new Object[]

{

    "XIX", "IXI", "XIX", 'X', Reinforced_blocks.naquadahingot, 'I', Item.gunpowder

    });

 

 

My Block file

 

package reinforced.common;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.EntityPlayer;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Material;

import net.minecraft.src.CreativeTabs;

import net.minecraft.src.World;

 

public class Naquadabomb extends Block

{

 

public Naquadabomb(int par1, int par2) {

super(par1,par2,Material.rock);

this.setCreativeTab(CreativeTabs.tabBlock);

// TODO Auto-generated constructor stub

}

public int getBlockTextureFromSide(int i)

{

if(i == 1 || i == 0)

{

return 3;

}

else

{

return 2;

}

}

public String getTextureFile()

    {

            return "/mod_texture.png";

    }

public void onBlockAdded(World par1World, int par2, int par3, int par4)

{

super.onBlockAdded(par1World, par2, par3, par4);

 

if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4))

{

this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);

par1World.setBlockWithNotify(par2, par3, par4, 0);

}

}

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))

{

this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);

par1World.setBlockWithNotify(par2, par3, par4, 0);

}

}

public int quantityDropped(Random par1Random)

{

return 1;

}

public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4)

{

if (!par1World.isRemote)

{

Naquadah_EntityBombPrimed var5 = new Naquadah_EntityBombPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F));

var5.fuse = par1World.rand.nextInt(var5.fuse / 4) + var5.fuse / 8;

par1World.spawnEntityInWorld(var5);

}

}

public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5)

{

if (!par1World.isRemote)

{

if ((par5 & 1) == 1)

{

Naquadah_EntityBombPrimed var6 = new Naquadah_EntityBombPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F));

par1World.spawnEntityInWorld(var6);

par1World.playSoundAtEntity(var6, "random.fuse", 1.0F, 1.0F);

}

}

}

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)

{

if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Reinforced_blocks.naquadahbomb.blockID)

{

this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1);

par1World.setBlockWithNotify(par2, par3, par4, 0);

return true;

}

else

{

return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);

}

}

protected ItemStack createStackedBlock(int par1)

{

return null;

}

 

 

}

 

 

Entity:

 

package reinforced.common;

 

import net.minecraft.src.Entity;

import net.minecraft.src.NBTTagCompound;

import net.minecraft.src.World;

import cpw.mods.fml.common.Side;

import cpw.mods.fml.common.asm.SideOnly;

 

public class Naquadah_EntityBombPrimed extends Entity

{

 

public int fuse;

 

    public Naquadah_EntityBombPrimed(World par1World)

    {

        super(par1World);

        this.fuse = 0;

        this.preventEntitySpawning = true;

        this.setSize(0.98F, 0.98F);

        this.yOffset = this.height / 2.0F;

    }

    public Naquadah_EntityBombPrimed(World par1World, double par2, double par4, double par6)

    {

        this(par1World);

        this.setPosition(par2, par4, par6);

        float var8 = (float)(Math.random() * Math.PI * 2.0D);

        this.motionX = (double)(-((float)Math.sin((double)var8)) * 0.02F);

        this.motionY = 0.20000000298023224D;

        this.motionZ = (double)(-((float)Math.cos((double)var8)) * 0.02F);

        this.fuse = 80;

        this.prevPosX = par2;

        this.prevPosY = par4;

        this.prevPosZ = par6;

    }

    protected boolean canTriggerWalking()

    {

        return false;

    }

    public boolean canBeCollidedWith()

    {

        return !this.isDead;

    }

    public void onUpdate()

    {

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

        this.motionY -= 0.03999999910593033D;

        this.moveEntity(this.motionX, this.motionY, this.motionZ);

        this.motionX *= 0.9800000190734863D;

        this.motionY *= 0.9800000190734863D;

        this.motionZ *= 0.9800000190734863D;

 

        if (this.onGround)

        {

            this.motionX *= 0.699999988079071D;

            this.motionZ *= 0.699999988079071D;

            this.motionY *= -0.5D;

        }

 

        if (this.fuse-- <= 0)

        {

            this.setDead();

 

            if (!this.worldObj.isRemote)

            {

                this.explode();

            }

        }

        else

        {

            this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);

        }

    }

    private void explode()

    {

        float var1 = 8.0F;

        this.worldObj.createExplosion((Entity)null, this.posX, this.posY, this.posZ, var1);

    }

    protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

    {

        par1NBTTagCompound.setByte("Fuse", (byte)this.fuse);

    }

    protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

    {

        this.fuse = par1NBTTagCompound.getByte("Fuse");

    }

 

    @SideOnly(Side.CLIENT)

    public float getShadowSize()

    {

        return 0.0F;

    }

@Override

protected void entityInit() {

// TODO Auto-generated method stub

 

}

}

 

 

Render:

 

package reinforced.common;

 

import org.lwjgl.opengl.GL11;

 

import net.minecraft.src.Block;

import net.minecraft.src.Entity;

import net.minecraft.src.Render;

import net.minecraft.src.RenderBlocks;

 

public class Naquadah_RenderBomb extends Render

{

private RenderBlocks blockRenderer = new RenderBlocks();

 

public Naquadah_RenderBomb()

{

    this.shadowSize = 0.5F;

}

public void func_76992_a(Naquadah_EntityBombPrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)

    {

        GL11.glPushMatrix();

        GL11.glTranslatef((float)par2, (float)par4, (float)par6);

        float var10;

 

        if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)

        {

            var10 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;

 

            if (var10 < 0.0F)

            {

                var10 = 0.0F;

            }

 

            if (var10 > 1.0F)

            {

                var10 = 1.0F;

            }

 

            var10 *= var10;

            var10 *= var10;

            float var11 = 1.0F + var10 * 0.3F;

            GL11.glScalef(var11, var11, var11);

        }

 

        var10 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;

        this.loadTexture("/Thormod/blocks.png");

        this.blockRenderer.renderBlockAsItem(Block.tnt, 0, par1EntityTNTPrimed.getBrightness(par9));

 

        if (par1EntityTNTPrimed.fuse / 5 % 2 == 0)

        {

            GL11.glDisable(GL11.GL_TEXTURE_2D);

            GL11.glDisable(GL11.GL_LIGHTING);

            GL11.glEnable(GL11.GL_BLEND);

            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);

            GL11.glColor4f(1.0F, 1.0F, 1.0F, var10);

            this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F);

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            GL11.glDisable(GL11.GL_BLEND);

            GL11.glEnable(GL11.GL_LIGHTING);

            GL11.glEnable(GL11.GL_TEXTURE_2D);

        }

 

        GL11.glPopMatrix();

    }

    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)

    {

        this.func_76992_a((Naquadah_EntityBombPrimed)par1Entity, par2, par4, par6, par8, par9);

    }

}

 

 

Client Proxy

 

package reinforced.client;

 

import cpw.mods.fml.client.registry.RenderingRegistry;

import reinforced.common.Naquadah_EntityBombPrimed;

import reinforced.common.Naquadah_RenderBomb;

import reinforced.common.ReinforcedProxy;

import net.minecraftforge.client.MinecraftForgeClient;

 

public class ClientProxy extends ReinforcedProxy

{

@Override

public void registerRenderThings()

{

MinecraftForgeClient.preloadTexture("/mod_texture.png");

MinecraftForgeClient.preloadTexture("/mod_item.png");

 

RenderingRegistry.registerEntityRenderingHandler(Naquadah_EntityBombPrimed.class, new Naquadah_RenderBomb());

}

}

 

 

 

Thanks For All The Help :D

 

 

 

Link to comment
Share on other sites

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.