Jump to content

[1.12.2] #onBlockPlacedBy not working clientside


BeardlessBrady

Recommended Posts

My block is supposed to save the block placer as the owner when it is placed which it does correctly on both client and server side but when checking it afterwords anywhere else it only shows up server-side. Anyone know why?

 

https://github.com/BeardlessBrady/Currency-Mod/blob/master-2-1.12/src/main/java/beardlessbrady/modcurrency/block/vending/BlockVending.java#L61

 

 

Edited by BeardlessBrady
Link to comment
Share on other sites

I was playing around with things since it wasn't saving correctly, saving it as a string was one of those things.

I have tried adding tile.markDirty() after setting owner but it doesn't seem to have changed anything, what exactly do I need to do to re-send the packet?

 

https://github.com/BeardlessBrady/Currency-Mod/blob/64b43d05b8e67f0b6ae469889cd5823ae05ff23d/src/main/java/beardlessbrady/modcurrency/block/vending/BlockVending.java#L62

Link to comment
Share on other sites

Background: I have a base tile entity I extend the tile entity off of which is where the owner is created and saved via NBT stuff.

 

Peculiarly if I move the NBT stuff for the owner to the main tile not the one its extended everything works fine despite the nbt methods running super first? 

 

EDIT: I figured it out. So when @Overriding #getUpdatePacket() I was just doing:

super.getUpdatePacket();
NBTTagCompound compound = new NBTTageCompound;

but I didn't realize that wasn't using the super's method correctly so I changed it to:

NBTTagCompound compound = super.getUpdatePacket().getNbtCompound();

 

Thanks for trying to help!

Edited by BeardlessBrady
Link to comment
Share on other sites

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.