Jump to content

Recommended Posts

Posted

Use

World#notifyBlockUpdate

. You can see an example of this here.

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.

Posted

Sorry to invade but there is something I never understood:

 

Use

World#notifyBlockUpdate

. You can see an example of this here.

 

getWorld().notifyBlockUpdate(getPos(), state, state, [u]3[/u]);

 

3. Where does this come from? I had no idea what to put there when I was needing to sync data, so I put Integer.MAX_VALUE.

Posted

getWorld().notifyBlockUpdate(getPos(), state, state, [u]3[/u]);

 

3. Where does this come from? I had no idea what to put there when I was needing to sync data, so I put Integer.MAX_VALUE.

 

Vanilla mostly uses 3 but it looks like the only place the argument is actually used is in

RenderGlobal#notifyBlockUpdate

, which only checks if

(flags &  != 0

. This is

false

for 3, but

true

for

Integer.MAX_VALUE

.

 

I don't fully understand the rendering code, but it looks like this value controls whether the

RenderChunk

updates now (

true

) or later (

false

).

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.

Posted

From

World#getBlockState

:

/**
* Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
* clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
* world. Flags can be added together.
*/

 

3 means it uses flags 1 and 2, so using flag 3 will cause a block update and send the changes to the client.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Those are the flags for

World#setBlockState

. Vanilla seems to use the same values for

World#notifyBlockUpdate

; but as I pointed out, only

RenderManager

(the client-side

IWorldEventListener

) checks if flag 8 is set.

PathWorldListener

(the common

IWorldEventListener

) and

WorldManager

(the server-side

IWorldEventListener

) ignore the flags completely.

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.

Posted

You're right, totally missed that. Would that be the only place flag 8 is ever checked? I haven't seen it been used anywhere else.

 

As for the flags I posted,

World#getBlockState

it's the only place in

World

with flag descriptions.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

You're right, totally missed that. Would that be the only place flag 8 is ever checked? I haven't seen it been used anywhere else.

 

That is the only place flag 8 is checked, yes.

World#markAndNotifyBlock

is the only other place that checks flags and it only checks flags 1, 2 and 4.

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.

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.