Arm rotation now respects sneaking

This commit is contained in:
Tschipp 2017-08-15 14:23:54 +02:00
parent 4323ba2d7d
commit 578f124c48

View File

@ -248,48 +248,50 @@ public class RenderEvents
ResourceLocation skinLoc = DefaultPlayerSkin.getDefaultSkin(player.getPersistentID());
ModelRenderer fakeLeftArm = new ModelRenderer(model, 32, 48);
ModelRenderer fakeRightArm = new ModelRenderer(model, 40, 16);
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{
if (!model.bipedLeftArm.isHidden || !model.bipedRightArm.isHidden) {
model.bipedLeftArm.isHidden = true;
model.bipedRightArm.isHidden = true;
model.bipedBody.childModels.clear();
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
float rotation = -player.renderYawOffset;
ModelRenderer fakeLeftArm = new ModelRenderer(model, 32, 48);
if (aplayer.getSkinType().equals("default"))
{
fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 4, 12, 4, .08F);
}
else
{
fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 3, 12, 4, .08F);
}
model.bipedLeftArm.isHidden = true;
model.bipedRightArm.isHidden = true;
ModelRenderer fakeRightArm = new ModelRenderer(model, 40, 16);
if (aplayer.getSkinType().equals("default"))
{
fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.9F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 4, 12, 4, .08F);
}
else
{
fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.2F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 3, 12, 4, .08F);
}
if (!player.isSneaking())
{
fakeRightArm.rotateAngleX = -.9F;
fakeLeftArm.rotateAngleX = -.9F;
}
else
{
fakeRightArm.rotateAngleX = -1.3F;
fakeLeftArm.rotateAngleX = -1.3F;
}
model.bipedBody.addChild(fakeLeftArm);
model.bipedBody.addChild(fakeRightArm);
Minecraft.getMinecraft().getTextureManager().bindTexture(skinLoc);
float rotation = -player.renderYawOffset;
if (aplayer.getSkinType().equals("default"))
{
fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 4, 12, 4, .08F);
}
else
{
fakeLeftArm.addBox(model.bipedLeftArm.offsetX + 4.2F, model.bipedLeftArm.offsetY, model.bipedLeftArm.offsetZ, 3, 12, 4, .08F);
}
if (aplayer.getSkinType().equals("default"))
{
fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.9F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 4, 12, 4, .08F);
}
else
{
fakeRightArm.addBox(model.bipedRightArm.offsetX - 7.2F, model.bipedRightArm.offsetY, model.bipedRightArm.offsetZ, 3, 12, 4, .08F);
}
if (!player.isSneaking())
{
fakeRightArm.rotateAngleX = -.9F;
fakeLeftArm.rotateAngleX = -.9F;
}
else
{
fakeRightArm.rotateAngleX = -1.4F;
fakeLeftArm.rotateAngleX = -1.4F;
}
model.bipedBody.addChild(fakeLeftArm);
model.bipedBody.addChild(fakeRightArm);
}
else
{
@ -301,7 +303,6 @@ public class RenderEvents
}
}
if (stack.isEmpty() || stack.getItem() != RegistrationHandler.itemTile || !ItemTile.hasTileData(stack))
{
model.bipedLeftArm.isHidden = false;