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

    Résolu Plusieurs problèmes de mise à jour [v2]

    1.9.x et 1.10.x
    1.9.4
    4
    22
    2911
    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.
    • Axaurus
      Axaurus dernière édition par

      Salut
      J’ai commencé à mettre mon mod de Noël à jour et j’ai deux problèmes :

      1. quand j’active la neige dans les biomes déjà existants. Avant, j’utilisais java BiomeGenBase.forest.temperature = 0.0F; BiomeGenBase.forest.setEnableSnow(); mais depuis la 1.9 le setEnableSnow (qui est devenu setSnowEnable) est dans la sous-classe BiomeProperties. Je n’y arrive donc pas. J’avais pensé à utiliser le code d’enregistrement de biome : ```java
               new BiomeForest(BiomeForest.Type.NORMAL, (new Biome.BiomeProperties(“Forest”)).setTemperature(0.0F).setRainfall(0.8F).setSnowEnabled());
      
      2) j'avais créé un renne qu'on puisse contrôler. Mais quand je suis passé en 1.9, je ne pouvais plus le contrôler, je pouvais seulement monter dessus. J'ai essayer de modifier en m'appuyant sur le code du cheval et du cochon, mais maintenant il suit ma direction. Voilà les codes : le renne d'avant :```java
      package This_is_Christmas.Entity;
      
      import java.util.List;
      
      import net.minecraft.block.Block;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.entity.EntityPlayerSP;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityAgeable;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.SharedMonsterAttributes;
      import net.minecraft.entity.ai.EntityAIControlledByPlayer;
      import net.minecraft.entity.ai.EntityAILookIdle;
      import net.minecraft.entity.ai.EntityAISwimming;
      import net.minecraft.entity.ai.EntityAITempt;
      import net.minecraft.entity.ai.EntityAIWander;
      import net.minecraft.entity.ai.EntityAIWatchClosest;
      import net.minecraft.entity.item.EntityBoat;
      import net.minecraft.entity.monster.EntityMob;
      import net.minecraft.entity.passive.EntityAmbientCreature;
      import net.minecraft.entity.passive.EntityAnimal;
      import net.minecraft.entity.passive.EntityHorse;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.entity.player.EntityPlayerMP;
      import net.minecraft.init.Blocks;
      import net.minecraft.init.Items;
      import net.minecraft.item.ItemStack;
      //TODO import net.minecraft.util.AxisAlignedBB;
      //TODO import net.minecraft.util.MathHelper;
      import net.minecraft.util.MovementInput;
      //TODO import net.minecraft.util.MovingObjectPosition;
      //TODO import net.minecraft.util.Vec3;
      import net.minecraft.world.World;
      //TODO import net.minecraftforge.event.entity.player.EntityInteractEvent;
      
      public class EntityReindeer extends EntityAnimal{
      
      //TODO private final EntityAIControlledByPlayer aiControlledByPlayer;
      boolean stationary;
      private EntityPlayer player;
      
      public EntityReindeer(World par1World) {
      super(par1World);
      this.tasks.addTask(0, new EntityAISwimming(this));
      // this.tasks.addTask(4, new EntityAIWatchClosest(this, null, 8.0F));
      this.tasks.addTask(5, new EntityAILookIdle(this));
      //TODO this.tasks.addTask(2, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.3F));
      this.setSize(0.9F, 1.3F);
      }
      
      public boolean isAIEnabled(){
      return true;
      }
      
      protected void applyEntityAttributes()
      {
      super.applyEntityAttributes();
      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D);
      this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(28D);
      }
      
      public int getSantaClausType()
      {
      return this.dataWatcher.getWatchableObjectByte(13);
      }
      
      /**
      * Plays step sound at given x, y, z for the entity
      */
      protected void playStepSound(int par1, int par2, int par3, int par4)
      {
      this.playSound("mob.zombie.step", 0.15F, 1.0F);
      }
      
      protected String getLivingSound()
      {
      return "christmas:mob.reindeer.say";
      }
      
      /**
      * Returns the sound this mob makes when it is hurt.
      */
      protected String getHurtSound()
      {
      return "christmas:mob.reindeer.hit";
      }
      
      /**
      * Returns the sound this mob makes on death.
      */
      protected String getDeathSound()
      {
      return "christmas:mob.reindeer.death";
      }
      
      public boolean interact(EntityPlayer player)
      {
      if (!this.worldObj.isRemote && (this.riddenByEntity == null || this.riddenByEntity == player))
      {
      player.mountEntity(this);
      return true;
      }
      else
      {
      return false;
      }
      }
      
      @Override
      public EntityAgeable createChild(EntityAgeable p_90011_1_) {
      // TODO Auto-generated method stub
      return null;
      }
      
      /*protected boolean isMovementCeased()
      {
      return stationary;
      }
      public void moveEntity(double d, double d1, double d2)
      {
      if (riddenByEntity != null)
      {
      Minecraft mc = FMLClientHandler.instance().getClient();
      
      mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "christmas:ambient.weather.snow", 1.1F, 15.0F, false);
      this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
      this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
      this.setRotation(this.rotationYaw, this.rotationPitch);
      this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
      stationary = true;
      motionX += riddenByEntity.motionX * 10; // * 0.20000000000000001D;
      motionZ += riddenByEntity.motionZ * 10; // * 0.20000000000000001D;
      if (isCollidedHorizontally)
      {
      isJumping = true;
      }
      else
      {
      isJumping = false;
      }
      super.moveEntity(motionX, motionY, motionZ);
      NetworkMessage networkmessage = new NetworkMessage();
      // This_is_Christmas.This_is_Christmas.network.sendToServer(new NetworkMessage(networkmessage.ReindeerRiding));
      // mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "christmas:ambient.weather.snow", 1.1F, 15.0F, false);
      
      }
      else
      {
      stationary = false;
      super.moveEntity(d, d1, d2);
      }
      }*/
      
      public void onUpdate()
      {
      super.onUpdate();
      }
      
      public EntityAIControlledByPlayer getAIControlledByPlayer()
      {
      return this.aiControlledByPlayer;
      }
      
      public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
      {
         if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase)
         {
             this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
             this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
             this.setRotation(this.rotationYaw, this.rotationPitch);
             this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
             p_70612_1_ = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F;
             p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).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.movementSpeed).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_);
         }
      }
      }
      

      J’ai mis en TODO les lignes qui ont un rapport avec le contrôle mais qui ne marche plus en 1.9.

      Le renne de maintenant : ```java
      package This_is_Christmas.Entity;

      import net.minecraft.block.Block;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EntityAgeable;
      import net.minecraft.entity.EntityLiving;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.SharedMonsterAttributes;
      import net.minecraft.entity.ai.EntityAIFollowParent;
      import net.minecraft.entity.ai.EntityAILookIdle;
      import net.minecraft.entity.ai.EntityAIMate;
      import net.minecraft.entity.ai.EntityAIPanic;
      import net.minecraft.entity.ai.EntityAISwimming;
      import net.minecraft.entity.ai.EntityAIWander;
      import net.minecraft.entity.ai.EntityAIWatchClosest;
      import net.minecraft.entity.passive.EntityAnimal;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Items;
      import net.minecraft.init.MobEffects;
      import net.minecraft.init.SoundEvents;
      import net.minecraft.item.ItemStack;
      import net.minecraft.util.EnumHand;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.util.math.MathHelper;
      import net.minecraft.world.World;

      public class EntityReindeer extends EntityAnimal
      {
      private boolean field_184765_bx;
      private int field_184766_bz;
      private int field_184767_bA;

      public EntityReindeer(World worldIn)
      {
      super(worldIn);
      this.setSize(1.3964844F, 1.6F);
      this.isImmuneToFire = false;
      }

      protected void initEntityAI()
      {
      this.tasks.addTask(0, new EntityAISwimming(this));
      this.tasks.addTask(1, new EntityAIPanic(this, 1.2D));
      this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
      this.tasks.addTask(4, new EntityAIFollowParent(this, 1.0D));
      this.tasks.addTask(6, new EntityAIWander(this, 0.7D));
      this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
      this.tasks.addTask(8, new EntityAILookIdle(this));
      }

      protected void entityInit()
      {
      super.entityInit();
      }

      public boolean canBeLeashedTo(EntityPlayer player)
      {
      return super.canBeLeashedTo(player);
      }

      public boolean canBePushed()
      {
      return !this.isBeingRidden();
      }

      protected void playStepSound(BlockPos pos, Block blockIn)
      {
      this.playSound(SoundEvents.ENTITY_ZOMBIE_STEP, 0.15F, 1.0F);
      }

      protected void applyEntityAttributes()
      {
      super.applyEntityAttributes();
      this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(53.0D);
      this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.22499999403953552D);
      }

      public boolean processInteract(EntityPlayer player, EnumHand p_184645_2_, ItemStack stack)
      {
      if (!super.processInteract(player, p_184645_2_, stack))
             {
                 if (!this.worldObj.isRemote && !this.isBeingRidden())
                 {
                     mountTo(player);
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             else
             {
                 return true;
             }
      }

      private void mountTo(EntityPlayer player)
      {
      player.rotationYaw = this.rotationYaw;
      player.rotationPitch = this.rotationPitch;

      if (!this.worldObj.isRemote)
      {
      player.startRiding(this);
      }
      }

      public void moveEntityWithHeading(float strafe, float forward)
      {
      Entity entity = this.getPassengers().isEmpty() ? null : (Entity)this.getPassengers().get(0);

      if (this.isBeingRidden() && this.canBeSteered())
      {
      this.prevRotationYaw = this.rotationYaw = entity.rotationYaw;
      this.rotationPitch = entity.rotationPitch * 0.5F;
      this.setRotation(this.rotationYaw, this.rotationPitch);
      this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
      this.stepHeight = 1.0F;
      this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;

      if (this.canPassengerSteer())
      {
      float f = (float)this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() * 0.225F;

      if (this.field_184765_bx)
      {
      if (this.field_184766_bz++ > this.field_184767_bA)
      {
      this.field_184765_bx = false;
      }

      f += f * 1.15F * MathHelper.sin((float)this.field_184766_bz / (float)this.field_184767_bA * (float)Math.PI);
      }

      this.setAIMoveSpeed(f);
      super.moveEntityWithHeading(0.0F, 1.0F);
      }
      else
      {
      this.motionX = 0.0D;
      this.motionY = 0.0D;
      this.motionZ = 0.0D;
      }

      this.prevLimbSwingAmount = this.limbSwingAmount;
      double d1 = this.posX - this.prevPosX;
      double d0 = this.posZ - this.prevPosZ;
      float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;

      if (f1 > 1.0F)
      {
      f1 = 1.0F;
      }

      this.limbSwingAmount += (f1 - this.limbSwingAmount) * 0.4F;
      this.limbSwing += this.limbSwingAmount;
      }
      else
      {
      this.stepHeight = 0.5F;
      this.jumpMovementFactor = 0.02F;
      super.moveEntityWithHeading(strafe, forward);
      }
      }

      public boolean func_184762_da()
      {
      if (this.field_184765_bx)
      {
      return false;
      }
      else
      {
      this.field_184765_bx = true;
      this.field_184766_bz = 0;
      this.field_184767_bA = this.getRNG().nextInt(841) + 140;
      return true;
      }
      }

      public EntityAgeable createChild(EntityAgeable ageable)
      {
      return null;
      }

      public boolean canBeSteered()
      {
      Entity entity = this.getControllingPassenger();
             return entity instanceof EntityLivingBase;
      }

      public void updatePassenger(Entity passenger)
      {
      super.updatePassenger(passenger);

      float var1 = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
      float var2 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
      float var3 = 0.7F;
      float var4 = 0.15F;

      passenger.setPosition(this.posX + (double) (var3 * var1), this.posY + this.getMountedYOffset() + passenger.getYOffset() + (double) var4, this.posZ - (double) (var3 * var2));

      if(passenger instanceof EntityLivingBase)
      {
      ((EntityLivingBase)passenger).renderYawOffset = this.renderYawOffset;
      }
      }

      public Entity getControllingPassenger()
      {
      return this.getPassengers().isEmpty() ? null : (Entity)this.getPassengers().get(0);
      }
      }

      
      J'ai cherché mais rien trouvé.
      
      Si vous avez une solution, n'hésitez pas à poster ;)
      
      Merci d'avance
      1 réponse Dernière réponse Répondre Citer 0
      • Benjamin Loison
        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
        • Axaurus
          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
          • Axaurus
            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
            • robin4002
              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
              • Axaurus
                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
                • BrokenSwing
                  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
                  • Axaurus
                    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
                    • BrokenSwing
                      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
                      • robin4002
                        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
                        • Axaurus
                          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
                          • Axaurus
                            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
                            • robin4002
                              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
                              • Axaurus
                                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
                                • BrokenSwing
                                  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
                                  • Axaurus
                                    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
                                    • robin4002
                                      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
                                      • BrokenSwing
                                        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
                                        • robin4002
                                          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
                                          • Axaurus
                                            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
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            Contact / Mentions Légales

                                            MINECRAFT FORGE FRANCE © 2018

                                            Powered by NodeBB