WIP: custom armor model

This commit is contained in:
Aleksey 2020-11-30 22:47:34 +03:00
parent aac9844252
commit 04de4d0873
7 changed files with 9 additions and 20 deletions

View file

@ -43,24 +43,9 @@ public class CrystaliteArmorProvider implements ModelProvider, TextureProvider {
public @NotNull BipedEntityModel<LivingEntity> getArmorModel(LivingEntity entity, ItemStack stack, public @NotNull BipedEntityModel<LivingEntity> getArmorModel(LivingEntity entity, ItemStack stack,
EquipmentSlot slot, BipedEntityModel<LivingEntity> defaultModel) { EquipmentSlot slot, BipedEntityModel<LivingEntity> defaultModel) {
if (!isStackValid(stack)) return defaultModel; if (!isStackValid(stack)) return defaultModel;
if (entity instanceof AbstractClientPlayerEntity &&
((AbstractClientPlayerEntity) entity).getModel().equals("slim") &&
slot == EquipmentSlot.CHEST) {
return CHEST_MODEL_SLIM;
}
switch(slot) { switch(slot) {
case HEAD: { case HEAD: {
return new CrystaliteHelmetModel(1.0F); return HELMET_MODEL;
}
case CHEST: {
return new CrystaliteChestplateModel(1.0F, false);
}
case LEGS: {
return new CrystaliteChestplateModel(1.0F, true);
}
case FEET: {
return new CrystaliteBootsModel(1.0F);
} }
default: { default: {
return defaultModel; return defaultModel;

View file

@ -5,6 +5,7 @@ import java.util.Collections;
import com.google.common.collect.Lists; 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.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -14,7 +15,7 @@ public class CrystaliteBootsModel extends BipedEntityModel<LivingEntity> {
public ModelPart rightBoot; public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) { public CrystaliteBootsModel(float scale) {
super(scale); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32);
this.leftBoot = new ModelPart(this, 0, 16); this.leftBoot = new ModelPart(this, 0, 16);
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);

View file

@ -5,6 +5,7 @@ import java.util.Collections;
import com.google.common.collect.Lists; 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.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -14,7 +15,7 @@ public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> {
public ModelPart rightShoulder; public ModelPart rightShoulder;
public CrystaliteChestplateModel(float scale, boolean thinArms) { public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(scale); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32);
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);
this.torso.setPivot(0.0F, 0.0F, 0.0F); this.torso.setPivot(0.0F, 0.0F, 0.0F);

View file

@ -8,6 +8,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
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.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -15,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(scale); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32);
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

@ -5,13 +5,14 @@ import java.util.Collections;
import com.google.common.collect.Lists; 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.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> { public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> {
public CrystaliteLeggingsModel(float scale) { public CrystaliteLeggingsModel(float scale) {
super(scale); super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 32);
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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 489 B

Before After
Before After