Jump to content

Need help rendering a custom fire block


WolfAmaril

Recommended Posts

I'm currently trying to get a custom fire block to render (I'll add in standard fire functionality later) and so far every time I try to load up my dev world, minecraft crashes.

below are the three files I'm using.

The generic mod block file

package com.wolfamaril.coloredflame.block;

 

import com.wolfamaril.coloredflame.creativetab.CreativeTabColoerdFlame;

import com.wolfamaril.coloredflame.reference.Reference;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.block.BlockFire;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

 

 

public class BlockColoredFlame extends BlockFire

{

  /* public BlockColoredFlame(Material material)

    {

        super(material);

    }*/

 

    public BlockColoredFlame()

    {

        //this(Material.fire);

        this.setCreativeTab(CreativeTabColoerdFlame.COLOREDFLAME_TAB);

    }

    @Override

    public String getUnlocalizedName()

    {

        return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName()));

    }

 

    @Override

    @SideOnly(Side.CLIENT)

    public void registerBlockIcons(IIconRegister iconRegister)

    {

        blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));

    }

 

    protected String getUnwrappedUnlocalizedName(String unlocalizedName)

    {

        return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);

    }

}

 

 

The Actual Fire base file

 

package com.wolfamaril.coloredflame.block;

 

import net.minecraft.world.World;

 

import java.util.Random;

 

public class BlockFireColoredBase extends BlockColoredFlame

{

    public boolean isOpaqueCube()

    {

        return false;

    }

 

    public boolean renderAsNormalBlock()

    {

        return false;

    }

 

    public int getRenderType()

    {

        return 3;

    }

 

    public int quantityDropped(Random p_149745_1_)

    {

        return 0;

    }

 

    public int tickRate(World p_149738_1_)

    {

        return 30;

    }

}

 

and one of the 16 files I'll eventually be using to make colored fries

package com.wolfamaril.coloredflame.block;

 

public class BlockFireColoredBlack extends BlockFireColoredBase {

    public BlockFireColoredBlack()

    {

        super();

        this.setBlockName("blackFire");

        this.setBlockTextureName("fireBlack");

        this.setBlockTextureName("fireBlack_Layer0");

    }

}

Link to comment
Share on other sites

Crash Report in the cut.

 

 

[11:15:59] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// Why is it breaking :(

 

Time: 12/13/14 11:15 AM

Description: Rendering item

 

java.lang.NullPointerException: Rendering item

at net.minecraft.block.BlockFire.getIcon(BlockFire.java:470)

at net.minecraft.block.Block.getBlockTextureFromSide(Block.java:686)

at net.minecraft.item.ItemBlock.getIconFromDamage(ItemBlock.java:51)

at net.minecraft.item.Item.getIconIndex(Item.java:457)

at net.minecraft.item.ItemStack.getIconIndex(ItemStack.java:131)

at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:420)

at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)

at net.minecraft.client.gui.GuiIngame.renderInventorySlot(GuiIngame.java:973)

at net.minecraftforge.client.GuiIngameForge.renderHotbar(GuiIngameForge.java:209)

at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:144)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1114)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)

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

at net.minecraft.client.main.Main.main(Main.java:164)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at GradleStart.bounce(GradleStart.java:107)

at GradleStart.startClient(GradleStart.java:100)

at GradleStart.main(GradleStart.java:55)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.block.BlockFire.getIcon(BlockFire.java:470)

at net.minecraft.block.Block.getBlockTextureFromSide(Block.java:686)

at net.minecraft.item.ItemBlock.getIconFromDamage(ItemBlock.java:51)

at net.minecraft.item.Item.getIconIndex(Item.java:457)

at net.minecraft.item.ItemStack.getIconIndex(ItemStack.java:131)

at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:420)

 

-- Item being rendered --

Details:

Item Type: net.minecraft.item.ItemBlock@2e6b2a69

Item Aux: 0

Item NBT: null

Item Foil: false

Stacktrace:

at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:585)

at net.minecraft.client.gui.GuiIngame.renderInventorySlot(GuiIngame.java:973)

at net.minecraftforge.client.GuiIngameForge.renderHotbar(GuiIngameForge.java:209)

at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:144)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player182'/23, l='MpServer', x=-1148.50, y=65.62, z=-14.50]]

Chunk stats: MultiplayerChunkCache: 0, 0

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: World: (-1151,4,-12), Chunk: (at 1,0,4 in -72,-1; contains blocks -1152,0,-16 to -1137,255,-1), Region: (-3,-1; contains chunks -96,-32 to -65,-1, blocks -1536,0,-512 to -1025,255,-1)

Level time: 455 game time, 455 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 1 total; [EntityClientPlayerMP['Player182'/23, l='MpServer', x=-1148.50, y=65.62, z=-14.50]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)

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

at net.minecraft.client.main.Main.main(Main.java:164)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at GradleStart.bounce(GradleStart.java:107)

at GradleStart.startClient(GradleStart.java:100)

at GradleStart.main(GradleStart.java:55)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_60, Oracle Corporation

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

Memory: 802491624 bytes (765 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

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

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

ColoredFlame{1.7.10-1.0.0} [Colored Flame] (ColoredFlame) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce GTX 765M/PCIe/SSE2 GL version 4.4.0 NVIDIA 344.75, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

[11:15:59] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Caleb\Desktop\Random Stuff\Minecraft\Mod Development\ColoredFlame\eclipse\.\crash-reports\crash-2014-12-13_11.15.59-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

Process finished with exit code -1

 

 

Link to comment
Share on other sites

Your constructor for BlockColoredFlame never calls super.

 

As for the crash, you overrode registerBlockIcons, but you didn't override getIcon, and BlockFire's getIcon returns an IIcon from a private array, which you didn't write into.  Or allow to be initialized at all.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.