Tyron Posted December 24, 2014 Posted December 24, 2014 Currently having problems getting TEs to work and I'm out of ideas for the cause. I've got a TEOre class extending from Tileentity featuring basically the same functions as the CustomeTileEntity in ModelBakeEventDebug.java During the FMLInitializationEvent I do GameRegistry.registerTileEntity(TEOre.class, ModInfo.ModID + ":orete"); My Block Class BlockOreVC extends from BlockContainer and creates the tile entity @Override public TileEntity createNewTileEntity(World world, int meta) { return new TEOre(); } @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { TileEntity te = world.getTileEntity(pos); if(te instanceof TEOre) { TEOre cte = (TEOre) te; return cte.getState(); } else { if (te == null) { System.out.println("getExtendedState() Error: tileentity is null!"); } else { System.out.println("getExtendedState() Error: te is NOT of instance TEOre at pos " + pos); } } return state; } @Override protected BlockState createBlockState() { return new ExtendedBlockState(this, new IProperty[0], TEOre.properties); } I create the blocks in WorldGenDeposits like this: world.setBlockState(pos, deposit.block.getDefaultState(), 2); if (deposit.block instanceof BlockOreVC) { TEOre tileentity = (TEOre)world.getTileEntity(pos); if(tileentity != null) { tileentity.setOreType(deposit).setRockType((EnumRockType)parentmaterial.getValue(BlockRock.STONETYPE)); } else { System.out.println("tileentity was not created?"); } } When generating a new world however the call to getExtendedState() will return null for world.getTileEntity(pos); I dont understand why because during creation I can access the tileentity and modify it's state. Am I missing some client <=> server stuff for tileentities to work? Quote
Tyron Posted December 25, 2014 Author Posted December 25, 2014 Ok, I got it resolved. Thanks anyhow. Quote
Recommended Posts
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.