WIP: custom armor model

This commit is contained in:
Aleksey 2020-12-01 10:43:38 +03:00
parent 04de4d0873
commit 06d54a634c
7 changed files with 61 additions and 17 deletions

View file

@ -47,6 +47,20 @@ public class CrystaliteArmorProvider implements ModelProvider, TextureProvider {
case HEAD: { case HEAD: {
return HELMET_MODEL; return HELMET_MODEL;
} }
case CHEST: {
if (entity instanceof AbstractClientPlayerEntity &&
((AbstractClientPlayerEntity) entity).getModel().equals("slim")) {
return CHEST_MODEL_SLIM;
}
return CHEST_MODEL;
}
case LEGS: {
return LEGGINGS_MODEL;
}
case FEET: {
return BOOTS_MODEL;
}
default: { default: {
return defaultModel; return defaultModel;
} }

View file

@ -15,8 +15,8 @@ public class CrystaliteBootsModel extends BipedEntityModel<LivingEntity> {
public ModelPart rightBoot; public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) { public CrystaliteBootsModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
this.leftBoot = new ModelPart(this, 0, 16); this.leftBoot = new ModelPart(this, 0, 32);
this.leftBoot.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F); this.leftBoot.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftBoot.setPivot(1.9F, 12.0F, 0.0F); this.leftBoot.setPivot(1.9F, 12.0F, 0.0F);
this.rightBoot = new ModelPart(this, 0, 16); this.rightBoot = new ModelPart(this, 0, 16);

View file

@ -7,31 +7,37 @@ import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm;
public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> { public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> {
public ModelPart leftShoulder; public ModelPart leftShoulder;
public ModelPart rightShoulder; public ModelPart rightShoulder;
private boolean thinArms;
public CrystaliteChestplateModel(float scale, boolean thinArms) { public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
this.thinArms = thinArms;
this.torso = new ModelPart(this, 16, 16); this.torso = new ModelPart(this, 16, 16);
this.torso.addCuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale); this.torso.addCuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
this.torso.setPivot(0.0F, 0.0F, 0.0F); this.torso.setPivot(0.0F, 0.0F, 0.0F);
if (thinArms) { if (thinArms) {
this.leftShoulder = new ModelPart(this, 40, 16); this.leftShoulder = new ModelPart(this, 41, 32);
this.leftShoulder.addCuboid(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.25F); this.leftShoulder.addCuboid(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.3F);
this.leftShoulder.setPivot(5.0F, 2.5F, 0.0F); this.leftShoulder.setPivot(5.0F, 2.5F, 0.0F);
this.rightShoulder = new ModelPart(this, 40, 16); this.leftShoulder.mirror = true;
this.rightShoulder.addCuboid(-2.0F, -2.0F, -12.0F, 3.0F, 12.0F, 4.0F, scale + 0.25F); this.rightShoulder = new ModelPart(this, 41, 16);
this.rightShoulder.addCuboid(-2.0F, -2.5F, -12.0F, 3.0F, 12.0F, 4.0F, scale + 0.3F);
this.rightShoulder.setPivot(-5.0F, 2.5F, 10.0F); this.rightShoulder.setPivot(-5.0F, 2.5F, 10.0F);
} else { } else {
this.leftShoulder = new ModelPart(this, 40, 16); this.leftShoulder = new ModelPart(this, 40, 32);
this.leftShoulder.addCuboid(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F); this.leftShoulder.addCuboid(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.4F);
this.leftShoulder.setPivot(5.0F, 2.0F, 0.0F); this.leftShoulder.setPivot(5.0F, 2.0F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 40, 16); this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addCuboid(-3.0F, -2.0F, -12.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F); this.rightShoulder.addCuboid(-3.0F, -2.5F, -12.1F, 4.0F, 12.0F, 4.0F, scale + 0.4F);
this.rightShoulder.setPivot(-5.0F, 2.0F, 10.0F); this.rightShoulder.setPivot(-5.0F, 2.0F, 10.0F);
} }
} }
@ -52,4 +58,17 @@ public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> {
this.leftShoulder.copyPositionAndRotation(leftArm); this.leftShoulder.copyPositionAndRotation(leftArm);
this.rightShoulder.copyPositionAndRotation(rightArm); this.rightShoulder.copyPositionAndRotation(rightArm);
} }
@Override
public void setArmAngle(Arm arm, MatrixStack matrices) {
ModelPart modelPart = this.getArm(arm);
if (this.thinArms) {
float f = 0.5F * (float)(arm == Arm.RIGHT ? 1 : -1);
modelPart.pivotX += f;
modelPart.rotate(matrices);
modelPart.pivotX -= f;
} else {
modelPart.rotate(matrices);
}
}
} }

View file

@ -16,7 +16,7 @@ import net.minecraft.entity.LivingEntity;
public class CrystaliteHelmetModel extends BipedEntityModel<LivingEntity> { public class CrystaliteHelmetModel extends BipedEntityModel<LivingEntity> {
public CrystaliteHelmetModel(float scale) { public CrystaliteHelmetModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
this.helmet = new ModelPart(this, 0, 0); this.helmet = new ModelPart(this, 0, 0);
this.helmet.addCuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, scale + 0.5F); this.helmet.addCuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, scale + 0.5F);
this.helmet.setPivot(0.0F, 0.0F, 0.0F); this.helmet.setPivot(0.0F, 0.0F, 0.0F);

View file

@ -11,14 +11,19 @@ import net.minecraft.entity.LivingEntity;
public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> { public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> {
public ModelPart jacket;
public CrystaliteLeggingsModel(float scale) { public CrystaliteLeggingsModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
this.jacket = new ModelPart(this, 16, 16);
this.jacket.addCuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
this.jacket.setPivot(0.0F, 0.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 32);
this.leftLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPivot(1.9F, 12.0F, 0.0F);
this.rightLeg = new ModelPart(this, 0, 16); this.rightLeg = new ModelPart(this, 0, 16);
this.rightLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale); this.rightLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPivot(-1.9F, 12.0F, 0.0F); this.rightLeg.setPivot(-1.9F, 12.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 16);
this.leftLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPivot(1.9F, 12.0F, 0.0F);
} }
@Override @Override
@ -28,6 +33,12 @@ public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> {
@Override @Override
protected Iterable<ModelPart> getBodyParts() { protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(rightLeg, leftLeg); return Lists.newArrayList(jacket, rightLeg, leftLeg);
}
@Override
public void setAngles(LivingEntity livingEntity, float f, float g, float h, float i, float j) {
super.setAngles(livingEntity, f, g, h, i, j);
this.jacket.copyPositionAndRotation(torso);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 641 B

Before After
Before After