Jump to content

[1.10.2] [Solved] Custom EntityHanging doesn't render on a server


Palaster

Recommended Posts

I am dealing with a custom entity that extends EntityHanging. But, no matter what I do with the renderer it doesn't show up on servers. I even went as far as to create a clone of the EntityItemFrame and RenderItemFrame and it still doesn't show up on server. I have registered both the entity and the renderer.

 

This is the original Entity: https://github.com/Vazkii/Charset/blob/1.10/src/main/java/pl/asie/charset/storage/locking/EntityLock.java

This is the original Render: https://github.com/Vazkii/Charset/blob/1.10/src/main/java/pl/asie/charset/storage/locking/RenderLock.java

 

Also, this is the actually code i am trying to help fix the issue associated with this.

Link to comment
Share on other sites

Last I poked at EntityHanging, you couldn't meaningfully extend it, because all of the classes involved in figuring out which entity to spawn and how to render it were hardcoded with switch statements / ternary operators.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

My custom paintings extended EntityPainting and went through all kinds of contortions (including writing my own renderer) in 1.7.10 and 1.8 to deal with the stupid final enum etc. There's at least one gotcha in the client-side message handling code where it checks explicitly for class==EntityPainting, so no instance-of will be rendered unless you defeat the check.

 

I am currently upgrading my mods to 1.10.2  and will get to my paintings this week. I'll let you know what I discover.

 

One thing I can tell you right away though: NOTHING renders on a server. ALL rendering is client-side only. You should do some reading and then start over on your design to avoid any attempt  to render on your server.

 

Here's the critical piece of my code to defeat client-side message handling in mc 1.8 (I'm looking at it, but even though I wrote it myself, I no longer understand it):

@SideOnly(Side.CLIENT)
public class classAltPaintingSpawnCallback implements Function<EntitySpawnMessage, Entity> {

  protected Field fieldStream;

  public classAltPaintingSpawnCallback() {      // This will be constructed in the init phase
    try {   // Crack open the message and enable access to dataStream via Field variable (reflection)
      this.fieldStream = EntitySpawnMessage.class.getDeclaredField ("dataStream");
      this.fieldStream.setAccessible (true);
    } catch (NoSuchFieldException e) {
      System.out.println ("ERROR (" + e.getMessage () + "): Field 'dataStream' does not exist in class EntitySpawnMessage. ");
    }
  }

  /**
   * Helper class with one function to parse message and call the correct entity constructor that returns an instance of my entity
   * class. Got all that? I wrote it, and it still makes my head hurt.
   *
   * Why does the message protocol delay reading my extra data until after entity construction? I may never know, but I do know that
   * it's there waiting for me, so I'm taking it by force. 
   */
  @Override
  public Entity apply(EntitySpawnMessage m) {
    WorldClient wc = FMLClientHandler.instance ().getWorldClient ();
    try {
      ByteBuf b = (ByteBuf) fieldStream.get (m);                // Steal the dataStream from message m
      int x = b.readInt ();                                     // world tile x (+ is East)
      int y = b.readInt ();                                     // world tile y (+ is Up)
      int z = b.readInt ();                                     // world tile z (+ is South)
      EnumFacing facing = EnumFacing.VALUES[b.readByte ()];     // Compass dir 0-6 is D, U, N, S, W, E
      int lot = b.readByte ();                                  // Texture number 0-15 taken from carpet color used to craft item
      String title = ByteBufUtils.readUTF8String (b);
      return new classAltPainting (wc, new BlockPos (x, y, z), facing, lot, title);
    } catch (ReflectiveOperationException e) {
      System.out.println ("ERROR: classAltPaintingSpawnCallback.apply() threw: " + e.getMessage ());
      return null;
    }
  }
}

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

if a player is on a server and places it in the world it won't render for them or anyone else. But, it will render on single-player.

So it is actually placed, just not visible?

 

Look at my callback. Use it to set breakpoints. See what the client is doing in the vicinity of the EntitySpawnMessage hook.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

@jeffry, looking at your code it seems like you have re-implemented IEntityAdditionalSpawnData in a very hacky way.

That sounds familiar. I think you're right. The OP might only need IEntityAdditionalSpawnData (my situation did not quite fit because I needed the data you see me extracting by force, i.e. reflection)

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

  • 3 weeks later...

@jeffry, looking at your code it seems like you have re-implemented IEntityAdditionalSpawnData in a very hacky way.

That sounds familiar. I think you're right. The OP might only need IEntityAdditionalSpawnData (my situation did not quite fit because I needed the data you see me extracting by force, i.e. reflection)

 

You are correct I got it working all I needed was to write an Enum to the entity using IEntityAdditionalSpawnData. Thank you for the help.

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

    • DUTA89 agen slot online terbaik dan sering memberikan kemenangan kepada setiap member yang deposit diatas 50k dengan tidak klaim bonus sepeser pun.   Link daftar : https://heylink.me/DUTA89OFFICIAL/  
    • Hello All! Started a MC Eternal 1.6.2.2 server on Shockbyte hosting. The only other mod I added was betterfarmland v0.0.8BETA. Server is 16GB and Shockbyte wont tell me how many CPU cores i have.  We are having problems now when players log in it seems to crash the server. At other times it seems fine and we can have 3 people playing for hours at a time. Usually always when it does crash it is when someone logs in. Crash Reports Below. To the person who can post the fix I will reward $100 via Paypal.   ---- Minecraft Crash Report ---- // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~] Time: 2024-09-19 21:04:58 UTC Description: Exception in server tick loop java.lang.StackOverflowError     at net.minecraft.advancements.PlayerAdvancements.hasCompletedChildrenOrSelf(PlayerAdvancements.java:451)     at net.minecraft.advancements.PlayerAdvancements.shouldBeVisible(PlayerAdvancements.java:419)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:385)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.P  
    • It worked the first time but none of my friends and now me either could enter the server. internal exception: io.netty.handler.codec.DecoderException Unknown modifier tconstruct:soulbound
    • It worked the first time but none of my friends and now me either could enter the server. internal exception: io.netty.handler.codec.DecoderException Unknown modifier tconstruct:soulbound
    • It worked the first time but none of my friends and now me either could enter the server. internal exception: io.netty.handler.codec.DecoderException Unknown modifier tconstruct:soulbound
  • Topics

×
×
  • Create New...

Important Information

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