Jump to content

[SOLVED] [1.8] Change Eye Height & Held Item Size/Location


Recommended Posts

Posted

I'm trying to create a smaller version of the vanilla Skeleton, but I've run into a couple problems that I haven't been able to work out:

[*]The location that it shoots arrows from (what I would think is the eye height) is too high.

[*]The bow it holds is too big.

[*]The bow it holds is too high up.

f6adb39378c587cff3e013ca5a90ebc1

https://gyazo.com/f6adb39378c587cff3e013ca5a90ebc1 (if the image doesn't work)

 

I looked into the EntitySkeleton class and traced the arrow it shoots back to the EntityArrow class that has this line:

 this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D;

which looks like it uses eyeHeight to determine where to spawn the arrow. But .getEyeHeight() gets the height from Entity.height * 0.85F, and that height is set with .setSize(). In my own EntityBabySkeleton class, I used:

this.setSize(0.6F, 1.0F);

so the eyeHeight should be 0.85F, but it still shoots in the same location that a normal skeleton would.

(I'm sorry if that was confusing to follow)

 

As for the bow, is there a way to scale the bow's size or would I need to create a custom item with a smaller bow model? And is there a way to change where the bow appears on the model so I could move it down to the baby skeleton's hands?

Posted

For 2 & 3, you can create a subclass of LayerRenderer and do whatever transforms (e.g. scale) and translations you want to do from there. Here is an example which I use for any generic biped entity (based on the vanilla LayerHeldItem code which you should be able to use if your entity model sets isChild to true...).

 

Not too sure about #1 - it should change the position based on the shooting entity's height / eye height as you described. You may want to try playing around with the numbers and putting a break point in that EntityArrow constructor to see what, exactly, is getting passed in for your entity's eye height. You never know - it might not be what you think it is, and at the very least you will know one way or another if that truly is the issue.

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.