Posted September 14, 201510 yr Hello, i was trying to add a TileEntity for my new block in order to store more informations, but when trying to save the world, i always got this exception: [server thread/ERROR] [FML]: A TileEntity type com.redintegrated.RedIntegratedMod.TileEntities.TileEntityPin has throw an exception trying to write state. It will not persist. Report this to the mod author java.lang.RuntimeException: class com.redintegrated.RedIntegratedMod.TileEntities.TileEntityPin is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:96) ~[TileEntity.class:?] at com.redintegrated.RedIntegratedMod.TileEntities.TileEntityPin.writeToNBT(TileEntityPin.java:35) ~[TileEntityPin.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:395) [AnvilChunkLoader.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:204) [AnvilChunkLoader.class:?] at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:287) [ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:340) [ChunkProviderServer.class:?] at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:863) [WorldServer.class:?] at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:370) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:113) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Thanks for Choonster's help, i forgot to register the tileentity. what a silly mistake Orz
September 14, 201510 yr Author For sure, here is the class using this TileEntity: package com.redintegrated.RedIntegratedMod.Blocks; import java.util.Random; import com.redintegrated.RedIntegratedMod.TileEntities.TileEntityPin; 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.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class blockPin extends Block implements ITileEntityProvider{ @SideOnly(Side.CLIENT) private IIcon[] topIcons; @SideOnly(Side.CLIENT) private IIcon sideIcon; public blockPin(int id, Material mat) { super(mat); this.setHardness(7.0F); this.setResistance(2000.0F); this.setCreativeTab(IntegratedBlocks.tabIntegratedBlocks); this.setBlockName(BlockInfo.PIN_UNLOCALIZED_NAME); this.setHarvestLevel("pickaxe", 2); this.setLightLevel(0.3F); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { topIcons = new IIcon[blockInfo.PIN_TOPICON.length]; for(int i = 0; i < topIcons.length; ++i) { topIcons[i] = reg.registerIcon(BlockInfo.RESOURCE_LOCATION + ":" + BlockInfo.PIN_TOPICON[i]); } sideIcon = reg.registerIcon(BlockInfo.RESOURCE_LOCATION + ":" + BlockInfo.PIN_SIDEICON); } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) { TileEntity te = world.getTileEntity(x, y, z); if (te != null && te instanceof TileEntityPin) { TileEntityPin te_Pin = (TileEntityPin)te; int dir = ((MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; te_Pin.setOrientation(dir); } } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { switch (side) { case 0: return sideIcon; case 1: return topIcons[0]; default: return sideIcon; } } @Override public boolean canProvidePower() { return true; } @Override public int isProvidingStrongPower(IBlockAccess ba, int x, int y, int z, int meta) { if (meta / BlockInfo.PIN_TYPE_MOD == 1) { return 1; } else { return 0; } } @Override public Item getItemDropped(int meta, Random rand, int fortune) { return BlockInfo.PIN_DROP; } public boolean isOutPut(int meta) { return (meta > 3); } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityPin(); } @Override public int getRenderType() { return BlockInfo.Pin_RenderID; } }
September 14, 201510 yr The exception tells you exactly what went wrong: your TileEntityPin class doesn't have a mapping. You need to register it with GameRegistry.registerTileEntity . Side note: Package names should be all lowercase. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
September 14, 201510 yr Author The exception tells you exactly what went wrong: your TileEntityPin class doesn't have a mapping. You need to register it with GameRegistry.registerTileEntity . Side note: Package names should be all lowercase. tyvm.... just figured out that i have forgot to register it Orz. and thx for the hint
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.