Jump to content

Severe issues with mod on Forge 624+


WildBamaBoy

Recommended Posts

Problems with Minecraft Comes Alive:

 

Users of my mod that have Forge 7.7.1.624 and above (so far) report problems that are not present on the recommended version  that I link them to: 7.7.1.611.

 

Description

I use a certain packet to update the client with the same randomly selected information that the server selected and keep it updated.

 

This is the process:

Client entity doesn't have a texture -> Sends "sync request" packet to Server containing entity id -> Server handles "sync request" by serializing and sending back the entity with the provided id -> Client searches for entity with the same id as the one that was just received and deserialized -> ERROR. ID doesn't match any entities on the client. Client side entity is never updated. Packet is not properly handled.

 

This problem was fixed by adding the entity id to the sync packet by itself, alongside the entity that was serialized. The client side entity was successfully updated but still did not receive its texture. Instead it used the default char.png. I specifically tell my entities to write their textures and entityIds when being serialized; for some reason this data wasn't written correctly.

 

	/**
 * Writes this object to an object output stream. (Serialization)
 * 
 * @param 	out	The object output stream that this object should be written to.
 * 
 * @throws 	IOException	This exception should never happen.
 */
private void writeObject(ObjectOutputStream out) throws IOException
{
	out.defaultWriteObject();
	out.writeObject(texture);
	out.writeObject(entityId);
}

/**
 * Reads this object from an object input stream. (Deserialization)
 * 
 * @param 	in	The object input stream that this object should be read from.
 * 
 * @throws 	IOException				This exception should never happen.
 * @throws 	ClassNotFoundException	This exception should never happen.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
	in.defaultReadObject();
	texture = (String)in.readObject();
	entityId = (Integer)in.readObject();
}

 

Log verifying that some error has occurred with the entity id. They do not match when on previous versions they do! To see this output, you must use the command "/mca.debug on" before allowing a villager from the mod to spawn.

 

2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] SERVER: Sync packet pre-sending data verification: entityBase = EntityVillagerAdult['entity.EntityVillagerAdult.name'/31999, l='New World', x=-829.50, y=4.00, z=270.50], data = [b@ece186, compressed data length = 1730 bytes
2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] CLIENT: Received packet: MCA_SYNC. Size = 1730
2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] CLIENT: Sync packet received. data length = [b@ece186
2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] CLIENT: Decompressing bytes...
2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] CLIENT: Decompressed data length = 3846
2013-04-03 22:04:37 [FINER] [ForgeModLoader] Minecraft Comes Alive [DEBUG] CLIENT: Received packet data verification: entityBase = EntityVillagerAdult['entity.EntityVillagerAdult.name'/32061, l='~NULL~', x=0.00, y=0.00, z=0.00], data = [b@1ca2f25, data length = 3846

 

 

After I fixed the problem with the entity ID, I also had to add the texture to the packet so that the client would actually receive the right texture data. My writeObject and readObject methods are being skipped. Why?

 

More verification that these methods are skipped: the entity's inventory must also be serialized and sent back and forth. When I try to serialize the inventory for a packet, I get a NotSerializableException on a field. I override the serialization with writeObject and readObject, and I do not allow defaultWriteObject() to run so that I won't have the problem with a field not being serializable. It only writes what I tell it to.

 

This is the error I get when trying to serialize an Inventory:

2013-04-04 23:10:27 [iNFO] [sTDERR] java.io.NotSerializableException: net.minecraft.item.ItemStack
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeArray(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.io.ObjectOutputStream.writeObject(Unknown Source)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at mods.MCA.PacketCreator.createInventoryPacket(PacketCreator.java:432)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at mods.MCA.EntityVillagerAdult.interact(EntityVillagerAdult.java:678)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.entity.player.EntityPlayer.interactWith(EntityPlayer.java:1222)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.func_78768_b(PlayerControllerMP.java:462)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1291)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1796)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:831)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:756)
2013-04-04 23:10:27 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)

 

I specifically include the writeObject() method in Inventory to skip the default serialization and prevent this problem. You can view this for yourself in both versions of the source code.

Why does this happen? And why only on later versions of Forge?

 

Source Code (Broken on 624+, perfect on 611-) - https://dl.dropbox.com/u/64124307/Broken%20Source.zip

Source Code (Semi-Fixed for later Forge versions, Inventory packet kills the game. Gift a sword to a villager.) - https://dl.dropbox.com/u/64124307/Semi-Fixed%20Source.zip

 

Files of interest:

PacketHandler.java, createSyncPacket(), createSyncRequestPacket(), createInventoryPacket()

PacketCreator.java, handleSync(), handleSyncRequest(), handleInventory()

EntityVillagerAdult.java, interact()

EntityBase.java, writeObject(), readObject()

Inventory.java, writeObject(), readObject()

 

While it seems entirely wrong to blame Forge for what appears to be a problem with serialization (I have no idea how you can screw with built-in java), the exact same code works flawlessly on Forge 611 and has been working for months! I don't know what else to blame.

Link to comment
Share on other sites

Humm aside from the fact that you're doing things horribly wrong! jesus christ! We have facilities in place for extra spawn data for a reason!

Lookin at those changesets, it doesn't seem like we do anything that would effect your mod this way. However, I did test on 611 and 624, and do see the issue happening. Will do a little more testing with versions and see if I can track down to a specific build.

 

Taking a wild guess i'm gunna say it has something to do with runtime deobfusication based on the horribly method you're using for serializing your data...

Seriously dude, thats bad, you should just send enough to get the information you need across not THE ENTIRE OBJECT, it is nothing but massive network churn.

 

Alright, I was correct, you are trying to serialize the entire object. Which does not work as to maintain ModLoader compatibility we need to make all fields/methods public in all remapped classes.

So you need to look into actually determining what data you need and not relying on ObjectOutputStream, that was designed for small data objects, not large great grandchild objects.

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

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

    • DAFTAR DAN LOGIN DISINI   Hantogel atau handogel adalah bentuk pengumpulan duka uang yang populer di dunia judi online, khususnya dalam permainan slot gacor. Banyak situs judi online yang menawarkan handogel slot gacor, dan sebagai pemain, penting untuk mengetahui cara memilih dan mengakses situs tersebut dengan aman dan amanah. Dalam artikel ini, kami akan membahas cara memilih situs slot gacor online yang berkualitas dan tahu cara mengakses handogelnya.
    • DAFTAR & LOGIN SIRITOGEL Siritogel adalah kumpulan kata yang mungkin baru saja dikenal oleh masyarakat, namun dengan perkembangan teknologi dan banyaknya informasi yang tersedia di internet, kalau kita siritogel (mencari informasi dengan cara yang cermat dan rinci) tentang situs slot gacor online, maka kita akan menemukan banyak hal yang menarik dan membahayakan sama sekali. Dalam artikel ini, kita akan mencoba menjelaskan apa itu situs slot gacor online dan bagaimana cara mengatasi dampaknya yang negatif.
    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; final var options = Minecraft.getInstance().options; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(event.getPartialTick(), player.oSpinningEffectIntensity, player.spinningEffectIntensity); float f1 = ((Double)options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = f * (1.0F - f1); final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f5 = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f5, f5, f5); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f4 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); p_282460_.setColor(f4, f2, f3, 1.0F); p_282460_.blit(new ResourceLocation("textures/misc/nausea.png"), 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.   Kesimpulan OLXTOTO adalah situs slot gacor terbaik yang memberikan pengalaman bermain judi slot online yang tak terlupakan. Dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering, OLXTOTO menjadi pilihan terbaik bagi para pemain yang mencari kesenangan dan kemenangan besar dalam perjudian online. Di samping itu, OLXTOTO juga menawarkan layanan pelanggan yang ramah dan responsif, siap membantu setiap pemain dalam mengatasi masalah teknis atau pertanyaan seputar perjudian online. Kami menjaga integritas game dan memberikan lingkungan bermain yang adil serta menjalankan kebijakan perlindungan pelanggan yang cermat. Bergabunglah dengan OLXTOTO sekarang dan nikmati pengalaman bermain slot online yang luar biasa. Jadilah bagian dari komunitas perjudian yang mengagumkan ini dan raih kesempatan untuk meraih kemenangan besar. Dapatkan akses mudah dan praktis ke situs OLXTOTO dan rasakan sensasi bermain judi slot yang tak terlupakan.  
  • Topics

×
×
  • Create New...

Important Information

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