This commit is contained in:
LZX committed 2026-09-05 23:08:45 +08:00
1 parent 2c2dd8e8db
commit 4cff8d85a3
13 files changed
+154 -17

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ mod_name=Lzxnone Terraria
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved mod_license=All Rights Reserved
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=1.9.0 mod_version=1.9.1
## The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. ## The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -1,5 +1,6 @@
package com.lzxnone.terraria.client; package com.lzxnone.terraria.client;
import com.lzxnone.terraria.client.model.armor.GemRobeModel;
import com.lzxnone.terraria.client.model.armor.RobeModel; import com.lzxnone.terraria.client.model.armor.RobeModel;
import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.item.ModItems;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -23,11 +24,12 @@ public class ClientArmorRegistration {
// 1. 注册 3D 护甲模型的骨骼网格定义 // 1. 注册 3D 护甲模型的骨骼网格定义
public static void onRegisterLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { public static void onRegisterLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(RobeModel.LAYER_LOCATION, RobeModel::createBodyLayer); event.registerLayerDefinition(RobeModel.LAYER_LOCATION, RobeModel::createBodyLayer);
event.registerLayerDefinition(GemRobeModel.LAYER_LOCATION, GemRobeModel::createBodyLayer);
} }
// 2. 注册物品穿戴时的 3D 模型拦截与替换 // 2. 注册物品穿戴时的 3D 模型拦截与替换
public static void onRegisterClientExtensions(RegisterClientExtensionsEvent event) { public static void onRegisterClientExtensions(RegisterClientExtensionsEvent event) {
// 全部 7 种宝石长袍共享通用 3D 长袍模型(各自材质由 Material Layer 独立加载贴图) // 普通长袍 3D 模型
event.registerItem(new IClientItemExtensions() { event.registerItem(new IClientItemExtensions() {
private RobeModel model; private RobeModel model;
@@ -47,7 +49,29 @@ public class ClientArmorRegistration {
return this.model; return this.model;
} }
}, },
ModItems.ROBE.get(), ModItems.ROBE.get()
);
// 7 种宝石长袍 3D 模型
event.registerItem(new IClientItemExtensions() {
private GemRobeModel model;
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public Model getGenericArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) {
if (this.model == null) {
this.model = new GemRobeModel(Minecraft.getInstance().getEntityModels().bakeLayer(GemRobeModel.LAYER_LOCATION));
}
original.copyPropertiesTo((HumanoidModel) this.model);
this.model.setAllVisible(false);
this.model.body.visible = true;
this.model.rightArm.visible = true;
this.model.leftArm.visible = true;
this.model.rightLeg.visible = true;
this.model.leftLeg.visible = true;
return this.model;
}
},
ModItems.AMETHYST_ROBE.get(), ModItems.AMETHYST_ROBE.get(),
ModItems.TOPAZ_ROBE.get(), ModItems.TOPAZ_ROBE.get(),
ModItems.SAPPHIRE_ROBE.get(), ModItems.SAPPHIRE_ROBE.get(),
@@ -0,0 +1,87 @@
package com.lzxnone.terraria.client.model.armor;
import com.lzxnone.terraria.LzxnoneTerraria;
import net.minecraft.client.model.HumanoidArmorModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
public class GemRobeModel extends HumanoidArmorModel<LivingEntity> {
public static final ModelLayerLocation LAYER_LOCATION =
new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "gem_robe"), "main");
public final ModelPart skirt;
public GemRobeModel(ModelPart root) {
super(root);
this.skirt = this.body.getChild("skirt");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = HumanoidArmorModel.createMesh(new CubeDeformation(0.5F), 0.0F);
PartDefinition partdefinition = meshdefinition.getRoot();
// 头部与头盔(长袍无头部模型)
partdefinition.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.ZERO);
partdefinition.addOrReplaceChild("hat", CubeListBuilder.create(), PartPose.ZERO);
// 躯干 (宝石长袍身体)
PartDefinition body = partdefinition.addOrReplaceChild("body",
CubeListBuilder.create()
.texOffs(0, 0).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F))
.texOffs(26, 0).addBox(-4.0F, -1.5F, 1.5F, 8.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(70, 0).addBox(-3.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(70, 0).mirror().addBox(1.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(46, 0).addBox(-1.0F, 2.3F, -2.8F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(54, 0).addBox(-1.0F, 4.9F, -2.8F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(62, 0).addBox(-1.0F, 6.0F, -2.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)),
PartPose.ZERO
);
// 腰带 (Skirt,保留腰带挂载于身体)
body.addOrReplaceChild("skirt",
CubeListBuilder.create()
.texOffs(0, 36).addBox(-4.5F, -1.5F, -2.5F, 9.0F, 2.0F, 5.0F, new CubeDeformation(0.1F)),
PartPose.offset(0.0F, 12.0F, 0.0F)
);
// 右臂 (宝石长袍袖子)
partdefinition.addOrReplaceChild("right_arm",
CubeListBuilder.create()
.texOffs(0, 20).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.5F)),
PartPose.offset(-5.0F, 2.0F, 0.0F)
);
// 左臂 (宝石长袍袖子)
partdefinition.addOrReplaceChild("left_arm",
CubeListBuilder.create()
.texOffs(0, 20).mirror().addBox(-1.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.5F)).mirror(false),
PartPose.offset(5.0F, 2.0F, 0.0F)
);
// 右腿 (右半侧裙摆,随右腿前后摆动)
partdefinition.addOrReplaceChild("right_leg",
CubeListBuilder.create()
.texOffs(32, 36).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 6.0F, 5.0F, new CubeDeformation(0.0F))
.texOffs(64, 36).addBox(-3.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(10, 52).addBox(-2.4F, 0.0F, -2.9F, 2.0F, 12.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(30, 52).addBox(-3.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(-1.9F, 12.0F, 0.0F)
);
// 左腿 (左半侧裙摆,随左腿前后摆动)
partdefinition.addOrReplaceChild("left_leg",
CubeListBuilder.create()
.texOffs(32, 36).mirror().addBox(-2.5F, 0.0F, -2.5F, 5.0F, 6.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(64, 36).mirror().addBox(-2.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(10, 52).mirror().addBox(0.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(30, 52).mirror().addBox(2.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false),
PartPose.offset(1.9F, 12.0F, 0.0F)
);
return LayerDefinition.create(meshdefinition, 128, 128);
}
}
@@ -13,49 +13,75 @@ public class RobeModel extends HumanoidArmorModel<LivingEntity> {
public static final ModelLayerLocation LAYER_LOCATION = public static final ModelLayerLocation LAYER_LOCATION =
new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "robe"), "main"); new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "robe"), "main");
public final ModelPart skirt;
public RobeModel(ModelPart root) { public RobeModel(ModelPart root) {
super(root); super(root);
this.skirt = this.body.getChild("skirt");
} }
public static LayerDefinition createBodyLayer() { public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = HumanoidArmorModel.createMesh(new CubeDeformation(0.5F), 0.0F); MeshDefinition meshdefinition = HumanoidArmorModel.createMesh(new CubeDeformation(0.5F), 0.0F);
PartDefinition partdefinition = meshdefinition.getRoot(); PartDefinition partdefinition = meshdefinition.getRoot();
// 头部与头盔(长袍无头部模型)
partdefinition.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.ZERO);
partdefinition.addOrReplaceChild("hat", CubeListBuilder.create(), PartPose.ZERO);
// 躯干 (长袍身体) // 躯干 (长袍身体)
partdefinition.addOrReplaceChild("body", PartDefinition body = partdefinition.addOrReplaceChild("body",
CubeListBuilder.create() CubeListBuilder.create()
.texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), .texOffs(0, 0).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.25F))
.texOffs(26, 0).addBox(-4.0F, -1.5F, 1.5F, 8.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(46, 0).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(76, 0).addBox(-3.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(76, 0).mirror().addBox(1.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(60, 0).addBox(-1.0F, 4.0F, -3.2F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(68, 0).addBox(-1.0F, 6.0F, -2.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)),
PartPose.ZERO PartPose.ZERO
); );
// 右臂 // 腰带与中间飘带 (Skirt,保留腰带与前后垂带挂载于身体)
body.addOrReplaceChild("skirt",
CubeListBuilder.create()
.texOffs(0, 36).addBox(-4.5F, -1.5F, -2.5F, 9.0F, 2.0F, 5.0F, new CubeDeformation(0.1F)),
PartPose.offset(0.0F, 12.0F, 0.0F)
);
// 右臂 (长袍宽袖)
partdefinition.addOrReplaceChild("right_arm", partdefinition.addOrReplaceChild("right_arm",
CubeListBuilder.create() CubeListBuilder.create()
.texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), .texOffs(0, 20).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.5F)),
PartPose.ZERO PartPose.offset(-5.0F, 2.0F, 0.0F)
); );
// 左臂 // 左臂 (长袍宽袖)
partdefinition.addOrReplaceChild("left_arm", partdefinition.addOrReplaceChild("left_arm",
CubeListBuilder.create() CubeListBuilder.create()
.texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), .texOffs(0, 20).mirror().addBox(-1.0F, -2.0F, -2.0F, 4.0F, 8.0F, 4.0F, new CubeDeformation(0.5F)).mirror(false),
PartPose.ZERO PartPose.offset(5.0F, 2.0F, 0.0F)
); );
// 右腿 // 右腿 (长袍内衬 + 右半侧裙摆,随右腿前后摆动)
partdefinition.addOrReplaceChild("right_leg", partdefinition.addOrReplaceChild("right_leg",
CubeListBuilder.create() CubeListBuilder.create()
.texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), .texOffs(32, 36).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 6.0F, 5.0F, new CubeDeformation(0.0F))
.texOffs(64, 36).addBox(-3.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(10, 52).addBox(-2.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(30, 52).addBox(-3.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(-1.9F, 12.0F, 0.0F) PartPose.offset(-1.9F, 12.0F, 0.0F)
); );
// 左腿 // 左腿 (长袍内衬 + 左半侧裙摆,随左腿前后摆动)
partdefinition.addOrReplaceChild("left_leg", partdefinition.addOrReplaceChild("left_leg",
CubeListBuilder.create() CubeListBuilder.create()
.texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), .texOffs(32, 36).mirror().addBox(-2.5F, 0.0F, -2.5F, 5.0F, 6.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(64, 36).mirror().addBox(-2.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(10, 52).mirror().addBox(0.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(30, 52).mirror().addBox(2.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false),
PartPose.offset(1.9F, 12.0F, 0.0F) PartPose.offset(1.9F, 12.0F, 0.0F)
); );
return LayerDefinition.create(meshdefinition, 64, 64); return LayerDefinition.create(meshdefinition, 128, 128);
} }
} }
@@ -56,7 +56,7 @@ public abstract class GemStaff extends MagicWeapon {
public static final double BURST_OFFSET = -1.2D; public static final double BURST_OFFSET = -1.2D;
public static final int LIFETIME = 50; public static final int LIFETIME = 50;
public static final double INITIAL_TURN_ANGLE = Math.toRadians(5.0D); public static final double INITIAL_TURN_ANGLE = Math.toRadians(10);
public static final double DASHED_TURN_ANGLE = Math.toRadians(30.0D); public static final double DASHED_TURN_ANGLE = Math.toRadians(30.0D);
public static final int DASH_TICKS = 1; public static final int DASH_TICKS = 1;
public static final double DEFAULT_HITBOX_INFLATE = 0.35D; public static final double DEFAULT_HITBOX_INFLATE = 0.35D;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 1.5 KiB