• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Non résolu Problème d'épée 3D

    Sans suite
    1.7.10
    1
    1
    340
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • Goldenstars_
      Goldenstars_ dernière édition par Superloup10

      Bonjour, j’aimerais créer une épée 3D j’ai alors chercher sur le net des tutos ou autre pour m’aider. J’ai bien trouvé quelque chose mais quand je le fais j’ai simplement la texture de l’icône et non la texture 3d voulue.
      Version: 1.7.10

      La Class principal

      @Mod(modid="xellion", name="XellionRPG", version="1.0.0")
      public class XellionRPG
      {
      	public static Item.ToolMaterial saotoolmat = EnumHelper.addToolMaterial("SAO", 3, 1000, 7.0F, 3.0F, 9);
      	
      	  public static Item SwordTest;
      	  int SwordTestid = 20005;
      	
      	@SidedProxy(clientSide="com.xellion.mod.proxy.ClientProxy", serverSide="com.xellion.mod.proxy.CommonProxy")
      	  public static CommonProxy proxy;
      	  
      	  @Mod.EventHandler
      	  public void preInit(FMLPreInitializationEvent event)
      	  {
      
      	  }
      	  
      	  @Mod.EventHandler
      	  public void init(FMLInitializationEvent event)
      	  {
      		  SwordTest = new SwordTest(this.SwordTestid, saotoolmat, 15.0F).setUnlocalizedName("SwordTest").setCreativeTab(CreativeTabs.tabCombat);
      		  
      		  GameRegistry.registerItem(SwordTest, "SwordTest");
      		  
      		  proxy.registerRenders();
      	  }
      	  
      	  @Mod.EventHandler
      	  public void postInit(FMLPostInitializationEvent event)
      	  {
      		  
      	  }
      	}
      

      La Class de l’épée

      public class SwordTest extends ItemSword
      {
        protected final float weaponDamage;
        
        public SwordTest(int SwordTestid, Item.ToolMaterial mat, float damage)
        {
          super(mat);
          this.weaponDamage = damage;
        }
        
        @SideOnly(Side.CLIENT)
        public void registerIcons(IIconRegister reg)
        {
          this.itemIcon = reg.registerIcon("xellion:SwordTestIcon");
        }
        
        public Multimap getItemAttributeModifiers()
        {
          Multimap multimap = HashMultimap.create();
          multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Modification", this.weaponDamage, 0));
          return multimap;
        }
      }
      
      

      La Class du model de l’épée

      public class ModelSwordTest extends ModelBase
      {
          ModelRenderer Shape1;
          ModelRenderer Shape2;
          ModelRenderer Shape3;
          ModelRenderer Shape4;
          ModelRenderer Shape5;
          ModelRenderer Shape6;
          ModelRenderer Shape7;
        
        public ModelSwordTest()
        {
          textureWidth = 64;
          textureHeight = 32;
          
            Shape1 = new ModelRenderer(this, 0, 0);
            Shape1.addBox(-1.5F, -0.5F, -3F, 3, 1, 6);
            Shape1.setRotationPoint(0F, 11F, 0F);
            Shape1.setTextureSize(64, 32);
            Shape1.mirror = true;
            setRotation(Shape1, 0F, 0F, 0F);
            Shape2 = new ModelRenderer(this, 0, 8);
            Shape2.addBox(-0.5F, -2F, -0.5F, 1, 4, 1);
            Shape2.setRotationPoint(0F, 13F, 0F);
            Shape2.setTextureSize(64, 32);
            Shape2.mirror = true;
            setRotation(Shape2, 0F, 0F, 0F);
            Shape3 = new ModelRenderer(this, 0, 14);
            Shape3.addBox(-1.5F, -0.5F, -1.5F, 3, 1, 3);
            Shape3.setRotationPoint(0F, 15F, 0F);
            Shape3.setTextureSize(64, 32);
            Shape3.mirror = true;
            setRotation(Shape3, 0F, 0F, 0F);
            Shape4 = new ModelRenderer(this, 19, 0);
            Shape4.addBox(-0.5F, -4.5F, -1.5F, 1, 9, 3);
            Shape4.setRotationPoint(0F, 6F, 0F);
            Shape4.setTextureSize(64, 32);
            Shape4.mirror = true;
            setRotation(Shape4, 0F, 0F, 0F);
            Shape5 = new ModelRenderer(this, 19, 13);
            Shape5.addBox(-0.5F, -0.5F, -1F, 1, 1, 2);
            Shape5.setRotationPoint(0F, 1.15F, 0.43F);
            Shape5.setTextureSize(64, 32);
            Shape5.mirror = true;
            setRotation(Shape5, -0.7853982F, 0F, 0F);
            Shape6 = new ModelRenderer(this, 19, 17);
            Shape6.addBox(-0.5F, -0.5F, -1F, 1, 1, 2);
            Shape6.setRotationPoint(0F, 1.15F, -0.43F);
            Shape6.setTextureSize(64, 32);
            Shape6.mirror = true;
            setRotation(Shape6, 0.7853982F, 0F, 0F);
            Shape7 = new ModelRenderer(this, 19, 21);
            Shape7.addBox(-0.5F, -0.5F, -0.5F, 1, 2, 2);
            Shape7.setRotationPoint(0F, 0.7F, 0F);
            Shape7.setTextureSize(64, 32);
            Shape7.mirror = true;
            setRotation(Shape7, -0.7853982F, 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);
          Shape1.render(f5);
          Shape2.render(f5);
          Shape3.render(f5);
          Shape4.render(f5);
          Shape5.render(f5);
          Shape6.render(f5);
          Shape7.render(f5);
        }
        
        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);
        }
      
      }
      

      Le render

      public class RenderSwordTest implements IItemRenderer
      {
      	ModelSwordTest GuiltyThornmodel;
        Minecraft mc = Minecraft.getMinecraft();
        
        public RenderSwordTest()
        {
          this.GuiltyThornmodel = new ModelSwordTest();
        }
        
        public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data)
        {
          switch (type)
          {
          case EQUIPPED: 
            GL11.glPushMatrix();
            this.mc.renderEngine.bindTexture(new ResourceLocation("xellion", "textures/model/SwordTest.png"));
            GL11.glScalef(1.0F, 1.0F, 1.0F);
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.35F, 0.05F, 0.37F);
            
            this.GuiltyThornmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
            
            GL11.glPopMatrix();
            break;
          case EQUIPPED_FIRST_PERSON: 
            GL11.glPushMatrix();
            this.mc.renderEngine.bindTexture(new ResourceLocation("xellion", "textures/model/SwordTest.png"));
            GL11.glScalef(1.0F, 1.0F, 1.0F);
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.35F, 0.01F, 0.37F);
            this.GuiltyThornmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
            
            GL11.glPopMatrix();
            break;
          case ENTITY: 
            GL11.glPushMatrix();
            
            GL11.glScalef(1.5F, 1.5F, 1.5F);
            this.mc.renderEngine.bindTexture(new ResourceLocation("xellion", "textures/model/SwordTest.png"));
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(45.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.35F, 0.05F, 0.37F);
            this.GuiltyThornmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
            GL11.glPopMatrix();
            break;
          }
        }
      
      public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type)
        {
          switch (type)
          {
          case INVENTORY: 
            return false;
          }
          return true;
        }
        
        public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper)
        {
          return false;
        }
      }
      

      Le CommonProxy

      public class CommonProxy
      {
        public void registerRenders()
        {
      	  
      	  MinecraftForgeClient.registerItemRenderer(XellionRPG.SwordTest, new RenderSwordTest());
      	  
        }
      }
      
      
      1 réponse Dernière réponse Répondre Citer 0
      • 1 / 1
      • Premier message
        Dernier message
      Design by Woryk
      Contact / Mentions Légales

      MINECRAFT FORGE FRANCE © 2018

      Powered by NodeBB