Jump to content

[1.8] [SOLVED] Model Bake Event + world.getTileEntity() returns null


Tyron

Recommended Posts

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?

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.