Jump to content

Recommended Posts

Posted

As a learning step on my way to building a custom ship mod, I am trying to get working a wand item that deletes a block and replaces it with an entity that looks and feels exactly like the block.

 

Seems reasonably straightforward, and it mostly works, but when my renderer tries to access the blockId of the deleted block (which I store in the new entity) it is rendering, the code fails (so currently the best I can do is render all the entities as the same arbitrary block type...)

 

This is because the default entity constructor, Entity(World) is called (not by me!) by cpw.mods.fml.client.FMLClientHandler.spawnEntityIntoClientWorld() at some point after my world.spawnEntityInWorld( entity ) call, and before the renderer starts rendering, which resets the blockId stored in the entity to 0 before the renderer can use it.

 

I assume this all happens because of something I've done wrong somewhere...

Is it related to something happening on the client side that shouldn't be happening?

Is it anything to do with how/where I have registered my entity/renderer, etc?

What can I do to stop this extra call to the default constructor of my entity?

 

My wand item that turns a block to an entity:

 

  Reveal hidden contents

 

 

My entity that looks and feels like a block:

 

  Reveal hidden contents

 

 

My renderer for the entity:

 

  Reveal hidden contents

 

 

And just in case, here is my mod class, and client proxy (my common proxy has nothing happening in it):

 

  Reveal hidden contents

 

 

 

  Reveal hidden contents

 

Posted

You should use a custom spawning packet.

 

I don't know what's the proper way to do it, but take a look at:

 

cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration

cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration.setCustomSpawning

cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration

Posted

Thanks for the reply N1xx1.

 

I had looked at those classes already, and made an attempt to setCustomSpawning() in EntityRegistry, but failed (perhaps because I didn't use a custom spawn packet???)....

 

Why do I need a custom spawning packet?

What (specifically) should I be planning to achieve with it?

I can handle packet sending in general, but where can I get more info on custom spawning packets in particular?

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.