Continue mapping migration

This commit is contained in:
Aleksey 2021-04-12 21:38:22 +03:00
parent 99ade39404
commit f03fd03bd0
499 changed files with 12567 additions and 12723 deletions

View file

@ -9,75 +9,71 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry.ModelProvider;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry.TextureProvider;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.registry.EndItems;
@Environment(EnvType.CLIENT)
public class CrystaliteArmorProvider implements ModelProvider, TextureProvider {
private final static ResourceLocation FIRST_LAYER = new ResourceLocation(
"textures/models/armor/crystalite_layer_1.png");
private final static ResourceLocation SECOND_LAYER = new ResourceLocation(
"textures/models/armor/crystalite_layer_2.png");
private final static ResourceLocation FIRST_LAYER = new ResourceLocation("textures/models/armor/crystalite_layer_1.png");
private final static ResourceLocation SECOND_LAYER = new ResourceLocation("textures/models/armor/crystalite_layer_2.png");
private final static CrystaliteHelmetModel HELMET_MODEL = new CrystaliteHelmetModel(1.0F);
private final static CrystaliteChestplateModel CHEST_MODEL = new CrystaliteChestplateModel(1.0F, false);
private final static CrystaliteChestplateModel CHEST_MODEL_SLIM = new CrystaliteChestplateModel(1.0F, true);
private final static CrystaliteLeggingsModel LEGGINGS_MODEL = new CrystaliteLeggingsModel(1.0F);
private final static CrystaliteBootsModel BOOTS_MODEL = new CrystaliteBootsModel(1.0F);
@Override
public @NotNull ResourceLocation getArmorTexture(LivingEntity entity, ItemStack stack, EquipmentSlot slot,
boolean secondLayer, @Nullable String suffix, ResourceLocation defaultTexture) {
if (!isStackValid(stack))
return defaultTexture;
if (secondLayer)
return SECOND_LAYER;
if (!isStackValid(stack)) return defaultTexture;
if (secondLayer) return SECOND_LAYER;
return FIRST_LAYER;
}
@Override
public @NotNull BipedEntityModel<LivingEntity> getArmorModel(LivingEntity entity, ItemStack stack,
EquipmentSlot slot, BipedEntityModel<LivingEntity> defaultModel) {
if (!isStackValid(stack))
return defaultModel;
switch (slot) {
case HEAD: {
return HELMET_MODEL;
}
case CHEST: {
if (entity instanceof AbstractClientPlayerEntity
&& ((AbstractClientPlayerEntity) entity).getModel().equals("slim")) {
CHEST_MODEL_SLIM.setAttributes(defaultModel);
return CHEST_MODEL_SLIM;
public @NotNull HumanoidModel<LivingEntity> getArmorModel(LivingEntity entity, ItemStack stack,
EquipmentSlot slot, HumanoidModel<LivingEntity> defaultModel) {
if (!isStackValid(stack)) return defaultModel;
switch(slot) {
case HEAD: {
return HELMET_MODEL;
}
case CHEST: {
if (entity instanceof AbstractClientPlayer &&
((AbstractClientPlayer) entity).getModelName().equals("slim")) {
CHEST_MODEL_SLIM.copyPropertiesTo(defaultModel);
return CHEST_MODEL_SLIM;
}
CHEST_MODEL.copyPropertiesTo(defaultModel);
return CHEST_MODEL;
}
case LEGS: {
return LEGGINGS_MODEL;
}
case FEET: {
BOOTS_MODEL.copyPropertiesTo(defaultModel);
return BOOTS_MODEL;
}
default: {
return defaultModel;
}
CHEST_MODEL.setAttributes(defaultModel);
return CHEST_MODEL;
}
case LEGS: {
return LEGGINGS_MODEL;
}
case FEET: {
BOOTS_MODEL.setAttributes(defaultModel);
return BOOTS_MODEL;
}
default: {
return defaultModel;
}
}
}
public Iterable<Item> getRenderedItems() {
return Lists.newArrayList(EndItems.CRYSTALITE_HELMET, EndItems.CRYSTALITE_CHESTPLATE,
EndItems.CRYSTALITE_LEGGINGS, EndItems.CRYSTALITE_BOOTS);
return Lists.newArrayList(EndItems.CRYSTALITE_HELMET, EndItems.CRYSTALITE_CHESTPLATE, EndItems.CRYSTALITE_LEGGINGS, EndItems.CRYSTALITE_BOOTS);
}
private boolean isStackValid(ItemStack stack) {
return stack.getItem() == EndItems.CRYSTALITE_HELMET || stack.getItem() == EndItems.CRYSTALITE_CHESTPLATE
|| stack.getItem() == EndItems.CRYSTALITE_LEGGINGS || stack.getItem() == EndItems.CRYSTALITE_BOOTS;
return stack.getItem() == EndItems.CRYSTALITE_HELMET ||
stack.getItem() == EndItems.CRYSTALITE_CHESTPLATE ||
stack.getItem() == EndItems.CRYSTALITE_LEGGINGS ||
stack.getItem() == EndItems.CRYSTALITE_BOOTS;
}
}

View file

@ -1,43 +1,41 @@
package ru.betterend.item.model;
import java.util.Collections;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteBootsModel extends BipedEntityModel<LivingEntity> {
public class CrystaliteBootsModel extends HumanoidModel<LivingEntity> {
public ModelPart leftBoot;
public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
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.setPivot(1.9F, 12.0F, 0.0F);
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.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightBoot.setPivot(-1.9F, 12.0F, 0.0F);
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);
}
@Override
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftBoot.copyFrom(leftLeg);
this.rightBoot.copyFrom(rightLeg);
}
@Override
public void setAttributes(BipedEntityModel<LivingEntity> bipedEntityModel) {
super.setAttributes(bipedEntityModel);
this.leftBoot.copyPositionAndRotation(leftLeg);
this.rightBoot.copyPositionAndRotation(rightLeg);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(leftBoot, rightBoot);
}
}

View file

@ -1,74 +1,72 @@
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.util.Arm;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> {
public class CrystaliteChestplateModel extends HumanoidModel<LivingEntity> {
public ModelPart leftShoulder;
public ModelPart rightShoulder;
private boolean thinArms;
public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
this.thinArms = thinArms;
this.torso = new ModelPart(this, 16, 16);
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.body = new ModelPart(this, 16, 16);
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
this.body.setPos(0.0F, 0.0F, 0.0F);
if (thinArms) {
this.leftShoulder = new ModelPart(this, 41, 32);
this.leftShoulder.addCuboid(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.leftShoulder.setPivot(5.0F, 2.5F, 0.0F);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.leftShoulder.setPos(5.0F, 2.5F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 41, 16);
this.rightShoulder.addCuboid(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.rightShoulder.setPivot(-5.0F, 2.5F, 10.0F);
this.rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
this.rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
} else {
this.leftShoulder = new ModelPart(this, 40, 32);
this.leftShoulder.addCuboid(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.leftShoulder.setPivot(5.0F, 2.0F, 0.0F);
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.leftShoulder.setPos(5.0F, 2.0F, 0.0F);
this.leftShoulder.mirror = true;
this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addCuboid(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.rightShoulder.setPivot(-5.0F, 2.0F, 10.0F);
this.rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
this.rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
}
}
@Override
public void setAttributes(BipedEntityModel<LivingEntity> bipedEntityModel) {
super.setAttributes(bipedEntityModel);
this.leftShoulder.copyPositionAndRotation(leftArm);
this.rightShoulder.copyPositionAndRotation(rightArm);
public void copyPropertiesTo(HumanoidModel<LivingEntity> bipedEntityModel) {
super.copyPropertiesTo(bipedEntityModel);
this.leftShoulder.copyFrom(leftArm);
this.rightShoulder.copyFrom(rightArm);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(torso, leftShoulder, rightShoulder);
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, leftShoulder, rightShoulder);
}
@Override
public void setArmAngle(Arm arm, MatrixStack matrices) {
public void translateToHand(HumanoidArm arm, PoseStack 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;
float f = 0.5F * (float)(arm == HumanoidArm.RIGHT ? 1 : -1);
modelPart.x += f;
modelPart.translateAndRotate(matrices);
modelPart.x -= f;
} else {
modelPart.rotate(matrices);
modelPart.translateAndRotate(matrices);
}
}
}

View file

@ -6,28 +6,28 @@ import com.google.common.collect.Lists;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
@Environment(EnvType.CLIENT)
public class CrystaliteHelmetModel extends BipedEntityModel<LivingEntity> {
public class CrystaliteHelmetModel extends HumanoidModel<LivingEntity> {
public CrystaliteHelmetModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
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.setPivot(0.0F, 0.0F, 0.0F);
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);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(helmet);
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(hat);
}
}

View file

@ -1,36 +1,34 @@
package ru.betterend.item.model;
import java.util.Collections;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.world.entity.LivingEntity;
public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> {
public class CrystaliteLeggingsModel extends HumanoidModel<LivingEntity> {
public CrystaliteLeggingsModel(float scale) {
super(RenderLayer::getEntityTranslucent, scale, 0.0F, 64, 48);
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.setPivot(0.0F, 0.0F, 0.0F);
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.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPivot(1.9F, 12.0F, 0.0F);
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.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.addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPos(-1.9F, 12.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
protected Iterable<ModelPart> headParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(torso, rightLeg, leftLeg);
protected Iterable<ModelPart> bodyParts() {
return Lists.newArrayList(body, rightLeg, leftLeg);
}
}