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

    Résolu RenderPlayer

    1.7.x
    1.7.10
    3
    8
    856
    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.
    • L
      laterreur216 dernière édition par

      Bonjour,

      J’ai suivi ce sujet mais je n’arrive pas a bind la textures dans la fonction render de mon entité

      https://www.minecraftforgefrance.fr/showthread.php?tid=3241&highlight=player

      public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
          {
      
              this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);
              if (this.isChild)
              {
                  float f6 = 2.0F;
                  GL11.glPushMatrix();
                  GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
                  GL11.glTranslatef(0.0F, 16.0F * p_78088_7_, 0.0F);
                  this.bipedHead.render(p_78088_7_);
                  GL11.glPopMatrix();
                  GL11.glPushMatrix();
                  GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
                  GL11.glTranslatef(0.0F, 24.0F * p_78088_7_, 0.0F);
                  this.bipedBody.render(p_78088_7_);
                  this.bipedRightArm.render(p_78088_7_);
                  this.bipedLeftArm.render(p_78088_7_);
                  this.bipedRightLeg.render(p_78088_7_);
                  this.bipedLeftLeg.render(p_78088_7_);
                  this.bipedHeadwear.render(p_78088_7_);
                  GL11.glPopMatrix();
              }
              else
              {
                  this.bipedHead.render(p_78088_7_);
                  this.bipedBody.render(p_78088_7_);
                  this.bipedRightArm.render(p_78088_7_);
                  this.bipedLeftArm.render(p_78088_7_);
                  this.bipedRightLeg.render(p_78088_7_);
                  this.bipedLeftLeg.render(p_78088_7_);
                  this.bipedHeadwear.render(p_78088_7_);
              }
          }
      

      Merci

      1 réponse Dernière réponse Répondre Citer 0
      • L
        laterreur216 dernière édition par

        Personne pour m’aidé ?

        1 réponse Dernière réponse Répondre Citer 0
        • AymericRed
          AymericRed dernière édition par

          Ce n’est pourtant pas bien dur, si tu as bien la fonction “getEntityTexture” d’implémentée, tu as juste à faire ```java
          this.bindEntityTexture(p_78088_1_);

          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

          1 réponse Dernière réponse Répondre Citer 0
          • L
            laterreur216 dernière édition par

            Ca ne fonctionne pas rien ne ce passe:

            Mon event:

            
            @SubscribeEvent
            @SideOnly(Side.CLIENT)
            public void skineffet(RenderPlayerEvent.Pre event)
              {
             ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, event.renderer, new SkinPlayer(), new String[] { "mainModel", "field_77045_g" });
              }
            
            

            La classe du Modele

            package joueur;
            
            import net.minecraft.client.model.ModelBiped;
            import net.minecraft.client.model.ModelRenderer;
            import net.minecraft.entity.Entity;
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.util.MathHelper;
            import net.minecraft.util.ResourceLocation;
            
            import org.lwjgl.opengl.GL11;
            
            public class SkinPlayer extends ModelBiped
            {
                public ModelRenderer bipedHead;
                public ModelRenderer bipedHeadwear;
                public ModelRenderer bipedBody;
                public ModelRenderer bipedRightArm;
                public ModelRenderer bipedLeftArm;
                public ModelRenderer bipedRightLeg;
                public ModelRenderer bipedLeftLeg;
                public ModelRenderer bipedEars;
                public ModelRenderer bipedCloak;
                /** Records whether the model should be rendered holding an item in the left hand, and if that item is a block. */
                public int heldItemLeft;
                /** Records whether the model should be rendered holding an item in the right hand, and if that item is a block. */
                public int heldItemRight;
                public boolean isSneak;
                /** Records whether the model should be rendered aiming a bow. */
                public boolean aimedBow;
                private static final String __OBFID = "CL_00000840";
            
                public final ResourceLocation texture = new ResourceLocation("TutoMod:textures/gui/entity/test.png");
            
                public SkinPlayer()
                {
                    this(0.0F);
                }
            
                public SkinPlayer(float p_i1148_1_)
                {
                    this(p_i1148_1_, 0.0F, 64, 32);
                }
            
                public SkinPlayer(float p_i1149_1_, float p_i1149_2_, int p_i1149_3_, int p_i1149_4_)
                {
                    this.textureWidth = p_i1149_3_;
                    this.textureHeight = p_i1149_4_;
                    this.bipedCloak = new ModelRenderer(this, 0, 0);
                    this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, p_i1149_1_);
                    this.bipedEars = new ModelRenderer(this, 24, 0);
                    this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, p_i1149_1_);
                    this.bipedHead = new ModelRenderer(this, 0, 0);
                    this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_);
                    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, p_i1149_1_ + 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, p_i1149_1_);
                    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, p_i1149_1_);
                    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, p_i1149_1_);
                    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, p_i1149_1_);
                    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, p_i1149_1_);
                    this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F);
                }
            
                //Test
                public ResourceLocation bindEntityTexture(Entity entity)
             {     
                return getMobTexture((EntityPlayer)entity);
             }
            
                public ResourceLocation getMobTexture(EntityPlayer entity)//EntityPlayer
                {
                return this.texture;
                }
                /**
                 * Sets the models various rotation angles then renders the model.
                 */
                public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
                {
                    this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);
                    this.bindEntityTexture( p_78088_1_);
                    if (this.isChild)
                    {
                        float f6 = 2.0F;
                        GL11.glPushMatrix();
                        GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
                        GL11.glTranslatef(0.0F, 16.0F * p_78088_7_, 0.0F);
                        this.bipedHead.render(p_78088_7_);
                        GL11.glPopMatrix();
                        GL11.glPushMatrix();
                        GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
                        GL11.glTranslatef(0.0F, 24.0F * p_78088_7_, 0.0F);
                        this.bipedBody.render(p_78088_7_);
                        this.bipedRightArm.render(p_78088_7_);
                        this.bipedLeftArm.render(p_78088_7_);
                        this.bipedRightLeg.render(p_78088_7_);
                        this.bipedLeftLeg.render(p_78088_7_);
                        this.bipedHeadwear.render(p_78088_7_);
                        GL11.glPopMatrix();
                    }
                    else
                    {
                        this.bipedHead.render(p_78088_7_);
                        this.bipedBody.render(p_78088_7_);
                        this.bipedRightArm.render(p_78088_7_);
                        this.bipedLeftArm.render(p_78088_7_);
                        this.bipedRightLeg.render(p_78088_7_);
                        this.bipedLeftLeg.render(p_78088_7_);
                        this.bipedHeadwear.render(p_78088_7_);
                    }
                }
            
                /**
                 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
                 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
                 * "far" arms and legs can swing at most.
                 */
                public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_)
                {
                    this.bipedHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
                    this.bipedHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
                    this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
                    this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX;
                    this.bipedRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 2.0F * p_78087_2_ * 0.5F;
                    this.bipedLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F;
                    this.bipedRightArm.rotateAngleZ = 0.0F;
                    this.bipedLeftArm.rotateAngleZ = 0.0F;
                    this.bipedRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_;
                    this.bipedLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_;
                    this.bipedRightLeg.rotateAngleY = 0.0F;
                    this.bipedLeftLeg.rotateAngleY = 0.0F;
            
                    if (this.isRiding)
                    {
                        this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F);
                        this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F);
                        this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
                        this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
                        this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F);
                        this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F);
                    }
            
                    if (this.heldItemLeft != 0)
                    {
                        this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft;
                    }
            
                    if (this.heldItemRight != 0)
                    {
                        this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;
                    }
            
                    this.bipedRightArm.rotateAngleY = 0.0F;
                    this.bipedLeftArm.rotateAngleY = 0.0F;
                    float f6;
                    float f7;
            
                    if (this.onGround > -9990.0F)
                    {
                        f6 = this.onGround;
                        this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F;
                        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;
                        f6 = 1.0F - this.onGround;
                        f6 *= f6;
                        f6 *= f6;
                        f6 = 1.0F - f6;
                        f7 = MathHelper.sin(f6 * (float)Math.PI);
                        float f8 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
                        this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)f7 * 1.2D + (double)f8));
                        this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
                        this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * (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;
                        this.bipedHeadwear.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.bipedHeadwear.rotationPointY = 0.0F;
                    }
            
                    this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
                    this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
                    this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
                    this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
            
                    if (this.aimedBow)
                    {
                        f6 = 0.0F;
                        f7 = 0.0F;
                        this.bipedRightArm.rotateAngleZ = 0.0F;
                        this.bipedLeftArm.rotateAngleZ = 0.0F;
                        this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + this.bipedHead.rotateAngleY;
                        this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F + 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;
                        this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
                        this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
                        this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
                        this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
                        this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
                        this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
                    }
                }
            
                /**
                 * renders the ears (specifically, deadmau5's)
                 */
                public void renderEars(float p_78110_1_)
                {
                    this.bipedEars.rotateAngleY = this.bipedHead.rotateAngleY;
                    this.bipedEars.rotateAngleX = this.bipedHead.rotateAngleX;
                    this.bipedEars.rotationPointX = 0.0F;
                    this.bipedEars.rotationPointY = 0.0F;
                    this.bipedEars.render(p_78110_1_);
                }
            
                /**
                 * Renders the cloak of the current biped (in most cases, it's a player)
                 */
                public void renderCloak(float p_78111_1_)
                {
                    this.bipedCloak.render(p_78111_1_);
                }
            }
            

            Pourtant j’ai bien créer bindEntityTexture

            1 réponse Dernière réponse Répondre Citer 0
            • Deleted
              Deleted dernière édition par

              Je t’aurai plutôt recommandé d’ajouter cette ligne avant celle concernant le nouveau modèle à appliquer :
              ObfuscationReflectionHelper.setPrivateValue(AbstractClientPlayer.class, ((AbstractClientPlayer) event.entityPlayer), taResourceLocation, 1);//C’est-à-dire ta nouvelle texture

              1 réponse Dernière réponse Répondre Citer 0
              • L
                laterreur216 dernière édition par

                D’accord merci pour ta réponse.

                
                @SubscribeEvent
                 @SideOnly(Side.CLIENT)
                 public void skineffet(RenderPlayerEvent.Pre event)
                  {
                 EntityPlayer player = event.entityPlayer;
                [font=monospace ExtendedEntityPropTuto inv = ExtendedEntityPropTuto].get(player);
                 if(inv.inventory.getStackInSlot(9) != null)
                 {
                 if(inv.inventory.getStackInSlot(9).getItem() == Mod.masqueenrage)//quand il équipe le masque
                 {
                  ObfuscationReflectionHelper.setPrivateValue(AbstractClientPlayer.class, ((AbstractClientPlayer) event.entityPlayer), this.textureenrage, 1);//C'est-à-dire ta nouvelle texture
                 }
                 }
                
                

                Donc le skin du joueur change bien lorsque il équipe mon masque mais les autre joueurs ne le voie pas en mode enragé …

                Je pense que le problème viens que je tcheck l’inventaire du joueur en question mais je ne voie pas comment faire …

                1 réponse Dernière réponse Répondre Citer 0
                • Deleted
                  Deleted dernière édition par

                  Sûrement car ton ExtProp synchronise un seul client et non les uns avec les autres. Tu pourrais donc soit te servir des DW (utilisation très simple, fonctionne parfaitement pour ce que tu souhaites faire, mais système d’id possédant une limite plutôt contraignante), ou recréer un packet, qui synchroniserait le client dont l’id correspondant aurait été encodée dans le buffer, que tu enverrais ensuite à tous les joueurs présents sur le serveur.

                  1 réponse Dernière réponse Répondre Citer 0
                  • L
                    laterreur216 dernière édition par

                    Merci problème résolu avec un Data Watcher dans mon EPP.

                    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