MFF

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

    Plusieurs problèmes de mise à jour [v2]

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.9.4
    22 Messages 4 Publieurs 3.3k Vues 1 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.
    • Benjamin LoisonB Hors-ligne
      Benjamin Loison
      dernière édition par

      Je ne suis pas super intéressé dans les biomes et les entities comme ça ^^Mais si j’étais toi j’essayerai de chercher des codes sources de mod Minecraft sur GitHub qui contienne des choses intéressantes pour toi dans ta version sur les biomes et les entities, bonne chance !

      >! Développeur de Altis-Life (Arma III) sur Minecraft !
      >! Site web     : https://lemnoslife.com

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

        Salut
        Je n’ai rien trouvé, mais après tout, je me suis dit que même si j’avais trouvé du code d’un autre mod, c’est du vol.

        Bref, j’ai chercher dans Forge et tout et j’ai peut-être trouvé des solutions.
        Pour activer la neige dans les biomes, je pensais utiliser ```java
        public void test1(BiomeEvent event)
        {
        Biome biome = event.getBiome();
        if(biome == Biomes.PLAINS)
        {

        }
        }

        
        Pour le renne, j'ai repris le code de la 1.8 et juste remplacé les trucs qui sont obolètes mais ça marche pas :```java
        public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
        {
        System.out.println("moveEntityWithHeading");
        EntityLivingBase livingBase = (EntityLivingBase)player;
           if (this.isBeingRidden() && this.isRidingOrBeingRiddenBy(livingBase))
           {
            System.out.println("ride by entitylivingbase");
               this.prevRotationYaw = this.rotationYaw = livingBase.rotationYaw;
               this.rotationPitch = livingBase.rotationPitch * 0.5F;
               this.setRotation(this.rotationYaw, this.rotationPitch);
               this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
               p_70612_1_ = ((EntityLivingBase)livingBase).moveStrafing * 0.5F;
               p_70612_2_ = ((EntityLivingBase)livingBase).moveForward;
        
               if (p_70612_2_ <= 0.0F)
               {
                   p_70612_2_ *= 0.25F;
               }
        
               this.stepHeight = 1.0F;
               this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
        
               if (!this.worldObj.isRemote)
               {
                   this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
                   super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
               }
        
               this.prevLimbSwingAmount = this.limbSwingAmount;
               double d1 = this.posX - this.prevPosX;
               double d0 = this.posZ - this.prevPosZ;
               float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
        
               if (f4 > 1.0F)
               {
                   f4 = 1.0F;
               }
        
               this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
               this.limbSwing += this.limbSwingAmount;
           }
           else
           {
               this.stepHeight = 0.5F;
               this.jumpMovementFactor = 0.02F;
               super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
           }
        }
        ``` c'est la 1ère condition qui bug. Le message ne s'affiche pas et je ne peux pas le contrôler. Je peux seulement le monter
        1 réponse Dernière réponse Répondre Citer 0
        • AxaurusA Hors-ligne
          Axaurus
          dernière édition par

          Salut
          J’ai réussi à pouvoir contrôler le renne. J’ai ajouté ces deux fonctions :

          @Nullable
          public Entity getControllingPassenger()
          {
          return this.getPassengers().isEmpty() ? null : (Entity)this.getPassengers().get(0);
          }
          
          public boolean canBeSteered()
          {
          Entity entity = this.getControllingPassenger();
          return entity instanceof EntityLivingBase;
          }
          ``` et maintenant ça marche.
          
          Il me reste plus que le problème de biome. Je voudrais activer la neige dans presque tout les biomes mais comme le .setSnowEnable est désormais dans la sous-classe BiomeProperties, je ne sais plus comment faire. Une petite idée ? J'avais pensé à utiliser
          ```java
          public void test1(BiomeEvent event)
          {
          Biome biome = event.getBiome();
          if(biome == Biomes.PLAINS)
          {
          
          }
          }
          ```(dans ma classe d'évent) mais je ne sais pas quoi mettre à l'intérieur.
          
          Merci d'avance
          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

            La seule solution que je vois est de modifier la valeur de enableSnow via réflexion.

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

              Salut
              J’ai essayé de modifier la valeur de base de enableSnow dans la classe BiomeProperties en utilisant java ObfuscationReflectionHelper.setPrivateValue(BiomeProperties.class, biomeInstance, true, "enableSnow");  biomeInstance est déclaré plus haut par ```java
              public static BiomeProperties biomeInstance;

              [14:25:59] [Client thread/ERROR] [FML]: Unable to set any field [enableSnow] on type net.minecraft.world.biome.Biome$BiomeProperties
              net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at net.minecraftforge.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:92) [ObfuscationReflectionHelper.class:?]
              at This_is_Christmas.ThisisChristmas.load(ThisisChristmas.java:135) [ThisisChristmas.class:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568) [FMLModContainer.class:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
              at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228) [LoadController.class:?]
              at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206) [LoadController.class:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
              at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
              at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:767) [Loader.class:?]
              at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316) [FMLClientHandler.class:?]
              at net.minecraft.client.Minecraft.startGame(Minecraft.java:559) [Minecraft.class:?]
              at net.minecraft.client.Minecraft.run(Minecraft.java:384) [Minecraft.class:?]
              at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
              at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
              at GradleStart.main(GradleStart.java:26) [start/:?]
              Caused by: java.lang.NullPointerException
              at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.UnsafeBooleanFieldAccessorImpl.set(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Field.set(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:139) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              … 45 more
              [14:25:59] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
              [14:25:59] [Client thread/ERROR] [FML]:
              States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
              UCHI mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)
              UCHI FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9.4-12.17.0.1976.jar)
              UCHI Forge{12.17.0.1976} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1976.jar)
              UCHE This_is_Christmas{1.2} [This is Christmas] (bin)
              [14:25:59] [Client thread/ERROR] [FML]: The following problems were captured during this phase
              [14:25:59] [Client thread/ERROR] [FML]: Caught exception from This_is_Christmas
              net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at net.minecraftforge.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:92) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at This_is_Christmas.ThisisChristmas.load(ThisisChristmas.java:135) ~[bin/:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
              at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
              at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
              at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
              at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:767) [Loader.class:?]
              at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316) [FMLClientHandler.class:?]
              at net.minecraft.client.Minecraft.startGame(Minecraft.java:559) [Minecraft.class:?]
              at net.minecraft.client.Minecraft.run(Minecraft.java:384) [Minecraft.class:?]
              at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
              at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
              at GradleStart.main(GradleStart.java:26) [start/:?]
              Caused by: java.lang.NullPointerException
              at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.8.0_92]
              at sun.reflect.UnsafeBooleanFieldAccessorImpl.set(Unknown Source) ~[?:1.8.0_92]
              at java.lang.reflect.Field.set(Unknown Source) ~[?:1.8.0_92]
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:139) ~[forgeSrc-1.9.4-12.17.0.1976.jar:?]
              … 45 more
              [14:25:59] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: –-- Minecraft Crash Report ----
              // Would you like a cupcake?

              Time: 28/10/16 14:25
              Description: Initializing game

              net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143)
              at net.minecraftforge.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:92)
              at This_is_Christmas.ThisisChristmas.load(ThisisChristmas.java:135)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
              at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
              at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:767)
              at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316)
              at net.minecraft.client.Minecraft.startGame(Minecraft.java:559)
              at net.minecraft.client.Minecraft.run(Minecraft.java:384)
              at net.minecraft.client.main.Main.main(Main.java:118)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
              at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
              at GradleStart.main(GradleStart.java:26)
              Caused by: java.lang.NullPointerException
              at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
              at sun.reflect.UnsafeBooleanFieldAccessorImpl.set(Unknown Source)
              at java.lang.reflect.Field.set(Unknown Source)
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:139)
              … 45 more

              A detailed walkthrough of the error, its code path and all known details is as follows:

              – Head –
              Thread: Client thread
              Stacktrace:
              at net.minecraftforge.fml.relauncher.ReflectionHelper.setPrivateValue(ReflectionHelper.java:143)
              at net.minecraftforge.fml.common.ObfuscationReflectionHelper.setPrivateValue(ObfuscationReflectionHelper.java:92)
              at This_is_Christmas.ThisisChristmas.load(ThisisChristmas.java:135)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
              at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
              at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
              at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
              at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
              at com.google.common.eventbus.EventBus.post(EventBus.java:275)
              at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
              at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:767)
              at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:316)
              at net.minecraft.client.Minecraft.startGame(Minecraft.java:559)

              – Initialization –
              Details:
              Stacktrace:
              at net.minecraft.client.Minecraft.run(Minecraft.java:384)
              at net.minecraft.client.main.Main.main(Main.java:118)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
              at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
              at GradleStart.main(GradleStart.java:26)

              – System Details –
              Details:
              Minecraft Version: 1.9.4
              Operating System: Windows 10 (amd64) version 10.0
              Java Version: 1.8.0_92, Oracle Corporation
              Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
              Memory: 607713008 bytes (579 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
              JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
              IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
              FML: MCP 9.28 Powered by Forge 12.17.0.1976 4 mods loaded, 4 mods active
              States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
              UCHI mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)
              UCHI FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9.4-12.17.0.1976.jar)
              UCHI Forge{12.17.0.1976} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1976.jar)
              UCHE This_is_Christmas{1.2} [This is Christmas] (bin)
              Loaded coremods (and transformers):
              GL info: ’ Vendor: ‘ATI Technologies Inc.’ Version: ‘4.5.14009 Compatibility Profile Context 21.19.151.3’ Renderer: ‘AMD Radeon R9 200 Series’
              Launched Version: 1.9.4
              LWJGL: 2.9.4
              OpenGL: AMD Radeon R9 200 Series GL version 4.5.14009 Compatibility Profile Context 21.19.151.3, ATI Technologies Inc.
              GL Caps: Using GL 1.3 multitexturing.
              Using GL 1.3 texture combiners.
              Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
              Shaders are available because OpenGL 2.1 is supported.
              VBOs are available because OpenGL 1.5 is supported.

              Using VBOs: No
              Is Modded: Definitely; Client brand changed to ‘fml,forge’
              Type: Client (map_client.txt)
              Resource Packs:
              Current Language: English (US)
              Profiler Position: N/A (disabled)
              CPU: net.minecraft.client.Minecraft$15@5bf8d583
              [14:25:59] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: #@!@# Game crashed! Crash report saved to: #@!@# G:\Codage\Minecraft\This_is_Christmas\v1.3\MC1.9.4\run.\crash-reports\crash-2016-10-28_14.25.59-client.txt
              AL lib: (EE) alc_cleanup: 1 device not closed
              Java HotSpot™ 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

              Et pis j'ai eu peur d'un autre truc. J'ai testé dans un autre src en 1.8 où on peut modifier dirctement, et ma crainte s'est confirmé : il faut aussi modifier la température pour qu'il puisse neiger. Sauf que là, c'est tendu : chaque biome utilise une température différente défini dans son initialisation.
              Si on peut aussi modifier ça avec la reflection, ça serait bien mais je ne pense pas qu'on puisse.
              
              Sinon, j'avais pensé à un autre truc : j'avais pensé à supprimer les biomes existants et les recréer. Est-ce une bonne idée ? Y'aura t-il des problèmes de performance ? Des problèmes avec ce qui utilise ces biomes ? Des bugs ? J'attends vos réponses.
              
              Merci d'avance
              1 réponse Dernière réponse Répondre Citer 0
              • BrokenSwingB Hors-ligne
                BrokenSwing Moddeurs confirmés Rédacteurs
                dernière édition par

                Il faut que ton instance de BiomeProperties ne soit pas null, la réflection marche avec à peu près tout

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

                  Je dois mal m’y prendre, ça ne marche pas.

                  Pour instancier BiomeProperties, il fallait un String. Du coup, j’ai fait ça : java BiomeProperties plains = new BiomeProperties("Plains"); et je pensais faire ça pour chaque biome si ça marche. J’ai essayé de modifier la température et de l’afficher, mais ça ne marche pas, elle reste comme elle a été mise par défaut. J’ai fait ```java
                  ObfuscationReflectionHelper.setPrivateValue(BiomeProperties.class, plains, 5.0F, “temperature”);

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

                    Ça ne le modifie que pour cette instance, je ne sais pas si c’est celle-là qui est utilisée dans ton monde,j’ai pas regardé tout le poste

                    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

                      C’est la valeur enableSnow de Biome qu’il faut modifier et non de BiomeProperties.

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

                        Biome est une classe abstraite et on ne peux pas en instancier. Comme alternative, j’ai testé de faire :
                        [java] @EventHandler
                        public void load(FMLInitializationEvent event)
                        {
                        […] testb a = new testb();
                        Biome b = a.biome;
                        ObfuscationReflectionHelper.setPrivateValue(Biome.class, b, true, “enableSnow”);
                        }

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

                          Biome est une classe abstraite et on ne peut pas instancier de classe abstraite. J’ai essayer des alternatives :

                          testb a = new testb();
                          Biome b = a.biome;
                                  ObfuscationReflectionHelper.setPrivateValue(Biome.class, b, true, "enableSnow");
                          }
                          public class testb
                          {
                          Biome biome;
                          public Biome test1()
                          {
                          return biome;
                          }
                          }
                          
                          

                          mais ça crash au lancement, NPE.

                          J’ai ensuite testé ```java
                          BiomeProperties bp = new BiomeProperties(“”);
                          Biome biome1 = new test(bp);
                          ObfuscationReflectionHelper.setPrivateValue(Biome.class, biome1, true, “enableSnow”);

                          ```java
                          package This_is_Christmas;
                          
                          import net.minecraft.world.biome.Biome;
                          
                          public class test extends Biome{
                          
                          public test(BiomeProperties properties)
                          {
                          super(properties);
                          }
                          
                          }
                          
                          

                          Là Minecraft se lance bien mais la neige n’est pas activée. Je le sais, pas parce qu’il pleut mais parce que dans ma classe d’évent j’ai mis

                          System.out.println("snow enable ? " + Biomes.PLAINS.getEnableSnow());
                          ``` et ça me met false, alors que j'ai testé sur un src en 1.8 d'activer la neige, et ça me met true, même s'il pleut.
                          
                          Si vous avez une idée, …
                          Et pis même si on arrive à activée la neige, il ne neigera pas tant qu'on ne modifie pas la température. Et pour modifier la température, il faut modifier l'initialisation de chaque biome. Et là, ça devient tendu :/
                          
                          C'est pas une critique mais je trouve que c'est bizarre que Forge n'est pas prévu ça.
                          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

                            Tu ne dois pas créer une nouvelle instance mais modifier les instance existante.
                            Sinon ça ne risque pas de fonctionner.

                            ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, true, “enableSnow”);

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

                              Salut
                              J’avais cru qu’il fallait prendre l’instance de Biome et modifier la valeur par défaut de enableSnow. C’est pour ça que je ne savais pas comment faire pour la tempérautre. Mais en fait, il faut prendre l’instance de chaque biome et les modifier. Merci 😉

                              Du coup, j’ai fait comme ça :

                              ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, true, "enableSnow");
                              ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, 0.0F, "temperature");
                              

                              Je pense que tu seras d’accord avec moi sur le fait qu’avant c’était plus simple de modifier un biome.

                              Du coup, mes deux problèmes sont résolus. Merci à tous

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

                                Bah là, deux lignes, c’est pas très compliqué

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

                                  Oui, c’est vrai, une fois qu’on a compris comment faire. Mais avant y’avais juste à faire ```java
                                  BiomeGenBase.forest.temperature = 0.0F;
                                  BiomeGenBase.forest.setEnableSnow();

                                  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

                                    Par contre ce que tu as fait là ne fonctionnera que sur eclipse.
                                    Sur le jeu lancé depuis le launcher les variables sont obfusqué et ont comme nom field_xxx
                                    Du-coup :

                                    ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, true, "enableSnow", "field_76766_R");
                                    ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, 0.0F, "temperature", "field_76750_F");
                                    
                                    1 réponse Dernière réponse Répondre Citer 0
                                    • BrokenSwingB Hors-ligne
                                      BrokenSwing Moddeurs confirmés Rédacteurs
                                      dernière édition par

                                      A ce propos, j’ai ça :

                                      
                                      GuiScreen parent = (GuiScreen)ObfuscationReflectionHelper.getPrivateValue(GuiModList.class, gui, "mainMenu");
                                      
                                      

                                      GuiModList.class étant une classe de fml, ses variables seront-elles obusquées aussi, et si oui, comment avoir le nom obfusqué ?

                                      EDIT : Ou alors j’utilise la méthode avec le fieldIndex

                                      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

                                        Non les variables de fml/forge ne sont pas obfusqué.

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

                                          @‘robin4002’:

                                          Par contre ce que tu as fait là ne fonctionnera que sur eclipse.
                                          Sur le jeu lancé depuis le launcher les variables sont obfusqué et ont comme nom field_xxx
                                          Du-coup :

                                          ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, true, "enableSnow", "field_76766_R");
                                          ObfuscationReflectionHelper.setPrivateValue(Biome.class, Biomes.PLAINS, 0.0F, "temperature", "field_76750_F");
                                          

                                          Ok merci, mais comment as-tu fait pour trouver les noms obfusqués ? Y’a t-il un fichier où sont inscrit les correspondances des noms obfusqués-déobfusqués ?

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

                                            Soit tu utilise le logiciel de SCAREX : https://www.minecraftforgefrance.fr/showthread.php?tid=2774
                                            Soit tu va ici : .gradle\caches\minecraft\de\oceanlabs\mcp\mcp_snapshot\

                                            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