Jump to content

Recommended Posts

Posted

So I'm trying to make a tileentity so I can have 1 block with multiple "states" instead of using 41 block ids.

Atm it crashes as soon as I try to : Craft one of the blocks or go to my creative tab.

 

Here is the crashreport:

 

---- Minecraft Crash Report ----

// My bad.

 

Time: 2014-04-12 17:05

Description: Rendering item

 

java.lang.NullPointerException: Rendering item

at keeperofmee.minecraft.colorblocks.colors.CbColorBlock.getIcon(CbColorBlock.java:102)

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

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

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

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

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

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

at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:305)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:132)

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

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

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

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

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

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

 

 

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

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

 

-- Head --

Stacktrace:

at keeperofmee.minecraft.colorblocks.colors.CbColorBlock.getIcon(CbColorBlock.java:102)

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

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

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

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

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

 

-- Item being rendered --

Details:

Item Type: net.minecraft.item.ItemBlock@4e569e3b

Item Aux: 0

Item NBT: null

Item Foil: false

Stacktrace:

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

at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:305)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:132)

 

-- Screen render details --

Details:

Screen name: net.minecraft.client.gui.inventory.GuiCrafting

Mouse location: Scaled: (282, 140). Absolute: (847, 658)

Screen size: Scaled: (640, 360). Absolute: (1920, 1080). Scale factor of 3

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player463'/360, l='MpServer', x=-2,80, y=69,62, z=271,46]]

Chunk stats: MultiplayerChunkCache: 225, 225

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (-8,64,270), Chunk: (at 8,4,14 in -1,16; contains blocks -16,0,256 to -1,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 2952 game time, 2952 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: 92 total; [EntitySheep['Sheep'/275, l='MpServer', x=70,84, y=70,00, z=315,31], EntityBat['Bat'/137, l='MpServer', x=-45,76, y=13,62, z=260,44], EntityZombie['Zombie'/274, l='MpServer', x=72,50, y=43,00, z=310,50], EntityCreeper['Creeper'/273, l='MpServer', x=76,50, y=40,00, z=307,97], EntitySheep['Sheep'/139, l='MpServer', x=-51,78, y=67,00, z=250,25], EntityCreeper['Creeper'/138, l='MpServer', x=-43,50, y=44,00, z=247,50], EntitySheep['Sheep'/141, l='MpServer', x=-41,09, y=66,00, z=256,53], EntitySheep['Sheep'/140, l='MpServer', x=-32,84, y=64,00, z=241,16], EntitySheep['Sheep'/277, l='MpServer', x=77,91, y=64,00, z=333,59], EntityZombie['Zombie'/143, l='MpServer', x=-33,50, y=31,00, z=285,50], EntityBat['Bat'/276, l='MpServer', x=75,18, y=31,29, z=323,39], EntitySheep['Sheep'/142, l='MpServer', x=-33,94, y=66,00, z=262,97], EntityMinecartChest['entity.MinecartChest.name'/129, l='MpServer', x=-53,50, y=35,50, z=346,50], EntitySquid['Squid'/128, l='MpServer', x=-59,31, y=55,00, z=335,50], EntitySheep['Sheep'/286, l='MpServer', x=74,16, y=64,00, z=223,13], EntityCreeper['Creeper'/258, l='MpServer', x=51,44, y=40,00, z=307,50], EntitySheep['Sheep'/259, l='MpServer', x=55,16, y=68,00, z=307,69], EntitySheep['Sheep'/257, l='MpServer', x=56,75, y=69,00, z=273,75], EntitySheep['Sheep'/260, l='MpServer', x=65,19, y=69,00, z=303,09], EntityItem['item.item.seeds'/158, l='MpServer', x=-20,59, y=62,13, z=238,06], EntitySheep['Sheep'/159, l='MpServer', x=-21,78, y=67,00, z=268,38], EntityBat['Bat'/144, l='MpServer', x=-35,29, y=32,67, z=284,65], EntitySheep['Sheep'/267, l='MpServer', x=76,53, y=64,00, z=206,25], EntitySkeleton['Skeleton'/145, l='MpServer', x=-39,50, y=44,00, z=292,50], EntitySpider['Spider'/146, l='MpServer', x=-39,84, y=39,00, z=333,16], EntitySkeleton['Skeleton'/147, l='MpServer', x=-34,84, y=39,00, z=332,66], EntitySheep['Sheep'/270, l='MpServer', x=66,72, y=68,00, z=256,25], EntitySkeleton['Skeleton'/148, l='MpServer', x=-38,00, y=39,00, z=334,69], EntitySheep['Sheep'/271, l='MpServer', x=66,81, y=70,00, z=268,88], EntitySkeleton['Skeleton'/149, l='MpServer', x=-37,50, y=39,00, z=333,50], EntitySheep['Sheep'/268, l='MpServer', x=70,59, y=64,00, z=194,50], EntitySheep['Sheep'/269, l='MpServer', x=64,63, y=69,00, z=255,97], EntityZombie['Zombie'/163, l='MpServer', x=-29,63, y=38,00, z=325,69], EntitySkeleton['Skeleton'/162, l='MpServer', x=-20,50, y=41,00, z=308,50], EntityCreeper['Creeper'/161, l='MpServer', x=-31,50, y=30,00, z=305,50], EntitySkeleton['Skeleton'/160, l='MpServer', x=-25,50, y=34,00, z=290,50], EntityBat['Bat'/186, l='MpServer', x=-0,13, y=48,68, z=310,82], EntityCreeper['Creeper'/187, l='MpServer', x=-4,41, y=48,00, z=312,00], EntitySheep['Sheep'/184, l='MpServer', x=-16,28, y=68,00, z=293,16], EntitySheep['Sheep'/185, l='MpServer', x=-5,50, y=68,00, z=280,06], EntityBat['Bat'/190, l='MpServer', x=-3,20, y=38,85, z=343,80], EntityBat['Bat'/191, l='MpServer', x=2,78, y=39,29, z=349,52], EntitySheep['Sheep'/188, l='MpServer', x=-4,66, y=68,00, z=306,75], EntityBat['Bat'/189, l='MpServer', x=-1,29, y=42,07, z=330,98], EntitySheep['Sheep'/182, l='MpServer', x=-7,56, y=67,00, z=196,53], EntitySheep['Sheep'/183, l='MpServer', x=-9,09, y=67,00, z=276,13], EntityItem['item.tile.flower2.poppy'/205, l='MpServer', x=12,38, y=66,13, z=282,06], EntityItem['item.item.seeds'/204, l='MpServer', x=5,78, y=69,13, z=278,59], EntityItem['item.tile.flower2.poppy'/207, l='MpServer', x=13,63, y=68,13, z=272,72], EntityItem['item.tile.flower2.poppy'/206, l='MpServer', x=15,22, y=66,13, z=278,41], EntitySheep['Sheep'/201, l='MpServer', x=13,91, y=64,00, z=197,13], EntitySheep['Sheep'/203, l='MpServer', x=2,41, y=70,00, z=263,34], EntitySheep['Sheep'/202, l='MpServer', x=8,19, y=68,00, z=211,81], EntitySheep['Sheep'/192, l='MpServer', x=-2,75, y=65,00, z=350,19], EntityZombie['Zombie'/216, l='MpServer', x=0,50, y=41,00, z=339,50], EntitySkeleton['Skeleton'/217, l='MpServer', x=1,50, y=41,00, z=341,50], EntitySkeleton['Skeleton'/218, l='MpServer', x=1,50, y=38,00, z=347,50], EntitySkeleton['Skeleton'/219, l='MpServer', x=1,50, y=38,00, z=346,50], EntitySkeleton['Skeleton'/212, l='MpServer', x=14,00, y=51,00, z=315,47], EntitySheep['Sheep'/213, l='MpServer', x=6,97, y=69,00, z=313,06], EntityZombie['Zombie'/214, l='MpServer', x=2,50, y=41,00, z=340,50], EntityZombie['Zombie'/215, l='MpServer', x=0,50, y=41,00, z=341,50], EntityItem['item.tile.flower2.poppy'/208, l='MpServer', x=7,44, y=69,13, z=279,81], EntityItem['item.tile.flower2.poppy'/209, l='MpServer', x=6,25, y=69,13, z=280,47], EntityCreeper['Creeper'/210, l='MpServer', x=0,72, y=32,00, z=315,94], EntityBat['Bat'/211, l='MpServer', x=-5,46, y=47,83, z=295,42], EntityZombie['Zombie'/103, l='MpServer', x=-67,91, y=42,00, z=205,47], EntitySheep['Sheep'/237, l='MpServer', x=22,47, y=67,00, z=346,22], EntitySheep['Sheep'/236, l='MpServer', x=15,03, y=67,00, z=340,97], EntitySheep['Sheep'/235, l='MpServer', x=20,78, y=64,00, z=337,63], EntitySheep['Sheep'/234, l='MpServer', x=18,50, y=65,00, z=331,28], EntitySheep['Sheep'/233, l='MpServer', x=19,53, y=64,00, z=333,44], EntitySkeleton['Skeleton'/232, l='MpServer', x=25,50, y=40,00, z=317,50], EntitySkeleton['Skeleton'/110, l='MpServer', x=-68,50, y=41,00, z=322,50], EntityZombie['Zombie'/231, l='MpServer', x=31,50, y=42,00, z=307,41], EntitySkeleton['Skeleton'/108, l='MpServer', x=-68,03, y=41,00, z=312,75], EntitySkeleton['Skeleton'/109, l='MpServer', x=-68,38, y=41,00, z=317,59], EntityBat['Bat'/106, l='MpServer', x=-77,49, y=45,00, z=296,44], EntitySkeleton['Skeleton'/107, l='MpServer', x=-67,41, y=41,00, z=316,84], EntitySheep['Sheep'/250, l='MpServer', x=44,72, y=67,00, z=309,84], EntitySheep['Sheep'/251, l='MpServer', x=44,69, y=67,00, z=308,59], EntitySheep['Sheep'/248, l='MpServer', x=40,03, y=67,00, z=308,06], EntityCreeper['Creeper'/112, l='MpServer', x=-74,50, y=35,00, z=346,50], EntitySheep['Sheep'/249, l='MpServer', x=40,06, y=66,00, z=319,06], EntitySheep['Sheep'/127, l='MpServer', x=-52,34, y=66,00, z=276,78], EntitySheep['Sheep'/126, l='MpServer', x=-58,06, y=69,00, z=261,06], EntitySheep['Sheep'/125, l='MpServer', x=-47,16, y=67,00, z=254,75], EntitySheep['Sheep'/124, l='MpServer', x=-53,22, y=68,00, z=260,28], EntitySheep['Sheep'/123, l='MpServer', x=-61,06, y=65,00, z=231,84], EntityClientPlayerMP['Player463'/360, l='MpServer', x=-2,80, y=69,62, z=271,46], EntitySkeleton['Skeleton'/122, l='MpServer', x=-62,25, y=40,00, z=217,31], EntitySkeleton['Skeleton'/121, l='MpServer', x=-56,50, y=42,00, z=209,91]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

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

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

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

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

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 net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

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

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_51, Oracle Corporation

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

Memory: 738268032 bytes (704 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

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

AABB Pool Size: 13974 (782544 bytes; 0 MB) allocated, 1301 (72856 bytes; 0 MB) used

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

FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active

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

FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

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

ColorBlocks{1.1} (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: GeForce GTX 660/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation

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: 2043 (114408 bytes; 0 MB) allocated, 295 (16520 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

It's probably something stupid I've overlooked..

MyItemBlock:

 

package keeperofmee.minecraft.mymod.javafiles;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.IIcon;

public class MyItemBlock extends ItemBlock {

	public MyItemBlock(Block par1)
	{
		super(par1);
		setMaxDamage(41);
		setHasSubtypes(true);

	}

	@SideOnly(Side.CLIENT)
	public IIcon getIconFromDamage(int par1) //Gets the texture
	{
		return MyBlock.getBlockFromItem(this).getIcon(2, par1);

	}	


}

 

 

MyBlock:

 

package keeperofmee.minecraft.mymod.javafiles;



import java.util.List;
import  keeperofmee.minecraft.mymod.javafiles.Modfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class MyBlock extends Block implements ITileEntityProvider
{

public static IIcon[] IconArray;
public static String[] IconNames = {"Black","MultiColor","Blue","Brown","Cyan","DarkGreen","Green","Grey","LightBlue","LightBrown","LightGrey","LightPurple","LimeGreen","Magenta","Orange","Pink","Purple","Red","White","WineRed","Yellow","RedOrange","LightOrange","WhitePink","SharpPink","LightPurpleBlue","PurpleBlue","BlueishWhite","LightCyan","GreenishCyan","YellowishGreen","LightYellow","LightOrangeRed","WhitePurple","DarkYellow","DarkCyan","DarkPurple","DarkBlueishCyan","DarkBrownishRed","DarkCyanishGreen","DarkBlue","DarkGrey"};


public MyBlock() {
super(Material.wood);
setResistance(50F);
setHardness(0.1F);
setStepSound(Block.soundTypeStone);
setLightLevel(1F);
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
this.setLightOpacity(0);
setCreativeTab(ColorBlocks.colorblockTab);

}



@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack)
{
TileEntityMyBlock tile = (TileEntityMyBlock)world.getTileEntity(x, y, z);
TileEntityMyBlock.state = itemStack.getItemDamage();
}

@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
TileEntity tile = world.getTileEntity(x, y, z);
if ((tile instanceof TileEntityMyBlock)) {
TileEntityMyBlockglass = (TileEntityMyBlock)tile;
return new ItemStack(this, 1, glass.state);
}
return super.getPickBlock(target, world, x, y, z);
}

@Override
public void onBlockHarvested(World world, int x, int y, int z, int par5, EntityPlayer par6EntityPlayer)
{
TileEntity tile = world.getTileEntity(x, y, z);
if ((tile instanceof TileEntityMyBlock)) {
TileEntityMyBlock.state = ((TileEntityMyBlock)tile).state;
}
}

@Override
public int damageDropped(int metadata)
{
return TileEntityMyBlock.state;
}

public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityMyBlock();
}

@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4){
super.onBlockAdded(par1World, par2, par3, par4);
}
public boolean isOpaqueCube()
{
return false;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
this.IconArray = new IIcon[iconNames.length];
for(int i=0;i<IconNames.length;i++){
System.out.println(ColorBlocks.modid + ":" + this.IconNames[i]);
this.IconArray[i] = par1IconRegister.registerIcon(ColorBlocks.modid + ":" + this.IconNames[i]);
}
}

public IIcon getIcon(int par1, int par2)
{
return this.IconArray[par2];
}

@SideOnly(Side.CLIENT)
public void getSubItems(Block b, CreativeTabs tab, List itemList)
{
for(int i=0;i<3;i++){
itemList.add(new ItemStack(b,1,i));
}
}
}[/Code]

 

 

TileEntityMyBlock:

 

[Code]package keeperofmee.minecraft.mymod.javafiles;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class TileEntityMyBlock extends TileEntity {

public static int state = 0;

@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.state = nbt.getInteger("state") & 0xFF;
}

@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("state", this.state);
}

public static int getState(){
return state;
}
}[/Code]

 

 

Note: I've changed filenames.

If I helped please press the Thank You button.

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.