Fix arm waving (again)

This commit is contained in:
Matthew Messinger 2016-01-26 16:43:39 -05:00
parent 6fd6c5b567
commit 4b61d9c0ad
4 changed files with 32 additions and 14 deletions

View file

@ -68,7 +68,8 @@ repositories {
}
dependencies {
compile 'org.spongepowered:mixin:0.4.14-SNAPSHOT'
compile 'org.spongepowered:mixin:0.4.17-20160126.141141-3'
compile 'org.ow2.asm:asm-debug-all:5.0.3'
compile 'com.google.guava:guava:17.0'
compile 'com.google.code.gson:gson:2.2.4'
}

View file

@ -69,13 +69,11 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
*/
@Overwrite
public void doRender(AbstractClientPlayer player, double x, double y, double z, float yaw, float partialTicks) {
updateModel(player);
ItemStack currentItemStack = player.inventory.getCurrentItem();
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
thePony.checkSkin();
this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.getModel();
this.playerModel.getModel().heldItemRight = currentItemStack == null ? 0 : 1;
this.playerModel.apply(thePony.metadata);
if (currentItemStack != null && player.getItemInUseCount() > 0) {
EnumAction yOrigin = currentItemStack.getItemUseAction();
if (yOrigin == EnumAction.BLOCK) {
@ -136,22 +134,29 @@ public abstract class MixinRenderPlayer extends RendererLivingEntity implements
@Inject(method = "renderRightArm(" + AbstractClientPlayer + ")V", at = @At("HEAD") )
private void onRenderRightArm(AbstractClientPlayer player, CallbackInfo ci) {
updateModel(player);
bindEntityTexture(player);
}
@Inject(method = "renderLeftArm(" + AbstractClientPlayer + ")V", at = @At("HEAD") )
private void onRenderLeftArm(AbstractClientPlayer player, CallbackInfo ci) {
updateModel(player);
bindEntityTexture(player);
}
private void updateModel(AbstractClientPlayer player) {
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
thePony.checkSkin();
this.playerModel = this.getModel(player);
this.mainModel = this.playerModel.getModel();
this.playerModel.apply(thePony.metadata);
}
private ResourceLocation getEntityTexture(AbstractClientPlayer player) {
Pony thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
return thePony.getTextureResourceLocation();
}
/**
* @reason Change the skin in case of non-pony skin
*/
@Override
public final ResourceLocation getEntityTexture(Entity entity) {
return this.getEntityTexture((AbstractClientPlayer) entity);

View file

@ -20,10 +20,10 @@ import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
public abstract class AbstractPonyModel extends ModelPlayer {
@ -101,6 +101,22 @@ public abstract class AbstractPonyModel extends ModelPlayer {
this.steveLeftArmwear.render(0.0625f);
}
@Override
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) {
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
this.steveRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float) Math.PI) * 2.0F * p_78087_2_ * 0.5F;
this.steveRightArm.rotateAngleY = 0;
this.steveRightArm.rotateAngleZ = 0;
this.steveLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F;
this.steveLeftArm.rotateAngleY = 0;
this.steveLeftArm.rotateAngleZ = 0;
copyModelAngles(steveRightArm, steveRightArmwear);
copyModelAngles(steveLeftArm, steveLeftArmwear);
}
protected void setModelVisibilities(AbstractClientPlayer clientPlayer) {
ModelPlayer modelplayer = this;

View file

@ -2,13 +2,9 @@ package com.brohoof.minelittlepony.model.pony;
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
import static net.minecraft.client.renderer.GlStateManager.rotate;
import static net.minecraft.client.renderer.GlStateManager.scale;
import static net.minecraft.client.renderer.GlStateManager.translate;
import java.util.Random;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.PonyModelConstants;