Jump to content

Switching facing texture of a block


Recommended Posts

You are probably calling world.setBlockMetadata, you need to call world.setBlockMetadataWithNotify I think.

 

I changed my code to setBlockMetadataWithNotify . The texture still doesn't update unless there is a block change nearby.

 

EDIT: I figured it out. I need to set this:

this.setRequiresSelfNotify();

Ah, yes, forgot about that, I always set that on my blocks.  :)

 

EDIT 2: OK I have another problem now. I decided NOT to use metadata to save the direction and to use the tile entity instead. After the change, the texture of the block will not change or update unless a block besides it changes. Same problem. I tried cheating by setting the block metadata into the same metadata but it doesn't work.

Setting a metadata to the same thing causes MC to skip it, thus doing nothing.  To force an update you can mark your block as needing an update, forgot what the function was called but if you check the source of the setBlockMetadataWithNotify function it calls the functions that mark a block as needing to be updated like that, just call whatever functions it calls, but directly.

Link to comment
Share on other sites

there is a method that is called something  along the lines of needsUpdate() that needs to return true

 

here some things i found that might help

public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {}

protected Block setLightOpacity(int par1)
    {
        lightOpacity[this.blockID] = par1;
        return this;
    }

public boolean isOpaqueCube()
    {
        return false;
    }

public boolean renderAsNormalBlock()
    {
        return false;
    }

private Set blocksNeedingUpdate = new HashSet();
his.blocksNeedingUpdate.add(new ChunkPosition(par2, par3, par4));

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.