Jump to content

[1.10.2] Animating Armor


Phonixe

Recommended Posts

Hello, i'm trying to make an armor model only animated when a player presses a button. The issue is that when the player presses the button the animation is done on the armor for all the entities that are wearing this armor (ArmorStand, Player, etc) while i want it to only animate for the player that pressed the button.

@Override
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
    		float headPitch, float scaleFactor, Entity entityIn) {
    	super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
    	this.body1.rotateAngleY = 0.0F;
    		if (PhoenixCraftKeyBindings.flyWings.isKeyDown()) { 
    			ModelBiped armorModel = PhoenixCraft.proxy.getArmorModel(0);
    			this.body1.rotateAngleY = 0.5F + MathHelper.cos(ageInTicks * 0.6662F) * 0.4F / 1.0F;
    		}
    }

Link to comment
Share on other sites

Hello, i'm trying to make an armor model only animated when a player presses a button. The issue is that when the player presses the button the animation is done on the armor for all the entities that are wearing this armor (ArmorStand, Player, etc) while i want it to only animate for the player that pressed the button.

@Override
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
    		float headPitch, float scaleFactor, Entity entityIn) {
    	super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
    	this.body1.rotateAngleY = 0.0F;
    		if (PhoenixCraftKeyBindings.flyWings.isKeyDown()) { 
    			ModelBiped armorModel = PhoenixCraft.proxy.getArmorModel(0);
    			this.body1.rotateAngleY = 0.5F + MathHelper.cos(ageInTicks * 0.6662F) * 0.4F / 1.0F;
    		}
    }

Sounds like you will need to use a capability to store if the Armor should be animated on a specific entity.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Well of course they all animate. They all use the same model and all get rendered the same way, including keybind check.  You make no attempt to distinguish which armor is currently being rendered.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

How could i check which armor is being rendered?

Sounds like you will need to use a capability to store if the Armor should be animated on a specific entity.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I tried looking through tutorials about capabilities and i couldn't figure out a way to store if the Armor should be animated on a specific entity. ._.

How about storing a boolean, or even a byte to differentiate between render and dont render.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

IRender rendered = entityIn.getCapability(RenderProvider.IS_RENDERED, null);

         if (PhoenixCraftKeyBindings.flyWings.isKeyDown() && rendered.getIsRendered() == 1) {
    		this.body1.rotateAngleY = 0.5F + MathHelper.cos(ageInTicks * 0.6662F) * 0.4F / 1.0F;}

 

this seems to cause the armor to not render when the button is pressed ._.

Link to comment
Share on other sites

IRender rendered = entityIn.getCapability(RenderProvider.IS_RENDERED, null);

         if (PhoenixCraftKeyBindings.flyWings.isKeyDown() && rendered.getIsRendered() == 1) {
    		this.body1.rotateAngleY = 0.5F + MathHelper.cos(ageInTicks * 0.6662F) * 0.4F / 1.0F;}

 

this seems to cause the armor to not render when the button is pressed ._.

Does rendered.getIsRendered()'s value ever changed to a 1?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I do have an eventhandler that changes it to 1 when the player is rendered

@SubscribeEvent
    public void onPlayerRendered(RenderPlayerEvent event) {
	EntityPlayer player = event.getEntityPlayer();
	Entity entity = event.getEntity();
	IRender rendered = entity.getCapability(RenderProvider.IS_RENDERED, null);
	rendered.setIsRendered(1);

}

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.