本篇教程由作者设定未经允许禁止转载。
本方法基于Mixin技术,建议先学习并掌握基本原理。
首先mixin焰魔套的材质渲染(注意焰魔套和焰魔鞘翅胸甲是分开注册的),然后修改渲染的逻辑:
package com.hanz0.stellarisdlc.mixins;
import L_Ender.cataclysm.items.Ignitium_Armor;
import com.hanz0.stellarisdlc.init.StellarisdlcModMobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(value = Ignitium_Armor.class, remap = false)
public class Ignitium_ArmorMixin {
/**
* @author
* @reason
*/
@Overwrite
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
if (entity instanceof LivingEntity Liv) {
if (Liv.hasEffect(StellarisdlcModMobEffects.IGNIS_SLASH.get())) {
return "cataclysm:textures/armor/soul_ignitium_armor" + (slot == EquipmentSlot.LEGS ? "_legs_soul.png" : ".png");
}
}
return "cataclysm:textures/armor/ignitium_armor" + (slot == EquipmentSlot.LEGS ? "_legs.png" : ".png");
}
}
package com.hanz0.stellarisdlc.mixins;
import L_Ender.cataclysm.items.Ignitium_Elytra_ChestPlate;
import com.hanz0.stellarisdlc.init.StellarisdlcModMobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import javax.annotation.Nullable;
@Mixin(value = Ignitium_Elytra_ChestPlate.class, remap = false)
public class Ignitium_Elytra_ChestPlateMixin {
/**
* @author
* @reason
*/
@Nullable
@Overwrite
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
if (entity instanceof LivingEntity Liv) {
if (Liv.hasEffect(StellarisdlcModMobEffects.IGNIS_SLASH.get())) {
return "cataclysm:textures/armor/soul_ignitium_elytra_chestplate.png";
}
}
return "cataclysm:textures/armor/ignitium_elytra_chestplate.png";
}
}
这里笔者以自己设计的buff为判断条件,而且要注意!焰魔套变色后的材质带有前后缀!读者可以自行修改测试。
然后新做一个材质包,路径与灾变的焰魔套材质保持一致,命名则以修改后的为准:
将模组导出并和材质包安放准确后,进游戏就实现效果了: