Jump to content

Recommended Posts

Posted

Hi,

 

So basically what i want to do is make a mob that throws something which it is attached to him with a rope. Both entities have models and renderers. The thing that he throws extends EntityThrowable and it is created in the attackEntityWithRangedAttack method (all mobs implementing the interface IRangedAttackMob need that), much like a snowball in EntitySnowman.

 

Rendering the rope is the same as rendering the leash: i literally copied it from RenderLiving since there is no real other way to do it. The first line of func_110827_b (the method responsible for rendering the leash) is the entity that needs to be connected to the current entityliving it is rendering:

Entity entity = par1EntityLiving.func_110166_bE();

In my case, that entity is the thing it's throwing. What I did however is the following:

 

I copied everything nested in the if statement of func_110827_b and made a new method for it in the renderer of the thing that gets thrown, so NOT the mob. I added a new parameter:

func_110827_b(EntityLiving par1EntityLiving, EntityThatIsThrown thrown, double par2, double par4, double par6, float par8, float par9)

and called it like this: (All the other parameters are directly from the doRender method it is called in)

func_110827_b(thrown.getThrower(), thrown, par2, par4, par6, par8, par9)

 

But here's the problem: getThrower() is null. This is because attackEntityWithRangedAttack is only called on the server, and so is the thrower field in the thrown entity. Is there any way to get the thrower on the client?

Posted

Why would you need to throw on the client ?

You'll need to send a packet to the client for the rendering, i think, and remove that func_110827_b from your code.

 

I suggest you post more of your code, it will be easier for everyone to understand and help you.

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.