Jump to content

[SOLVED]Interact with TileEntity/its NBT from Client classes


3059673

Recommended Posts

What way is correct to do the subject manipulation ? Just usual interaction like tile.doSuff() or via packets ? My case is tile's rendering class that implements TileEntitySpecialRenderer. It has my TileEntity class on input (renderAModelAt) . I need to do it so i can change my tile's rendering system, checking tile's nbt. But it always works incorrectly.

Link to comment
Share on other sites

NBT data is not synced between the client and server. So if you change anything on the server you will need to send a packet to inform the client that it's changed.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

@Override
    public Packet getDescriptionPacket(){
        NBTTagCompound tag = new NBTTagCompound();
        writeToNBT(tag);
        return new Packet132TileEntityData(xCoord, yCoord, zCoord, 0, tag);
    }

@Override
    public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt){
        readFromNBT(pkt.data);
    }

public void sendDescriptionPacket(){
        PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 64D, worldObj.provider.dimensionId, getDescriptionPacket());
    }

sendDescriptionPacket() is a 'homemade' method with which you can send the nbt packet to the client whenever you want. The fewer packets you send the better though. So the best that you can do is simulating the same behaviour on the client and on the server and only send a packet when you know the client will be desynched.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://www.reddit.com/r/boxon2joe/comments/16q4lvd/𝚁edditstreams_joe_joyce_vs_zhilei_zhang_2_live/ https://www.reddit.com/r/boxon2joe/comments/16q4okk/𝚁edditstreams_zhilei_zhang_vs_joe_joyce_2_live/ https://www.reddit.com/r/boxon2joe/comments/16q4qfg/crackstreamsjoe_joyce_vs_zhilei_zhang_2_live/ https://www.reddit.com/r/boxon2joe/comments/16q4rzs/heres_how_to_watch_joe_joyce_vs_zhilei_zhang_2/  
    • https://club.vexanium.com/post/https-www-reddit-com-r-ncaafreditw4-comments-16q3tkg-f0-9d-9a-81edditstream--650ee3124fb9af2ddeb8223d https://www.bitsdujour.com/profiles/NyikSV https://codepen.io/Smart-Cast-Official/pen/PoXQeXp https://jsfiddle.net/0jmc9xvr/ https://notes.io/qEjih https://www.click4r.com/posts/g/12048983/ https://yamcode.com/untitled-82797 https://paiza.io/projects/ycxhnoOyQ4cGsya-C57dYQ?language=php
    • I have made a server and am trying to use the mods from "Medieval Minecraft [FORGE] 1.19.2 MMC3", but am getting this error after fixing a few other easy ones. I can't find anything relevant after around 1 hour of searching, so has anyone got any suggestions?
    • https://www.reddit.com/r/NcAAf4Reddit/comments/16q2ss7/𝚁edditstreams_smu_vs_tcu_live_stream_free𝚁eddit/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2ux9/𝚁edditstreams_tcu_vs_smu_live_stream_free𝚁eddit/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2vgt/𝚁edditstreams_northern_illinois_vs_tulsa_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2w1t/𝚁edditstreams_tulsa_vs_northern_illinois_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2y1t/𝚁edditstreams_western_michigan_vs_toledo_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2z5b/𝚁edditstreams_toledo_vs_western_michigan_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q2zzw/𝚁edditstreams_georgia_southern_vs_ball_state_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q30oo/𝚁edditstreams_ball_state_vs_georgia_southern_live/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q31z2/𝚁edditstreams_colorado_vs_oregon_live_stream/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q32qx/𝚁edditstreams_oregon_vs_colorado_live_stream/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q33am/𝚁edditstreams_ucla_vs_utah_live_stream_free𝚁eddit/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q344h/𝚁edditstreams_utah_vs_ucla_live_stream_free𝚁eddit/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q34ot/𝚁edditstreams_ole_miss_vs_alabama_live_stream/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q35lq/𝚁edditstreams_alabama_vs_ole_miss_live_stream/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q3666/𝚁edditstreams_duke_vs_uconn_live_stream/ https://www.reddit.com/r/NcAAf4Reddit/comments/16q36ss/𝚁edditstreams_uconn_vs_duke_live_stream/ https://paiza.io/projects/cuIJ_ExWsr7JZ2Vl-kjXfA https://paiza.io/projects/Hi2wNuh2Zp-FOmUtWmVo_Q https://forum.contentos.io/topic/276440/sadsad-sad-sa  
    • UPDATE -   Got the game to work, but when I tried to make a new world it would crash. I had not enough crashes on and tried it with off, gave the same result. it would save my world and crash.   Logs: https://crashy.net/3f543731-629c-482d-9772-4e5fbc95a37a  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.