Jump to content

[1.12.2] How does receiveClientEvent works?


American2050

Recommended Posts

I was looking at the TileEntityShulkerBox and I saw the method receiveClientEvent that decides when to start the OPENING / CLOSING animation of the Shulker Box.

 

My question is... What triggers this? I was trying to implement this on my own TE but that method I don't think it's getting called at all. What does Minecraft do with that block for it to get called?

PS: In the meanwhile I just moved the OPENING / CLOSING to the openInventory / closeInventory and while it is working, not sure it's the best way.

Link to comment
Share on other sites

So, it's only called on World addBlockEvent? How that gets triggered when opening a Shulker Box? (Or for the case, how do I make so it triggers on my code when I right click my block)

What you mean with no use BlockContainer? On my block I have this method

 

    @Override
    protected BlockStateContainer createBlockState() {
        return new BlockStateContainer(this, new IProperty[] { FACING });
    }

That is okey to use?

 

Edited by American2050
Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

Yes.

 

TileEntityShulkerBox, methods openInventory and closeInventory.

 

Why do you want to use it for that? That does not make much sense. This mechanism is used to communicate simple events from server to client.

 

I mean do not use the class BlockContainer.

 

How is that related to anything I said?

 

Ohh ok, I see now how they call it. Not that I want to use it, I was just seen how Vanilla does it and apply it to my Block. (There must be a reason on why the call each method in the locations they call it) Like why wouldn't they just call the Open GUI, the notification for Animations to let know it's OPENING and the PlaySound of the Shulker Box all in the same place, I don't know, why they do it like this? I don't think it's "just because" doesn't make much sense to me, I would just call everything from "onBlockActivated"

 

 

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.