MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Problème Item dans la main d'une entité

    Planifier Épinglé Verrouillé Déplacé Résolu 1.12.x
    1.12.2
    24 Messages 3 Publieurs 1.4k Vues 3 Watching
    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.
    • StratisS Hors-ligne
      Stratis
      dernière édition par

      Personnellement je n’ai pas un excellant niveau pour coder en 1.12.2, mais si tu veux qu’on t’aide il faut savoir si il y a des erreur ou des warning qui s’affiche dans la console et peut tu nous donnée le code de l’item et de ton entité…

      Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

      J'adore pokémon, et vous ?

      BlueZikSB 1 réponse Dernière réponse Répondre Citer 1
      • BlueZikSB Hors-ligne
        BlueZikS @Stratis
        dernière édition par

        @Stratis a dit dans Problème Item dans la main d'une entité :

        Personnellement je n’ai pas un excellant niveau pour coder en 1.12.2, mais si tu veux qu’on t’aide il faut savoir si il y a des erreur ou des warning qui s’affiche dans la console et peut tu nous donnée le code de l’item et de ton entité…

        Salut! Merci de ta réponses et justement tu viens de me rappeler que j’ai oublié de le préciser : Aucune erreur n’est présente dans la console et je sais pas de quel code cela pourrait venir, le render, l’entité ou le modèle, c’est pour ça que je ne l’ai pas mis^^’

        BlueZikSB 1 réponse Dernière réponse Répondre Citer 0
        • BlueZikSB Hors-ligne
          BlueZikS @BlueZikS
          dernière édition par robin4002

          @BlueZikSè
          Classe de l’entité :

          public class EntityKobold extends EntityWitherSkeleton
          {
          
          	public EntityKobold(World worldIn) 
          	{
          		super(worldIn);
          		this.setSize(0.6F, 2.9F);
          		this.canDropLoot();
          	}
          	
          	@Override
          	protected void initEntityAI() 
          	{
                  this.tasks.addTask(0, new EntityAISwimming(this));
                  this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false));
                  this.tasks.addTask(7, new EntityAIWanderAvoidWater(this, 1.0D, 0.0F));
                  this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
                  this.tasks.addTask(8, new EntityAILookIdle(this));
                  this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0]));
          	}
          	
          	@Override
          	protected void applyEntityAttributes() 
          	{
          		super.applyEntityAttributes();
          		this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1000.0D);
          		this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
          	}
          	
          	@Override
          	public void setItemStackToSlot(EntityEquipmentSlot slotIn, ItemStack stack) 
          	{
          		super.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ItemInit.LIBERATOR));
          	}
          
          	public float getEyeHeight() 
          	{
          		return 2.1F;
          	}
          	
          	public EntityKobold createChild(EntityAgeable ageable)
          	{
          		return new EntityKobold(world);
          	}
          
          	@Override
          	protected SoundEvent getAmbientSound() 
          	{
          		return SoundsHandler.ENTITY_KOBOLD_AMBIENT;
          	}
          	
          	@Override
          	protected SoundEvent getHurtSound(DamageSource source) 
          	{
          		return SoundsHandler.ENTITY_KOBOLD_HURT;
          	}
          	
          	@Override
          	protected SoundEvent getDeathSound() 
          	{
          		return SoundsHandler.ENTITY_KOBOLD_DEATH;
          	}
          }
          
          classe du Render de l'entité :
          
          public class RenderKobold extends RenderLiving<EntityKobold>
          {
          	public static final ResourceLocation TEXTURES = new ResourceLocation(Reference.MODID + ":textures/entity/kobold.png");
          
          	public RenderKobold(RenderManager manager) 
          	{
          		super(manager, new ModelKobold(), 0.5F);
          	}
          	
          	@Override
          	protected ResourceLocation getEntityTexture(EntityKobold entity) 
          	{
          		return TEXTURES;
          	}
          	
          	@Override
          	protected void applyRotations(EntityKobold entityLiving, float p_77043_2_, float rotationYaw, float partialTicks) 
          	{
          		super.applyRotations(entityLiving, p_77043_2_, rotationYaw, partialTicks);
          	}
          }
          
          1 réponse Dernière réponse Répondre Citer 0
          • StratisS Hors-ligne
            Stratis
            dernière édition par

            tu a bien fait les test en client et pas sur un serveur ?

            Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

            J'adore pokémon, et vous ?

            BlueZikSB 1 réponse Dernière réponse Répondre Citer 1
            • BlueZikSB Hors-ligne
              BlueZikS @Stratis
              dernière édition par

              @Stratis Ouais, j’ai même essayé de mettre le @SideOnly mais ça n’as rien changé 😕

              1 réponse Dernière réponse Répondre Citer 0
              • StratisS Hors-ligne
                Stratis
                dernière édition par

                Je vois pas ce que ces, mais lors du test du mod, a tu modifier les parametre de graphique de minecraft dans les option

                Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                J'adore pokémon, et vous ?

                1 réponse Dernière réponse Répondre Citer 1
                • StratisS Hors-ligne
                  Stratis
                  dernière édition par

                  Peut tu me dire si quand tu te give l’épée, tu vois l’épée dans ta main,

                  Avec quel ide tu code… J 'ai déjà eu le même beug avec intellij idea,
                  cette erreur apparais quand l’ide ne reconnait pas le format de l’épée ou si celui-si a une erreur

                  Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                  J'adore pokémon, et vous ?

                  BlueZikSB 1 réponse Dernière réponse Répondre Citer 1
                  • BlueZikSB Hors-ligne
                    BlueZikS
                    dernière édition par

                    Nan je crois pas avoir modifié les paramètres graphique, après je me suis basé sur le witherskeleton qui à une stone sword dans la main, j’ai juste modifié car l’épée dans la main du witherskeleton est basée sur la difficulté du monde, j’ai essayé avec la difficulté même résultat, pourtant l’item est bel et bien présent mais invisible 😕 Merci quand même de ton aide!

                    1 réponse Dernière réponse Répondre Citer 0
                    • BlueZikSB Hors-ligne
                      BlueZikS @Stratis
                      dernière édition par

                      @Stratis Ouais l’épée fonctionne très bien dans ma main, ça fait sa avec tout les items que je veux lui donner même des items vanilla

                      1 réponse Dernière réponse Répondre Citer 0
                      • StratisS Hors-ligne
                        Stratis
                        dernière édition par

                        Je vois vraiment pas le problème, il y a une probabilité que cela vient de minecraft, je fait des recherche est je te répond…

                        Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                        J'adore pokémon, et vous ?

                        1 réponse Dernière réponse Répondre Citer 1
                        • StratisS Hors-ligne
                          Stratis
                          dernière édition par

                          Désoler, je n’ai rien trouver, si je trouve quel que chose je te le dirai. Désoler

                          Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                          J'adore pokémon, et vous ?

                          BlueZikSB 1 réponse Dernière réponse Répondre Citer 1
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            Bonsoir,
                            Jette un œil dans la classe RenderBiped.
                            Il y a un code spécifique pour faire le rendu des items en mains, que les zombies et joueurs ont comme ils héritent de RenderBiped.

                            BlueZikSB 1 réponse Dernière réponse Répondre Citer 0
                            • BlueZikSB Hors-ligne
                              BlueZikS @Stratis
                              dernière édition par

                              @Stratis C’est pas grave merci beaucoup d’avoir essayé de m’aider 🙂

                              1 réponse Dernière réponse Répondre Citer 0
                              • BlueZikSB Hors-ligne
                                BlueZikS @robin4002
                                dernière édition par

                                @robin4002 Salut! merci de ta réponse je suis allé voir et j’ai repris la ligne LayerHeldItem et dans mon Model j’ai remplacé extends ModelBase par ModelBiped et ça fonctionne merci beaucoup!!! Mais il me reste un problème :
                                L’Épée apparaît bel et bien mais elle apparaît au même endroit que sur le modèle d’un joueur normal, hors j’aimerais qu’elle apparaîsse sur le bras de mon entité 😕

                                b5fde6fb-2e37-400c-ae6d-e989a0511dc1-image.png

                                1 réponse Dernière réponse Répondre Citer 0
                                • robin4002R Hors-ligne
                                  robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                  dernière édition par

                                  Je ne suis pas sûr que se baser sur modèle Biped est correcte pour le cas de ton entité comme tu as un modèle qui diffère pas mal du ModelBiped (joueur / zombie).

                                  Il faut que tu reprennes le code de ton rendu et que tu adaptes la position, tu ne peux pas réutiliser la même fonction sans modification.

                                  BlueZikSB 2 réponses Dernière réponse Répondre Citer 1
                                  • BlueZikSB Hors-ligne
                                    BlueZikS @robin4002
                                    dernière édition par

                                    Ce message a été supprimé !
                                    1 réponse Dernière réponse Répondre Citer 0
                                    • StratisS Hors-ligne
                                      Stratis
                                      dernière édition par

                                      le plus simple est de crée une fonction de la fonction modifier pour l’adaptée au personnage

                                      Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                                      J'adore pokémon, et vous ?

                                      1 réponse Dernière réponse Répondre Citer 1
                                      • BlueZikSB Hors-ligne
                                        BlueZikS @robin4002
                                        dernière édition par

                                        @robin4002 @Stratis Merci de vos réponses , j’ai pensé a modifier la fonction de base je devrais recréer un ModelBiped en changeant les positions par les mienne cela pourrait fonctionner?

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • StratisS Hors-ligne
                                          Stratis
                                          dernière édition par

                                          oui je pense

                                          Stratis 2020 : Si on perd, c'est pas que le gagnant est trop fort, c'est que le perdant n'est pas assez bon !

                                          J'adore pokémon, et vous ?

                                          1 réponse Dernière réponse Répondre Citer 1
                                          • BlueZikSB Hors-ligne
                                            BlueZikS
                                            dernière édition par

                                            @robin4002 @Stratis
                                            J’ai repris ModelBiped et LayerHeldItem mais je sais pas quoi modifier je me perds un peu a vrai dire…

                                            ModelBiped :

                                            @SideOnly(Side.CLIENT)
                                            public class ModelBipedKobold extends ModelBase
                                            {
                                                public ModelRenderer bipedHead;
                                                public ModelRenderer bipedHeadwear;
                                                public ModelRenderer bipedBody;
                                                public ModelRenderer bipedRightArm;
                                                public ModelRenderer bipedLeftArm;
                                                public ModelRenderer bipedRightLeg;
                                                public ModelRenderer bipedLeftLeg;
                                                public ModelBipedKobold.ArmPose leftArmPose;
                                                public ModelBipedKobold.ArmPose rightArmPose;
                                                public boolean isSneak;
                                            
                                                public ModelBipedKobold()
                                                {
                                                    this(0.0F);
                                                }
                                            
                                                public ModelBipedKobold(float modelSize)
                                                {
                                                    this(modelSize, 0.0F, 64, 32);
                                                }
                                            
                                                public ModelBipedKobold(float modelSize, float p_i1149_2_, int textureWidthIn, int textureHeightIn)
                                                {
                                                    this.leftArmPose = ModelBipedKobold.ArmPose.EMPTY;
                                                    this.rightArmPose = ModelBipedKobold.ArmPose.EMPTY;
                                                    this.textureWidth = textureWidthIn;
                                                    this.textureHeight = textureHeightIn;
                                                    this.bipedHead = new ModelRenderer(this, 0, 0);
                                                    this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize);
                                                    this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
                                                    this.bipedHeadwear = new ModelRenderer(this, 32, 0);
                                                    this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize + 0.5F);
                                                    this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
                                                    this.bipedBody = new ModelRenderer(this, 16, 16);
                                                    this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, modelSize);
                                                    this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
                                                    this.bipedRightArm = new ModelRenderer(this, 40, 16);
                                                    this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
                                                    this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F);
                                                    this.bipedLeftArm = new ModelRenderer(this, 40, 16);
                                                    this.bipedLeftArm.mirror = true;
                                                    this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, modelSize);
                                                    this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F);
                                                    this.bipedRightLeg = new ModelRenderer(this, 0, 16);
                                                    this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
                                                    this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F);
                                                    this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
                                                    this.bipedLeftLeg.mirror = true;
                                                    this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize);
                                                    this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F);
                                                }
                                            
                                                public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
                                                {
                                                    this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);
                                                    GlStateManager.pushMatrix();
                                            
                                                    if (this.isChild)
                                                    {
                                                        float f = 2.0F;
                                                        GlStateManager.scale(0.75F, 0.75F, 0.75F);
                                                        GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
                                                        this.bipedHead.render(scale);
                                                        GlStateManager.popMatrix();
                                                        GlStateManager.pushMatrix();
                                                        GlStateManager.scale(0.5F, 0.5F, 0.5F);
                                                        GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
                                                        this.bipedBody.render(scale);
                                                        this.bipedRightArm.render(scale);
                                                        this.bipedLeftArm.render(scale);
                                                        this.bipedRightLeg.render(scale);
                                                        this.bipedLeftLeg.render(scale);
                                                        this.bipedHeadwear.render(scale);
                                                    }
                                                    else
                                                    {
                                                        if (entityIn.isSneaking())
                                                        {
                                                            GlStateManager.translate(0.0F, 0.2F, 0.0F);
                                                        }
                                            
                                                        this.bipedHead.render(scale);
                                                        this.bipedBody.render(scale);
                                                        this.bipedRightArm.render(scale);
                                                        this.bipedLeftArm.render(scale);
                                                        this.bipedRightLeg.render(scale);
                                                        this.bipedLeftLeg.render(scale);
                                                        this.bipedHeadwear.render(scale);
                                                    }
                                            
                                                    GlStateManager.popMatrix();
                                                }
                                            
                                                @SuppressWarnings("incomplete-switch")
                                                public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
                                                {
                                                    boolean flag = entityIn instanceof EntityLivingBase && ((EntityLivingBase)entityIn).getTicksElytraFlying() > 4;
                                                    this.bipedHead.rotateAngleY = netHeadYaw * 0.017453292F;
                                            
                                                    if (flag)
                                                    {
                                                        this.bipedHead.rotateAngleX = -((float)Math.PI / 4F);
                                                    }
                                                    else
                                                    {
                                                        this.bipedHead.rotateAngleX = headPitch * 0.017453292F;
                                                    }
                                            
                                                    this.bipedBody.rotateAngleY = 0.0F;
                                                    this.bipedRightArm.rotationPointZ = 0.0F;
                                                    this.bipedRightArm.rotationPointX = -5.0F;
                                                    this.bipedLeftArm.rotationPointZ = 0.0F;
                                                    this.bipedLeftArm.rotationPointX = 5.0F;
                                                    float f = 1.0F;
                                            
                                                    if (flag)
                                                    {
                                                        f = (float)(entityIn.motionX * entityIn.motionX + entityIn.motionY * entityIn.motionY + entityIn.motionZ * entityIn.motionZ);
                                                        f = f / 0.2F;
                                                        f = f * f * f;
                                                    }
                                            
                                                    if (f < 1.0F)
                                                    {
                                                        f = 1.0F;
                                                    }
                                            
                                                    this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 2.0F * limbSwingAmount * 0.5F / f;
                                                    this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F / f;
                                                    this.bipedRightArm.rotateAngleZ = 0.0F;
                                                    this.bipedLeftArm.rotateAngleZ = 0.0F;
                                                    this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount / f;
                                                    this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount / f;
                                                    this.bipedRightLeg.rotateAngleY = 0.0F;
                                                    this.bipedLeftLeg.rotateAngleY = 0.0F;
                                                    this.bipedRightLeg.rotateAngleZ = 0.0F;
                                                    this.bipedLeftLeg.rotateAngleZ = 0.0F;
                                            
                                                    if (this.isRiding)
                                                    {
                                                        this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F);
                                                        this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F);
                                                        this.bipedRightLeg.rotateAngleX = -1.4137167F;
                                                        this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F);
                                                        this.bipedRightLeg.rotateAngleZ = 0.07853982F;
                                                        this.bipedLeftLeg.rotateAngleX = -1.4137167F;
                                                        this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F);
                                                        this.bipedLeftLeg.rotateAngleZ = -0.07853982F;
                                                    }
                                            
                                                    this.bipedRightArm.rotateAngleY = 0.0F;
                                                    this.bipedRightArm.rotateAngleZ = 0.0F;
                                            
                                                    switch (this.leftArmPose)
                                                    {
                                                        case EMPTY:
                                                            this.bipedLeftArm.rotateAngleY = 0.0F;
                                                            break;
                                                        case BLOCK:
                                                            this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
                                                            this.bipedLeftArm.rotateAngleY = 0.5235988F;
                                                            break;
                                                        case ITEM:
                                                            this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F);
                                                            this.bipedLeftArm.rotateAngleY = 0.0F;
                                                    }
                                            
                                                    switch (this.rightArmPose)
                                                    {
                                                        case EMPTY:
                                                            this.bipedRightArm.rotateAngleY = 0.0F;
                                                            break;
                                                        case BLOCK:
                                                            this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
                                                            this.bipedRightArm.rotateAngleY = -0.5235988F;
                                                            break;
                                                        case ITEM:
                                                            this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F);
                                                            this.bipedRightArm.rotateAngleY = 0.0F;
                                                    }
                                            
                                                    if (this.swingProgress > 0.0F)
                                                    {
                                                        EnumHandSide enumhandside = this.getMainHand(entityIn);
                                                        ModelRenderer modelrenderer = this.getArmForSide(enumhandside);
                                                        float f1 = this.swingProgress;
                                                        this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt(f1) * ((float)Math.PI * 2F)) * 0.2F;
                                            
                                                        if (enumhandside == EnumHandSide.LEFT)
                                                        {
                                                            this.bipedBody.rotateAngleY *= -1.0F;
                                                        }
                                            
                                                        this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
                                                        this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
                                                        this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
                                                        this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
                                                        this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
                                                        this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
                                                        this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
                                                        f1 = 1.0F - this.swingProgress;
                                                        f1 = f1 * f1;
                                                        f1 = f1 * f1;
                                                        f1 = 1.0F - f1;
                                                        float f2 = MathHelper.sin(f1 * (float)Math.PI);
                                                        float f3 = MathHelper.sin(this.swingProgress * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
                                                        modelrenderer.rotateAngleX = (float)((double)modelrenderer.rotateAngleX - ((double)f2 * 1.2D + (double)f3));
                                                        modelrenderer.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
                                                        modelrenderer.rotateAngleZ += MathHelper.sin(this.swingProgress * (float)Math.PI) * -0.4F;
                                                    }
                                            
                                                    if (this.isSneak)
                                                    {
                                                        this.bipedBody.rotateAngleX = 0.5F;
                                                        this.bipedRightArm.rotateAngleX += 0.4F;
                                                        this.bipedLeftArm.rotateAngleX += 0.4F;
                                                        this.bipedRightLeg.rotationPointZ = 4.0F;
                                                        this.bipedLeftLeg.rotationPointZ = 4.0F;
                                                        this.bipedRightLeg.rotationPointY = 9.0F;
                                                        this.bipedLeftLeg.rotationPointY = 9.0F;
                                                        this.bipedHead.rotationPointY = 1.0F;
                                                    }
                                                    else
                                                    {
                                                        this.bipedBody.rotateAngleX = 0.0F;
                                                        this.bipedRightLeg.rotationPointZ = 0.1F;
                                                        this.bipedLeftLeg.rotationPointZ = 0.1F;
                                                        this.bipedRightLeg.rotationPointY = 12.0F;
                                                        this.bipedLeftLeg.rotationPointY = 12.0F;
                                                        this.bipedHead.rotationPointY = 0.0F;
                                                    }
                                            
                                                    this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
                                                    this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
                                                    this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
                                                    this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
                                            
                                                    if (this.rightArmPose == ModelBipedKobold.ArmPose.BOW_AND_ARROW)
                                                    {
                                                        this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY;
                                                        this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY + 0.4F;
                                                        this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
                                                        this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
                                                    }
                                                    else if (this.leftArmPose == ModelBipedKobold.ArmPose.BOW_AND_ARROW)
                                                    {
                                                        this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY - 0.4F;
                                                        this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY;
                                                        this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
                                                        this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
                                                    }
                                            
                                                    copyModelAngles(this.bipedHead, this.bipedHeadwear);
                                                }
                                            
                                                public void setModelAttributes(ModelBase model)
                                                {
                                                    super.setModelAttributes(model);
                                            
                                                    if (model instanceof ModelBipedKobold)
                                                    {
                                                        ModelBipedKobold modelbiped = (ModelBipedKobold)model;
                                                        this.leftArmPose = modelbiped.leftArmPose;
                                                        this.rightArmPose = modelbiped.rightArmPose;
                                                        this.isSneak = modelbiped.isSneak;
                                                    }
                                                }
                                            
                                                public void setVisible(boolean visible)
                                                {
                                                    this.bipedHead.showModel = visible;
                                                    this.bipedHeadwear.showModel = visible;
                                                    this.bipedBody.showModel = visible;
                                                    this.bipedRightArm.showModel = visible;
                                                    this.bipedLeftArm.showModel = visible;
                                                    this.bipedRightLeg.showModel = visible;
                                                    this.bipedLeftLeg.showModel = visible;
                                                }
                                            
                                                public void postRenderArm(float scale, EnumHandSide side)
                                                {
                                                    this.getArmForSide(side).postRender(scale);
                                                }
                                            
                                                protected ModelRenderer getArmForSide(EnumHandSide side)
                                                {
                                                    return side == EnumHandSide.LEFT ? this.bipedLeftArm : this.bipedRightArm;
                                                }
                                            
                                                protected EnumHandSide getMainHand(Entity entityIn)
                                                {
                                                    if (entityIn instanceof EntityLivingBase)
                                                    {
                                                        EntityLivingBase entitylivingbase = (EntityLivingBase)entityIn;
                                                        EnumHandSide enumhandside = entitylivingbase.getPrimaryHand();
                                                        return entitylivingbase.swingingHand == EnumHand.MAIN_HAND ? enumhandside : enumhandside.opposite();
                                                    }
                                                    else
                                                    {
                                                        return EnumHandSide.RIGHT;
                                                    }
                                                }
                                            
                                                @SideOnly(Side.CLIENT)
                                                public static enum ArmPose
                                                {
                                                    EMPTY,
                                                    ITEM,
                                                    BLOCK,
                                                    BOW_AND_ARROW;
                                                }
                                            }
                                            

                                            LayerHeldItem :

                                            @SideOnly(Side.CLIENT)
                                            public class LayerHeldItemKobold implements LayerRenderer<EntityLivingBase>
                                            {
                                                protected final RenderLivingBase<?> livingEntityRenderer;
                                            
                                                public LayerHeldItemKobold(RenderLivingBase<?> livingEntityRendererIn)
                                                {
                                                    this.livingEntityRenderer = livingEntityRendererIn;
                                                }
                                            
                                                public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
                                                {
                                                    boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT;
                                                    ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand();
                                                    ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand();
                                            
                                                    if (!itemstack.isEmpty() || !itemstack1.isEmpty())
                                                    {
                                                        GlStateManager.pushMatrix();
                                            
                                                        if (this.livingEntityRenderer.getMainModel().isChild)
                                                        {
                                                            float f = 0.5F;
                                                            GlStateManager.translate(0.0F, 0.75F, 0.0F);
                                                            GlStateManager.scale(0.5F, 0.5F, 0.5F);
                                                        }
                                            
                                                        this.renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT);
                                                        this.renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT);
                                                        GlStateManager.popMatrix();
                                                    }
                                                }
                                            
                                                private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide)
                                                {
                                                    if (!p_188358_2_.isEmpty())
                                                    {
                                                        GlStateManager.pushMatrix();
                                            
                                                        if (p_188358_1_.isSneaking())
                                                        {
                                                            GlStateManager.translate(0.0F, 0.2F, 0.0F);
                                                        }
                                                        this.translateToHand(handSide);
                                                        GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
                                                        GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
                                                        boolean flag = handSide == EnumHandSide.LEFT;
                                                        GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
                                                        Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag);
                                                        GlStateManager.popMatrix();
                                                    }
                                                }
                                            
                                                protected void translateToHand(EnumHandSide p_191361_1_)
                                                {
                                                    ((ModelBipedKobold)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, p_191361_1_);
                                                }
                                            
                                                public boolean shouldCombineTextures()
                                                {
                                                    return false;
                                                }
                                            }
                                            
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB