Jump to content

[SOLVED][1.10] Tileentity calling writetonbt() only on server side


Xerus

Recommended Posts

I am having some really annoying difficultied with my Tileentity, and now I've found the problem: writetonbt() is only called on server side, while readfromnbt() is called on both server and client, and this is just making madness. Have been sitting here for 2 hours trying to find a solution...

 

 

	
String keys = new String[]{"fuel","lastfuel","yoffset"}
@Override
    public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);
        if(name!="bulkcore"){
        	NBTTagList list = new NBTTagList();
        for (int i = 0; i < this.getSizeInventory(); ++i) {
            if (this.getStackInSlot(i) != null) {
                NBTTagCompound stackTag = new NBTTagCompound();
                stackTag.setByte("Slot", (byte) i);
                this.getStackInSlot(i).writeToNBT(stackTag);
                list.appendTag(stackTag);
            }
        }
        nbt.setTag("Items", list);
        }
        if (this.hasCustomName()) nbt.setString("CustomName", this.getCustomName());
        for(int i=0;i<keys.length;i++){
        	nbt.setInteger(keys[i],this.getField(i));
        }
    	System.out.println(keys[0]+" written to "+nbt.getInteger("fuel"));
	return nbt;
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);
        NBTTagList list = nbt.getTagList("Items", 10);
        for (int i = 0; i < list.tagCount(); ++i) {
            NBTTagCompound stackTag = list.getCompoundTagAt(i);
            int slot = stackTag.getByte("Slot") & 255;
            this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag));
        }
        if (nbt.hasKey("CustomName")) this.setCustomName(nbt.getString("CustomName"));
        for(int i=0;i<keys.length;i++){
        	String key=keys[i];
            if(nbt.hasKey(key)) this.setField(i,nbt.getInteger(key));
        }
    	System.out.println(keys[0]+" read to "+nbt.getInteger("fuel"));
    }

 

notice these sysout commands?

the console outputs of these:

[21:06:09] [server thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:readFromNBT:77]: fuel read to 50

[21:06:15] [Client thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:readFromNBT:77]: fuel read to 0

...

[21:07:06] [server thread/INFO] [sTDOUT]: [com.xerus.simpleautomation.te.TEInventory:writeToNBT:59]: fuel written to 50

 

and now my gui displays the client value while my tileentity is using a bit of both...

 

Link to comment
Share on other sites

That is what is supposed to happen, you need to override onDescriptionPacket and getDescriptionPacket (not sure if i got those names right) in your TE's class.

 

*Edit that is for syncing client and server.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Modify thread (main/1st) post and change title with "[sOLVED]" (changing non-main post will not rename whole thread).

 

While I personally appreciate doing above - most ppl don't really care, thus it kinda kills the idea of doing it (I wish WM would add some features like that).

1.7.10 is no longer supported by forge, you are on your own.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ワールドカップチャンピオンリーグサイト♩BCGAME33·COM※西アフリカチャンピオンリーグリーグワールドカップマリチャンピオンリーグ募集[本社お問い合わせテレJBOX7]ワールドカップチャンピオンリーグ▽↙カジノパブエチオピアチャンピオンリーグ総販ワールドカップマルタW杯チャンピオンリーグ[総販お問い合わせカカオトークJBOX7]ワールドカップチャンピオンリーグ★↘♨旅行オーストラリアチャンピオンシップ募集W杯グランドレスカジノW杯チャンピオンリーグツアー[各種オフィコミュニティ制作]W杯チャンピオンシップ □◁住所ハンガリーチャンピオンシップW杯セルビアW杯チャンピオンシップコミュニティ[マーケティングお問い合わせ]W杯チャンピオンシップ 動画南アフリカ共和国カジノパブワールドカップサッカースタジアム チャンピオンリーグ◈§ 遊び場トランプタジマハルカジノチャンピオンリーグサイトワールドカップサンシティワールドカップチャンピオンリーグ試合[スポーツ本社]ワールドカップチャンピオンリーグ▧▒試合南アメリカチャンピオンリーグ動画ワールドカップ日本ワールドカップチャンピオンリーグゲーム[トト本社お問い合わせ]ワールドカップチャンピオンリーグ♭◈ホールダンバ東ティモールチャンピオンリーグ検証W杯サハラワールドカップチャンピオンシップバーカラパブ[トト総販購入]W杯チャンピオンシップ◑⊙キャッシュゲームMGMカジノチャンピオンシップゲーム[カジノ総販]W杯チャンピオンシップゲーム↔動画コンゴチャンピオンズパレスカジノW杯 シザーズパレスカジノW杯チャンピオンシップ動画 ヨルダンW杯チャンピオンリーグ動画[バッカラ総販]ワールドカップチャンピオンリーグ♨§ YouTubeグランドレスカジノチャンピオンリーグ映像ワールドカップスイスW杯チャンピオンリーグ接続[競馬総販]モーリシャスチャンピオンリーグ戦略キリバスチャンピオンリーグホールダンパブ[BCGAMEBCゲーム総販お問い合わせ]お知らせ設定おすすめ購読いいですね
    • 鹿儿岛不要碰面网站◐BCGAME55·COM♡鹿儿岛不要碰面视频freestyle 鹿儿岛不要碰面 Kakao Talk 奥运会不要碰面 Kakao Talk 网球不要碰面故事[本社咨询的 Tele @JBOX7] 鹿儿岛不要碰面旅行 网络游戏 鹿儿岛不要碰面 Twitter 足球不要碰面 新地址 水营 JBOX7] [总经销的 Kakao Talk JBOX7] 不要碰到 Jo Man Jo Jo Jo Man Jo Jo Mo Mo Man Man Man 板球鹿儿岛不要碰面视频诱导、不要碰面、验证橄榄球、不要碰面、推特[赌场总公司]鹿儿岛不要碰面、线冰球、鹿儿岛不要碰面、故事性摔跤、不要碰碰碰面TikTokkitkitok拳头见面线[体育总公司]鹿儿岛不要碰面联谊会包奇亚东赛艇招人广告跆拳道不要碰面Toktoktoktoktoktoktiktiktik-kitkitkitkitkitketing(体育总公司)、Talk talk toggo talk talk talk talk 鹿儿岛不要碰面度假村单杠不要碰面巡回手球不要碰面联谊会【山藤总公司】鹿儿岛不要碰面总经销速度 鹿儿岛不要碰面推荐 巴西柔术不要碰面 Telegram 不要碰面 Vochi不要碰面 视频【Bakara总经销】鹿儿岛不要碰到手球 故事 乒乓球 不要碰到 广播 【京马总经总经总经总经销】 验证GTelegram Bo-Bo-Bo-Bo-Bo-Bo-Bo-Maeaeaeaeae-Bae
    • メジャー競馬おすすめ†BCGAME33·COM◈コスタリカ競馬カジノパブメジャーブルンジ競馬クープーン[本社お問い合わせテレJBOX7]メジャー競馬 ◁⊙™遊び場 コンゴ民主競馬ポーカー大会メジャー中央アフリカメジャー競馬ホールダンバー[総販お問い合わせカカオトークJBOX7]メジャー競馬▥(株)コミュニティアゼルバイジャン競馬YouTubeメジャー[各種オフィコミュニティ制作]メジャー競馬→▧賭博場オーストリア競馬旅行メージャー東アジアメージャー競馬動画[マーケティングお問い合わせ]大蔵 東京都知事 おすすめ カタルバドポテト映像 [マーケティングお問い合わせ] [スポーツ本社]メジャー競馬◑▒バカラパブジンバブエ競馬映像メジャーアトランティスカジノメジャー競馬メーカー[ト本社お問い合わせ]メジャー競馬◎★接続フランス競馬募集メジャーコスタリカメジャー競馬ホールダンパブ[トト総販購入]メジャー競馬▒☆旅行アリアカジノ競馬戦略メジャーアラブ首長国連邦大京急クープン[カジノ総販]大京西アジア競馬検証メージャカザフスタン大京急ホールダンパブ[大和本社]大京急所中央アフリカ競馬ホールダンパブ[大和本社]大京急場]大京急場 セントカラーバーガンパップ コートジボワール競馬本社 [BCGAME BCゲーム総販お問い合わせ] お知らせ設定おすすめ購読いいですね
    • 宫崎纱窗街链接●BCGAME55·COMº 宫崎纱窗街Telegram Sugu宫崎纱窗街Instagram 网球纱窗街口人广告曲棍球 曲棍球 糖球 纱窗街 链接[本社文的Tele @JBOX7] 宫崎纱窗推荐的扔窗人 Sagram Nordic Sagram Free Suggram Sugu[总经销文的Kaka Kakao Talk JBOX7] 米崎纱窗台球 Sagram Sagram Sagram sangkyaki Instagem 推特 [赌场总公司] 宫崎纱窗边 单杠 宫崎纱窗边 视频 足球 纱窗边 社区 美式足球 纱窗边视频 [体育总公司]宫崎纱窗边 Tik Tok铁峰宫崎纱窗 Line 马术边唱 Youtube滑雪边唱 Youtube[TOTO总公司咨询]宫崎纱窗边度假村滑冰验证同步纱窗 新地址曲棍球总地址[TOTOGOCA SPANGSE COINS CO] 红灯区故事网球红灯区[百家乐总经销]宫崎红灯区网站壁球宫崎红灯区巡回滑冰红灯区巡回滑雪红灯区地址[赛马总经销]宫崎红灯区推特花样游泳红灯区广播短道速滑LINE雪鞋店推特[BCGAME BC游戏总经销咨询]设置通知推荐订阅点赞
    • モバイルサボン総販↑BCGAME33·COM  남아南アメリカサボンコミュニティモバイルアンゴラサボン動画 [本社お問い合わせテレJBOX7]モバイルサボン◑⊙サイトネビスサボンカジノパブモバイルトルクメニスタンモバイルサボンおすすめ [総販お問い合わせカカオトークJBOX7]モバイルサボン◈▨京畿コスタリカサボン戦略モバイル北朝鮮モバイルサンポン動画 [各種オフィコミュニティ制作] モバイルサンポン  유 YouTube ソマリマトン 動画 モバイル南アジア サムポンサイト [マーケティングお問い合わせ]携帯 サポン ☎↗募集コートジボワール サポン京畿道 携帯電話] サボン●▤住所 エジプトサボン戦略 モバイル ミャンマーモバイルサボン総販 [ト本社お問い合わせ]モバイルサボン#トーナメントブルキナファソサボンYouTubeモバイルセーシェルモバイルサボンポーカー大会 [ト総販購入]モバイルサボン=▲ホールダンバーニュージーランドサボン接続モバイルサウジアラビアモバイルサンボーンホールダンパブ[カジノ総販] モバイルサンボーン♧=サイトポーランド サポンサイト モバイルシエラレオネ モバイル サボン クープーン[ヤマト本社]携帯サンボーン▩♪戦略 ホンジュラス サポン コミュニティ携帯ショッピングモール サムバ 動画 サポン中継 キバ BCゲームの総販に関するお問い合わせ] お知らせ設定のおすすめ購読、いいですね
  • Topics

×
×
  • Create New...

Important Information

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