好吧,我正试图覆盖Minecraft的正常装甲 我需要取消正常Minecraft的装甲渲染,但它仍然显示旧装甲......
这是它的样子:
this (我不希望它呈现“大”盔甲)
这是我使用的代码:
package com.bnhc.items;
import com.bnhc.client.render.CArmour;
import com.bnhc.main.Main;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class CCloth extends ItemArmor {
public CCloth(ArmorMaterial material, int armorType, int armorIndex) {
super(material, armorType, armorIndex);
}
public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String layer) {
if(((itemstack.getItem() == MIte.ua_sports_layer_1) || (itemstack.getItem() == MIte.ua_sports_layer_1))){
return "bnhc:textures/armour/uasports_layer_1.png";
}
return null;
}
CArmour armorModel = new CArmour(0.0F);
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if (itemStack != null) {
if (itemStack.getItem() instanceof CCloth) {
int type = ((ItemArmor)itemStack.getItem()).armorType;
if (type == 1) {
armorModel = Main.proxy.getArmorModel(0);
} else {
armorModel = Main.proxy.getArmorModel(1);
}
}
if (armorModel != null) {
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
armorModel.heldItemRight = entityLiving.getEquipmentInSlot(0) != null ? 1 :0;
if(entityLiving instanceof EntityPlayer) {
armorModel.aimedBow =((EntityPlayer)entityLiving).getItemInUseDuration() > 2;
}
return armorModel;
}
}
return armorModel;
}
}
这是我的客户端代理:
@Override
public CArmour getArmorModel(int id) {
return customArmour;
}
-edit 好吧,我让它工作..基本上我做错了是它已经被默认呈现为使其成为“ModelBiped”(如果我错了请纠正我)所以我所要做的就是删除客户代理的东西......
这就是现在的样子(固定版本):
package com.bnhc.items;
import com.bnhc.CreativeTabs.CTBS;
import com.bnhc.main.Ref;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
public class CCloth extends ItemArmor {
public CCloth(ArmorMaterial armorMaterial, int renderindex, int armortype,String name) {
super(armorMaterial, renderindex, armortype);
}
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
if(stack.getItem() == MIte.ua_sports_chest) {
return Ref.MODID+ ":textures/armour/uasports_layer_1.png";
}else if(stack.getItem() == MIte.ua_sports_leggs){
return Ref.MODID+ ":textures/armour/uasports_layer_2.png";
}else {
return null;
}
}
ModelBiped armorModel = new ModelBiped();
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving,
ItemStack itemStack, int armorSlot) {
if(itemStack != null){
if(armorModel != null){
armorModel.bipedRightLeg.showModel = armorSlot == 2;
armorModel.bipedLeftLeg.showModel = armorSlot == 2;
armorModel.bipedBody.showModel = armorSlot == 1;
armorModel.bipedRightArm.showModel = armorSlot == 1;
armorModel.bipedLeftArm.showModel = armorSlot == 1;
armorModel.bipedHead.showModel = armorSlot == 0;
armorModel.isSneak = entityLiving.isSneaking();
armorModel.isRiding = entityLiving.isRiding();
armorModel.isChild = entityLiving.isChild();
armorModel.heldItemRight = entityLiving.getEquipmentInSlot(0) != null ? 1 :0;
if(entityLiving instanceof EntityPlayer){
armorModel.aimedBow =((EntityPlayer)entityLiving).getItemInUseDuration() > 2;
}
return armorModel;
}
}
return armorModel;
}
}
我在客户端代理中删除了我的东西,因为@SideOnly注释不需要它并且渲染了2次..