- 14
- 1
Описываю суть проблемы. Не получается зарендрить модель сумки которая на игроке должна выглядеть так:
А вы глядит как будто просто наложена обычная текстурка. Вот сама текстурка:
Вот сами классы, подскажите где сделал ошибку.
Java:
package render;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
import render.proxy.CommonProxy;
@Mod(modid = Main.MODID, name = Main.NAME, version = Main.VERSION)
public class Main {
public static final String
MODID = "items",
NAME = "BackPack",
VERSION = "0.1";
@SidedProxy(clientSide="render.proxy.ClientProxy", serverSide="render.proxy.CommonProxy")
public static CommonProxy proxy;
public static CreativeTabs tabItems = new tabItems("items");
public static Item BackPack;
public static final ArmorMaterial BackPackMat = EnumHelper.addArmorMaterial("BackPackMat", 100, new int[] {3, 8, 6, 3}, 10);
@EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
BackPack = new BackPack().setUnlocalizedName("BackPack");
GameRegistry.registerItem(BackPack, "BackPack");
}
}
Java:
package render;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import render.proxy.ClientProxy;
public class BackPack extends ItemArmor{
public BackPack() {
super(Main.BackPackMat, 0, 1);
this.setMaxStackSize(1);
this.setCreativeTab(Main.tabItems);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
super.itemIcon = par1IconRegister.registerIcon("items:BackPack_icon");
}
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
if (slot == 1)
return "items:textures/model/ModelBackPack.png";
return "items:textures/model/ModelBackPack.png";
}
@SideOnly(Side.CLIENT)
@Override
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if (armorSlot != 1)
return null;
if (itemStack != null && itemStack.getItem() instanceof BackPack) {
ModelBiped model = ClientProxy.getArmorModel();
return model;
}
else
return null;
}
}
Java:
package render;
import java.util.ArrayList;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelBackPack extends ModelBiped
{
ModelRenderer Part_0; // Shape1
ModelRenderer Part_1; // Shape2
ModelRenderer Part_2; // Shape3
ModelRenderer Part_3; // Shape4
ModelRenderer Part_4; // Shape5
ModelRenderer Part_5; // Shape6
ModelRenderer Part_6; // Shape7
ModelRenderer Part_7; // Shape8
ModelRenderer Part_8; // Shape9
ModelRenderer Part_9; // Shape10
ModelRenderer Part_10; // Shape11
public ModelBackPack()
{
textureWidth = 128;
textureHeight = 64;
Part_0 = new ModelRenderer(this, 0, 51); // Shape1
Part_0.addBox(0F, 0F, -4F, 4, 4, 8);
Part_0.setRotationPoint(3F, 11F, 0F);
Part_0.setTextureSize(128, 64);
Part_0.mirror = true;
setRotation(Part_0, 0F, 0F, 0F);
Part_1 = new ModelRenderer(this, 0, 40); // Shape2
Part_1.addBox(0F, 0F, -4F, 5, 3, 8);
Part_1.setRotationPoint(3F, 8F, 0F);
Part_1.setTextureSize(128, 64);
Part_1.mirror = true;
setRotation(Part_1, 0F, 0F, 0F);
Part_2 = new ModelRenderer(this, 0, 25); // Shape3
Part_2.addBox(0F, 0F, 0F, 1, 14, 1);
Part_2.setRotationPoint(-5F, 0F, -3F);
Part_2.setTextureSize(128, 64);
Part_2.mirror = true;
setRotation(Part_2, 0F, 0F, -0.63203639F);
Part_3 = new ModelRenderer(this, 0, 25); // Shape4
Part_3.addBox(0F, 0F, 0F, 1, 13, 1);
Part_3.setRotationPoint(-5F, 0F, 2F);
Part_3.setTextureSize(128, 64);
Part_3.mirror = true;
setRotation(Part_3, 0F, 0F, -0.63203639F);
Part_4 = new ModelRenderer(this, 24, 51); // Shape5
Part_4.addBox(0F, 0F, 0F, 4, 2, 2);
Part_4.setRotationPoint(5F, 10F, -1F);
Part_4.setTextureSize(128, 64);
Part_4.mirror = true;
setRotation(Part_4, 0F, 0F, 0F);
Part_5 = new ModelRenderer(this, 24, 55); // Shape6
Part_5.addBox(0F, 0F, 0F, 4, 2, 2);
Part_5.setRotationPoint(4F, 11F, -1F);
Part_5.setTextureSize(128, 64);
Part_5.mirror = true;
setRotation(Part_5, 0F, 0F, 0F);
Part_6 = new ModelRenderer(this, 26, 42); // Shape7
Part_6.addBox(0F, 0F, 0F, 4, 1, 8);
Part_6.setRotationPoint(3F, 7F, -4F);
Part_6.setTextureSize(128, 64);
Part_6.mirror = true;
setRotation(Part_6, 0F, 0F, 0F);
Part_7 = new ModelRenderer(this, 12, 0); // Shape8
Part_7.addBox(0F, 0F, 0F, 2, 7, 2);
Part_7.setRotationPoint(4F, 8F, 4F);
Part_7.setTextureSize(128, 64);
Part_7.mirror = true;
setRotation(Part_7, 0F, 0F, 0F);
Part_8 = new ModelRenderer(this, 0, 0); // Shape9
Part_8.addBox(0F, 0F, 0F, 2, 2, 4);
Part_8.setRotationPoint(4F, 11F, 3F);
Part_8.setTextureSize(128, 64);
Part_8.mirror = true;
setRotation(Part_8, 0F, 0F, 0F);
Part_9 = new ModelRenderer(this, 0, 18); // Shape10
Part_9.addBox(0F, 0F, 0F, 1, 1, 6);
Part_9.setRotationPoint(-5F, 0F, -3F);
Part_9.setTextureSize(128, 64);
Part_9.mirror = true;
setRotation(Part_9, 0F, 0F, 0F);
Part_10 = new ModelRenderer(this, 0, 0); // Shape11
Part_10.addBox(0F, 0F, 0F, 4, 2, 2);
Part_10.setRotationPoint(3F, 11F, 4F);
Part_10.setTextureSize(128, 64);
Part_10.mirror = true;
setRotation(Part_10, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Part_0.render(f5); // Shape1
Part_1.render(f5); // Shape2
Part_2.render(f5); // Shape3
Part_3.render(f5); // Shape4
Part_4.render(f5); // Shape5
Part_5.render(f5); // Shape6
Part_6.render(f5); // Shape7
Part_7.render(f5); // Shape8
Part_8.render(f5); // Shape9
Part_9.render(f5); // Shape10
Part_10.render(f5); // Shape11
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
private ArrayList<ModelRenderer> modelList = new ArrayList<ModelRenderer>();
{
modelList.add(Part_0);
modelList.add(Part_1);
modelList.add(Part_2);
modelList.add(Part_3);
modelList.add(Part_4);
modelList.add(Part_5);
modelList.add(Part_6);
modelList.add(Part_7);
modelList.add(Part_8);
modelList.add(Part_9);
modelList.add(Part_10);
}
}
Java:
package render.proxy;
import net.minecraft.client.model.ModelBiped;
import render.ModelBackPack;
public class ClientProxy extends CommonProxy{
@Override
public void init(ModelBackPack ModelBackPack) {
super.init(ModelBackPack);
ModelBackPack = new ModelBackPack();
ModelBackPack.bipedHead.showModel = false;
ModelBackPack.bipedHeadwear.showModel = false;
ModelBackPack.bipedBody.showModel = false;
ModelBackPack.bipedLeftArm.showModel = false;
ModelBackPack.bipedRightArm.showModel = false;
ModelBackPack.bipedLeftLeg.showModel = false;
ModelBackPack.bipedRightLeg.showModel = false;
ModelBackPack.bipedCloak.showModel = false;
}
public static ModelBiped getArmorModel() {
return null;
}
package render.proxy;
import render.ModelBackPack;
public class CommonProxy {
public void init(ModelBackPack ModelBackPack) {
}
}
}