Updated Armor Models

This commit is contained in:
Frank Bauer 2021-06-24 17:32:02 +02:00
parent 10a9a81725
commit 371d491e5f
4 changed files with 102 additions and 47 deletions

View file

@ -8,6 +8,7 @@ class ModelPart {
float x=0, y=0, z=0, rx=0, ry=0, rz=0;
int u=0, v=0;
float bx=0,by=0,bz=0,ba=0,bb=0,bc=0;
float scale = 1;
boolean hadBox = false;
@ -55,6 +56,7 @@ class ModelPart {
ba=a;
bb=b;
bc=c;
scale = _d;
hadBox = true;
return this;
}
@ -71,11 +73,20 @@ class ModelPart {
}
public String toString(){
String s = "";
String pName = parent==null?"modelPartData":parent.name;
String s = "PartDefinition " + name + " = ";
if (scale!=1){
s += "CubeDeformation deformation_"+name+" = new CubeDeformation("+scale+"f);\n";
}
s += "PartDefinition " + name + " = ";
s += pName+".addOrReplaceChild(\""+name+"\", CubeListBuilder.create()\n";
if (this.mirror) s+= ".mirror()\n";
if (this.hadBox) s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f)\n";
if (this.hadBox) {
if (scale!=1)
s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f, deformation_"+name+")\n";
else
s+= ".addBox("+bx+"f, "+by+"f, "+bz+"f, "+ba+"f, "+bb+"f, "+bc+"f)\n";
}
s+= ".texOffs("+u+", "+v+"),\n";
if (x==0 && y==0 && z==0 && rx==0 && ry==0 && rz==0){
s+= "PartPose.ZERO";
@ -119,27 +130,15 @@ public class Convert {
p.setRotationAngle(x, y, z);
}
public void c (){
boolean thinArms = true;
float scale = 0;
ModelPart body = new ModelPart(this, 16, 16, "body");
body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
body.setPos(0.0F, 0.0F, 0.0F);
if (thinArms) {
ModelPart leftShoulder = new ModelPart(this, 41, 32, "leftShoulder");
leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
leftShoulder.setPos(5.0F, 2.5F, 0.0F);
leftShoulder.mirror = true;
ModelPart rightShoulder = new ModelPart(this, 41, 16, "rightShoulder");
rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
} else {
ModelPart leftShoulder = new ModelPart(this, 40, 32, "leftShoulder");
leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
leftShoulder.setPos(5.0F, 2.0F, 0.0F);
leftShoulder.mirror = true;
ModelPart rightShoulder = new ModelPart(this, 40, 16, "rightShoulder");
rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
}
ModelPart leftLeg = new ModelPart(this, 0, 32, "leftLeg");
leftLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
leftLeg.setPos(1.9F, 12.0F, 0.0F);
ModelPart rightLeg = new ModelPart(this, 0, 16, "rightLeg");
rightLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
rightLeg.setPos(-1.9F, 12.0F, 0.0F);
}
}

View file

@ -6,6 +6,8 @@ import com.google.common.collect.Lists;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
@ -13,15 +15,31 @@ public class CrystaliteBootsModel extends HumanoidModel<LivingEntity> {
public ModelPart leftBoot;
public ModelPart rightBoot;
public static LayerDefinition getTexturedModelData() {
final float scale = 1.0f;
MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot();
CubeDeformation deformation = new CubeDeformation(scale + 0.25f);
modelPartData.addOrReplaceChild("leftBoot", CubeListBuilder.create()
.addBox(-2.0f, 0.0f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
.texOffs(0, 32),
PartPose.offset(1.9f, 12.0f, 0.0f));
modelPartData.addOrReplaceChild("rightBoot", CubeListBuilder.create()
.addBox(-2.0f, 0.0f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
.texOffs(0, 16),
PartPose.offset(-1.9f, 12.0f, 0.0f));
return LayerDefinition.create(modelData, 64, 48);
}
public CrystaliteBootsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.leftBoot = new ModelPart(this, 0, 32);
this.leftBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftBoot.setPos(1.9F, 12.0F, 0.0F);
this.rightBoot = new ModelPart(this, 0, 16);
this.rightBoot.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightBoot.setPos(-1.9F, 12.0F, 0.0F);
public CrystaliteBootsModel(ModelPart modelPart) {
super(modelPart, RenderType::entityTranslucent);
leftBoot = modelPart.getChild("leftBoot");
rightBoot = modelPart.getChild("rightBoot");
}
@Override

View file

@ -8,17 +8,31 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartNames;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
@Environment(EnvType.CLIENT)
public class CrystaliteHelmetModel extends HumanoidModel<LivingEntity> {
final ModelPart myHat;
public static LayerDefinition getTexturedModelData() {
final float scale = 1.0f;
MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot();
CubeDeformation deformation_hat = new CubeDeformation(scale + 0.5f);
PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create()
.addBox(-4.0f, -8.0f, -4.0f, 8.0f, 8.0f, 8.0f, deformation_hat)
.texOffs(0, 0),
PartPose.ZERO);
public CrystaliteHelmetModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.hat = new ModelPart(this, 0, 0);
this.hat.addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, scale + 0.5F);
this.hat.setPos(0.0F, 0.0F, 0.0F);
return LayerDefinition.create(modelData, 64, 48);
}
public CrystaliteHelmetModel(ModelPart modelPart) {
super(modelPart, RenderType::entityTranslucent);
myHat = modelPart.getChild(PartNames.HAT);
}
@Override
@ -28,6 +42,6 @@ public class CrystaliteHelmetModel extends HumanoidModel<LivingEntity> {
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(hat);
return Lists.newArrayList(myHat);
}
}

View file

@ -6,22 +6,46 @@ import com.google.common.collect.Lists;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartNames;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteLeggingsModel extends HumanoidModel<LivingEntity> {
public static LayerDefinition getTexturedModelData() {
float scale = 1.0f;
MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot();
CubeDeformation deformation = new CubeDeformation(scale);
modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
.addBox(-4.0f, 0.0f, -2.0f, 8.0f, 12.0f, 4.0f, deformation)
.texOffs(16, 16),
PartPose.ZERO);
public CrystaliteLeggingsModel(float scale) {
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
this.body.setPos(0.0F, 0.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 32);
this.leftLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPos(1.9F, 12.0F, 0.0F);
this.rightLeg = new ModelPart(this, 0, 16);
this.rightLeg.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPos(-1.9F, 12.0F, 0.0F);
modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create()
.addBox(-2.0f, 0.0f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
.texOffs(0, 32),
PartPose.offset(1.9f, 12.0f, 0.0f));
modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create()
.addBox(-2.0f, 0.0f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
.texOffs(0, 16),
PartPose.offset(-1.9f, 12.0f, 0.0f));
return LayerDefinition.create(modelData, 64, 48);
}
final ModelPart myBody;
final ModelPart myLeftLeg;
final ModelPart myRightLeg;
public CrystaliteLeggingsModel(ModelPart modelPart) {
super(modelPart, RenderType::entityTranslucent);
myBody = modelPart.getChild(PartNames.BODY);
myLeftLeg = modelPart.getChild(PartNames.LEFT_LEG);
myRightLeg = modelPart.getChild(PartNames.RIGHT_LEG);
}
@Override
@ -31,6 +55,6 @@ public class CrystaliteLeggingsModel extends HumanoidModel<LivingEntity> {
@Override
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, rightLeg, leftLeg);
return Lists.newArrayList(myBody, myRightLeg, myLeftLeg);
}
}