Jump to content

Rendering custom models on player.


JacobsDevelop

Recommended Posts

I'm continuing (kinda) my cape topic. After discussion I've decided to make backpack instead of capes, I have backpack model that was created in blockbench and it's exported as .java class. I have two problems:

1. How to implement this model.

2. How to make void or function to render this model on player's back (also I want to make it render on players specified by UUID)

There's raw .java backpack model file (it's not in in my files yet):

// Made with Blockbench 3.8.3
// Exported for Minecraft version 1.15 - 1.16
// Paste this class into your mod and generate all required imports


public class backpack_dev extends EntityModel<Entity> {
	private final ModelRenderer bb_main;

	public backpack_dev() {
		textureWidth = 32;
		textureHeight = 32;

		bb_main = new ModelRenderer(this);
		bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
		bb_main.setTextureOffset(0, 0).addBox(-4.0F, -10.0F, -2.0F, 8.0F, 10.0F, 3.0F, 0.0F, false);
		bb_main.setTextureOffset(0, 13).addBox(-3.0F, -9.0F, 1.0F, 6.0F, 9.0F, 1.0F, 0.0F, false);
		bb_main.setTextureOffset(0, 23).addBox(-2.0F, -5.0F, 2.0F, 4.0F, 5.0F, 1.0F, 0.0F, false);
		bb_main.setTextureOffset(0, 30).addBox(-1.0F, -6.0F, 2.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
	}

	@Override
	public void setRotationAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
		//previously the render function, render code was moved to a method below
	}

	@Override
	public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
		bb_main.render(matrixStack, buffer, packedLight, packedOverlay);
	}

	public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
		modelRenderer.rotateAngleX = x;
		modelRenderer.rotateAngleY = y;
		modelRenderer.rotateAngleZ = z;
	}
}

Also I don't know why, but I get error when I paste this code into class.

Any help would be appreciated.

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.



×
×
  • Create New...

Important Information

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