Jay Avery Posted June 24, 2017 Share Posted June 24, 2017 (edited) I feel like this must be something really obvious, because it seems very basic. I've got a custom door (which does not subclass vanilla BlockDoor - I'm adding and changing a lot of functionality so it's easiest to do from scratch), which opens and closes on right-click (as vanilla). In singleplayer this works fine, but in multiplayer there is a weird syncing problem. Visually, the door appears not to change its state - the model and the highlight bounding box stay the same. But the state does change on the server - if you try to walk through the door after 'closing' it (even though it still looks open), you bump into it (in a glitchy, jerky way), and can't get through. Here is my onBlockActivated. Spoiler @Override public boolean onBlockActivated(World world, BlockPos thisPos, IBlockState thisState, EntityPlayer player, EnumHand hand, EnumFacing side, float x, float y, float z) { BlockPos otherPos = thisState.getValue(TOP) ? thisPos.down() : thisPos.up(); IBlockState otherState = world.getBlockState(otherPos); if (otherState.getBlock() != this || world.isRemote) { return false; } thisState = thisState.cycleProperty(OPEN); world.setBlockState(thisPos, thisState); world.setBlockState(otherPos, otherState .withProperty(OPEN, thisState.getValue(OPEN))); world.playEvent(player, thisState.getValue(OPEN) ? 1006 : 1012, thisPos, 0); return true; } I was under the impression that setBlockState by default synchronises the state change with the client - and I've stepped through in the debugger and seen that it does reach notifyBlockUpdate. So I don't understand why it doesn't seem to be updating properly? The whole class is here (along with the rest of my code). Edited June 26, 2017 by Jay Avery Quote Link to comment Share on other sites More sharing options...
Jay Avery Posted June 26, 2017 Author Share Posted June 26, 2017 Bump! Someone please tell me there's a foolishly obvious solution Quote Link to comment Share on other sites More sharing options...
Jay Avery Posted June 26, 2017 Author Share Posted June 26, 2017 Well, I found the foolishly obvious solution. I had screwed up my getMetaFromState/getStateFromMeta so the state wasn't being stored or sent server->client correctly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.