Jump to content

Recommended Posts

Posted (edited)

https://github.com/Thegamerchunk1/x3d/blob/master/src/main/java/x3d/blocks/chromosoneblock.java

 

This block is supposed to get a set of random boolean properties that will dictate how the block will react.

 

9/10 times this block works as planned however sometimes one of the properties 'the boom property' are defined as false, yet it still goes past my if statement at `chromosoneblock#onBlockPlacedBy` because it still blows up.

If you want to try and replicate the issue simply clone the repo and build gradle, then go on a world and place a bunch of them down, youll see every now an then a block that:

  • explodes like a block with boom=true
  • has a boom value at false
  • the block isnt destroyed by the explosion, even if it has a ground material\
  • all the air blocks in the crater formed are super glitchy

 

I first tried to do a side check for the explosion to occur but the problems seems worst.

How 2 fix probwem?

Edited by Delupara
accidentally finished the topic

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted

The client and server disagree about what blockstate was placed.

 

Also:

https://github.com/Thegamerchunk1/x3d/blob/master/src/main/java/x3d/blocks/chromosoneblock.java#L82-L90

Seriously? A for-each loop where you manually track an index? Use a regular for-loop.

I mean, hell, having to do this should have clued you in.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
19 minutes ago, Draco18s said:

The client and server disagree about what blockstate was placed.

yeah thats I thought but im not entirely sure how to handle Iproperties in conjunction with sides but I did check if the world was remote, ended up by breaking the block further 

Quote

Also:

https://github.com/Thegamerchunk1/x3d/blob/master/src/main/java/x3d/blocks/chromosoneblock.java#L82-L90

Seriously? A for-each loop where you manually track an index? Use a regular for-loop.

I mean, hell, having to do this should have clued you in.

yeah that's temporary and part of an older bit of code I never changed (the loop itself that is)

Ill fix it but honestly this has little to no relation with my problem. If I need a convention critic I'll let you know.

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted
41 minutes ago, Delupara said:

yeah thats I thought but im not entirely sure how to handle Iproperties in conjunction with sides but I did check if the world was remote, ended up by breaking the block further

On the client:

make both values false

On the server:

make them random

 

When the server sends the update packet to the client (which would happen immediately) the client will become aware of the correct state.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
2 minutes ago, Draco18s said:

On the client:

make both values false

On the server:

make them random

 

When the server sends the update packet to the client (which would happen immediately) the client will become aware of the correct state.

good that should be enough info, If I get anymore issues I'll let you know!

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted

I have no idea what you're trying to do with that code.

onBlockActivated is already called by both sides.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
11 minutes ago, Draco18s said:

I have no idea what you're trying to do with that code.

Im trying to set the block with randomized values EVERY time I place it down. I simply followed the doc tutorials about networking

Quote

onBlockActivated is already called by both sides.

Thats one thing that the docs doesn't mention, It talks about sides but not what exactly gets called on them, if someone could add that info that would be hype. Also How do I tell the server to set the properties random WITHOUT block#onBlockPlacedBy?

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted (edited)
37 minutes ago, Delupara said:

Im trying to set the block with randomized values EVERY time I place it down.

I got that part. But you're sending a message to the server from onBlockActivated. This has nothing to do with that.

Quote

Thats one thing that the docs doesn't mention, It talks about sides but not what exactly gets called on them, if someone could add that info that would be hype.

Generally speaking, any method that isn't marked @SideOnly is called on both sides. I've run into a handful of cases where that's not been 100% true, but it's a good baseline.

Quote

Also How do I tell the server to set the properties random WITHOUT block#onBlockPlacedBy?

OnBlockAddedToWorld

GetStateForPlacement

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
Quote

Generally speaking, any method that isn't marked @SideOnly is called on both sides. I've run into a handful of cases where that's not been 100% true, but it's a good baseline.

Good. This and events are two things Ill make sure to focus on.

Quote

OnBlockAddedToWorld

GetStateForPlacement

and of course there's an event for blocks being placed/added. smh.

Edited by Delupara
Error 404, grammar not found.

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted
14 minutes ago, Delupara said:

Wait, Did you mean Block#OnBlockAdded?

 

There isn't a single OnBlockAddedToWorld member in my project.

Probably. The names have changed a bit.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.