Skip to content

Commit

Permalink
Add proper automatic scaling for height (adult only).
Browse files Browse the repository at this point in the history
Crystal-Spider committed Jan 25, 2025
1 parent 6fad29e commit 7e64287
Showing 1 changed file with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -35,9 +35,9 @@ protected void renderWidget(GuiGraphics gfx, int mouseX, int mouseY, float parti
updateRenderState(mouseX, mouseY);
gfx.pose().pushPose();
gfx.pose().translate(getX() + getWidth() / 2F, getY() + getHeight(), 100);
float f = getHeight() / 2.125F;
float f = getHeight() / 1.875F;
gfx.pose().scale(f, f, f);
gfx.pose().translate(0, -0.0625F, 0);
gfx.pose().translate(0, -0.1, 0);
gfx.pose().rotateAround(Axis.XP.rotationDegrees(renderState.bodyRot.getX()), 0, -1.0625F, 0);
gfx.pose().mulPose(Axis.YP.rotationDegrees(renderState.bodyRot.getY()));
gfx.flush();
@@ -74,37 +74,37 @@ public void updateRenderState(int mouseX, int mouseY) {
}
}

// public void updateRenderState(@NotNull PlayerRenderState state) {
// // TODO: Implement copying the local player (name, texture, showCape/showHat/show..., cape texture)
// // TODO: Implement choosing local texture files (both skin and cape), as well as choosing the texture from a player's name/uuid.
// state.skin = skin;
// state.isCrouching = isCrouching;
// state.parrotOnLeftShoulder = leftShoulderParrot;
// state.parrotOnRightShoulder = rightShoulderParrot;
//// reusedState.nameTag = this.getNameTag(p_entity);
//// reusedState.nameTagAttachment = new Player().getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, p_entity.getYRot(partialTick));
// /**
// * Values below copied from {@link EntityType.Builder#nameTagOffset(float)}
// */
// state.nameTag = Component.literal("TEST");
// state.nameTagAttachment = new Vec3(0.0F, 2.05F, 0.0F);
// // TODO: Fix name tag. It doesn't render currently.
// state.customName = null;
// state.isBaby = isBaby;
// // TODO: Glowing effect doesn't work. The entity renders the same regardless. Could ignore this, since it was not in the original FancyManu, but it would be nice to have (not even sure this is the right property).
// state.appearsGlowing = isGlowing;
// state.isSpectator = false;
// state.pose = isCrouching ? Pose.CROUCHING : pose;
// state.isDiscrete = isCrouching;
// // TODO: Works almost fine, but the item model is kind of transparent to itself.
//// Minecraft.getInstance().getItemModelResolver().updateForTopItem(state.rightHandItem, Items.NETHERITE_SWORD.getDefaultInstance(), ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, false, null, null, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND.ordinal());
// // TODO: Why is armor not rendered?
//// state.headEquipment = Items.NETHERITE_HELMET.getDefaultInstance();
//// state.chestEquipment = Items.NETHERITE_CHESTPLATE.getDefaultInstance();
// // TODO: The reason why the flame doesn't render might be the same reason why the name tag doesn't render.
//// state.displayFireAnimation = true;
// // TODO: Render elytra (if cape has a texture, elytra should be renderer with that texture too).
// }
// reusedState.nameTag = this.getNameTag(p_entity);
// reusedState.nameTagAttachment = new Player().getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, p_entity.getYRot(partialTick));
/**
* Values below copied from {@link EntityType.Builder#nameTagOffset(float)}
*/
renderState.nameTag = Component.literal("TEST");
renderState.nameTagAttachment = new Vec3(0.0F, 2.05F, 0.0F);

// TODO: Implement copying the local player (name, texture, showCape/showHat/show..., cape texture)
// TODO: Implement choosing local texture files (both skin and cape), as well as choosing the texture from a player's name/uuid.
// renderState.skin = skin;
// renderState.isCrouching = isCrouching;
// renderState.parrotOnLeftShoulder = leftShoulderParrot;
// renderState.parrotOnRightShoulder = rightShoulderParrot;
// TODO: Fix name tag. It doesn't render currently.
// renderState.customName = null;
// renderState.isBaby = isBaby;
// TODO: Glowing effect doesn't work. The entity renders the same regardless. Could ignore this, since it was not in the original FancyManu, but it would be nice to have (not even sure this is the right property).
// renderState.appearsGlowing = isGlowing;
// renderState.isSpectator = false;
// renderState.pose = isCrouching ? Pose.CROUCHING : pose;
// renderState.isDiscrete = isCrouching;
// TODO: Works almost fine, but the item model is kind of transparent to itself.
// Minecraft.getInstance().getItemModelResolver().updateForTopItem(renderState.rightHandItem, Items.NETHERITE_SWORD.getDefaultInstance(), ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, false, null, null, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND.ordinal());
// TODO: Why is armor not rendered?
// renderState.headEquipment = Items.NETHERITE_HELMET.getDefaultInstance();
// renderState.chestEquipment = Items.NETHERITE_CHESTPLATE.getDefaultInstance();
// TODO: The reason why the flame doesn't render might be the same reason why the name tag doesn't render. EDIT: Upon further inspection, it seems to be a different issue.
// renderState.displayFireAnimation = true;
// TODO: Render elytra (if cape has a texture, elytra should be renderer with that texture too).
}

@Override
public void playDownSound(@NotNull SoundManager soundManager) {

0 comments on commit 7e64287

Please sign in to comment.