MFF

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

    Texture Four en fonction du son status

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    45 Messages 7 Publieurs 6.4k 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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      C’est event.harvester qui est null, il faut ajouter un null check sur ce dernier.

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

        Merci beaucoup ! 🙂 Mes events fonctionnent enfin correctement

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

          Pour la metadata, il faut que tu créées une fonction qui va vérifier si le cour est allumé et si le bloc est celui du four éteint dans ce cas , il faudra ajouter 4 à le metadata (pour garder l orientation), et inversement, cette fonction sera appelée par le tileentity

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

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

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

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

            ça ne fonctionne pas 😕

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

              Voici la fonction qui fait ça dans la version 1.7 de mon mod :

              public static void updateFurnaceBlockState(boolean active, World world, int x, int y, int z)
                  {
                      Block block = world.getBlock(x, y, z);
                      int meta = world.getBlockMetadata(x, y, z);
                      TileEntity tileentity = world.getTileEntity(x, y, z);
                      keepFurnaceInventory = true; //Fait que le block ne loot pas l'inventaire quand on le rempli (marche avec la fonction breakBlock())
                      if (active&& meta < 4) //Le block n'est pas actif mais devrait l'être
                      {
                      world.setBlock(x, y, z, TonBlock, meta + 4, 1);
                      }
                      else if(meta >= 4)//Le block est pas actif mais ne devait pas l'être
                      {
                      world.setBlock(x, y, z, TonBlock, meta - 4, 1);
                      }
                      keepFurnaceInventory = false;
                      if (tileentity != null)
                      {
                          tileentity.validate();
                          world.setTileEntity(x, y, z, tileentity);
                      }
                  }
              

              Et vérifies bien ta fonction getIcon() (serait idiot que ça marche mais que tu puisses pas le voir 😕 )

              Dans ma méthode update du tile entity :

              if (flag != this.furnaceBurnTime > 0) //La boolean flag est définie au DEBUT de la fonction, elle égale à this.furnaceBurnTime > 0 ; et il faut que tu mettes cette condition à la fin de la fonction, ça détecte si le statut du four a changé
                      {
                          BlockFourElec.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
                      }
              

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

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

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

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

                Je sais pas pourquoi mais je crois que je suis un pure noob en modding

                Mon jeu crash

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

                  Rapport de crash ?

                  (Je ne compte pas télécharger à chaque fois ton code pour le tester de mon côté si ça peut être résolu facilement)

                  Site web contenant mes scripts : http://SCAREXgaming.github.io

                  Pas de demandes de support par MP ni par skype SVP.
                  Je n'accepte sur skype que l…

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

                    [20:47:12] [Server thread/ERROR]: Encountered an unexpected exception
                    net.minecraft.util.ReportedException: Ticking block entity
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:709) ~[MinecraftServer.class:?]
                    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]
                    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[IntegratedServer.class:?]
                    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
                    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
                    Caused by: java.lang.ExceptionInInitializerError
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) ~[TileEntityCrusher.class:?]
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) ~[TileEntityCrusher.class:?]
                    at net.minecraft.world.World.updateEntities(World.java:2160) ~[World.class:?]
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) ~[WorldServer.class:?]
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) ~[MinecraftServer.class:?]
                    … 4 more
                    Caused by: java.lang.NullPointerException
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<init>(CrusherRecipes.java:22) ~[CrusherRecipes.class:?]
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<clinit>(CrusherRecipes.java:16) ~[CrusherRecipes.class:?]
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203) ~[TileEntityCrusher.class:?]
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246) ~[TileEntityCrusher.class:?]
                    at net.minecraft.world.World.updateEntities(World.java:2160) ~[World.class:?]
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) ~[WorldServer.class:?]
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) ~[MinecraftServer.class:?]
                    … 4 more
                    [20:47:12] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Family\Desktop\Java Modding\NewMechanicalCraft\eclipse\.\crash-reports\crash-2016-03-03_20.47.12-server.txt
                    [20:47:12] [Server thread/INFO]: Stopping server
                    [20:47:12] [Server thread/INFO]: Saving players
                    [20:47:12] [Server thread/INFO]: Saving worlds
                    [20:47:12] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
                    [20:47:13] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
                    // I bet Cylons wouldn't have this problem.
                    
                    Time: 03/03/16 20:47
                    Description: Ticking block entity
                    
                    java.lang.ExceptionInInitializerError
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203)
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246)
                    at net.minecraft.world.World.updateEntities(World.java:2160)
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
                    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                    Caused by: java.lang.NullPointerException
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<init>(CrusherRecipes.java:22)
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.CrusherRecipes.<clinit>(CrusherRecipes.java:16)
                    ... 9 more
                    
                    A detailed walkthrough of the error, its code path and all known details is as follows:
                    ---------------------------------------------------------------------------------------
                    
                    -- Head --
                    Stacktrace:
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.canSmelt(TileEntityCrusher.java:203)
                    at com.google.SpyMan.Mechanicalcraft.common.BlockCrusher.TileEntityCrusher.updateEntity(TileEntityCrusher.java:246)
                    ```</clinit></init></clinit></init>
                    1 réponse Dernière réponse Répondre Citer 0
                    • DeletedD Hors-ligne
                      Deleted
                      dernière édition par

                      NPE -> Classe CrusherRecipes, ligne 22 & 16. On peut les voir ?

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

                        Y a un zip en download 2 messages plus haut sinon
                        Enfait le problème vien de mon block qui change de texture pas des recipes

                        Block Crusher

                        
                        [color=#0187dfpackage ]com.google.SpyMan.Mechanicalcraft.common.BlockCrusher%(#aaa9a7)[;
                        ]
                        import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft%(#aaa9a7)[;
                        ]
                        import cpw.mods.fml.relauncher.Side%(#aaa9a7)[;
                        ]import ***cpw.mods.fml.relauncher.SideOnly***%(#aaa9a7)[;
                        ]import net.minecraft.block.Block%(#aaa9a7)[;
                        ]import net.minecraft.block.BlockContainer%(#aaa9a7)[;
                        ]import net.minecraft.block.ITileEntityProvider%(#aaa9a7)[;
                        ]import net.minecraft.block.material.Material%(#aaa9a7)[;
                        ]import net.minecraft.client.renderer.texture.IIconRegister%(#aaa9a7)[;
                        ]import net.minecraft.entity.EntityLivingBase%(#aaa9a7)[;
                        ]import net.minecraft.entity.item.EntityItem%(#aaa9a7)[;
                        ]import net.minecraft.entity.player.EntityPlayer%(#aaa9a7)[;
                        ]import net.minecraft.inventory.IInventory%(#aaa9a7)[;
                        ]import net.minecraft.item.ItemStack%(#aaa9a7)[;
                        ]import net.minecraft.nbt.NBTTagCompound%(#aaa9a7)[;
                        ]import net.minecraft.tileentity.TileEntity%(#aaa9a7)[;
                        ]import net.minecraft.util.IIcon%(#aaa9a7)[;
                        ]import net.minecraft.util.MathHelper%(#aaa9a7)[;
                        ]import net.minecraft.world.World%(#aaa9a7)[;
                        ]
                        public class Crusher extends BlockContainer implements %(#345f99)[ITileEntityProvider
                        ]{
                        
                          public Crusher(Material *material*)
                          {
                             super(*material*)%(#aaa9a7)[;
                        ]      setResistance(30.0F)%(#aaa9a7)[;
                        ]      setHardness(3)%(#aaa9a7)[;
                        ]      setHarvestLevel("pickaxe", 2)%(#aaa9a7)[;
                        ]   }
                        
                          private static String machineType = "crusher"%(#aaa9a7)[;
                        ]   public static String[] blockTexture = new String[]
                          {
                                %(#ff537a)MechanicalCraft.TEXTURE_NAME + "machine_side"%(#aaa9a7)[,
                        ]         %(#ff537a)MechanicalCraft.TEXTURE_NAME + machineType+"_front"%(#aaa9a7)[,
                        ]         %(#ff537a)MechanicalCraft.TEXTURE_NAME + machineType+"_front_on"%(#aaa9a7)[,
                        ]         %(#ff537a)MechanicalCraft.TEXTURE_NAME + "machine_bottom"%(#aaa9a7)[,
                        ]         %(#ff537a)MechanicalCraft.TEXTURE_NAME + %(#00b10f)["machine_top"
                        ]   }%(#aaa9a7)[;
                        ]
                          private IIcon top, bottom, side, frontOn, frontOff%(#aaa9a7)[;
                        ]   TileEntityCrusher tileEntityCrusher%(#aaa9a7)[;
                        ]
                          public void registerBlockIcons(IIconRegister *iiconRegister*)
                          {
                             this.frontOn = *iiconRegister*.registerIcon(blockTexture[2])%(#aaa9a7)[;
                        ]      this.frontOff = *iiconRegister*.registerIcon(blockTexture[1])%(#aaa9a7)[;
                        ]      this.top = *iiconRegister*.registerIcon(blockTexture[4])%(#aaa9a7)[;
                        ]      this.bottom = *iiconRegister*.registerIcon(blockTexture[3])%(#aaa9a7)[;
                        ]      this.side = *iiconRegister*.registerIcon(blockTexture[0])%(#aaa9a7)[;
                        ]   }
                        
                          public void onBlockPlacedBy(World *world*, int *x*, int *y*, int *z*, EntityLivingBase *living*, ItemStack *stack*)
                          {
                             int direction = MathHelper.floor_double((double) (*living*.rotationYaw %(#aaa9a7)*   4.0F / 360.0F) + 2.5D) & 3%(#aaa9a7)[;
                            ]      *world*.setBlockMetadataWithNotify(*x*, *y*, *z*, direction, 2)%(#aaa9a7)[;
                            ]   }
                        
                              ***@SideOnly***(Side.CLIENT)
                              public IIcon getIcon(int *side*, int *metadata*)
                              {
                                 if (*side *== 0) return this.bottom%(#aaa9a7)[;
                            ]      else if (*side *== 1) return this.top%(#aaa9a7)[;
                            ]
                                 if ((*side *== 3 && *metadata *== 0) || (*side *== 4 && *metadata *== 1) || (*side *== 2 && *metadata *== 2) || (*side *== 5 && *metadata *== 3))
                                 {
                                    return this.frontOff%(#aaa9a7)[;
                            ]      }
                                 else if ((*side *== 3 && *metadata *== 4) || (*side *== 4 && *metadata *== 5) || (*side *== 2 && *metadata *== 6) || (*side *== 5 && *metadata *== 7))
                                 {
                                    return this.frontOn%(#aaa9a7)[;
                            ]      }
                                 return this.side%(#aaa9a7)[;
                            ]   }
                              private static boolean keepFurnaceInventory = false%(#aaa9a7)[;
                            ]
                            // METHOD: update the block front texture
                              public static void updateMachineTexture(boolean *active*, World *world*, int *x*, int *y*, int *z*)
                              {
                                 Block block = *world*.getBlock(*x*, *y*, *z*)%(#aaa9a7)[;
                            ]      int meta = *world*.getBlockMetadata(*x*, *y*, *z*)%(#aaa9a7)[;
                            ]      TileEntity tileentity = *world*.getTileEntity(*x*, *y*, *z*)%(#aaa9a7)[;
                            ]      keepFurnaceInventory = true%(#aaa9a7)[;
                            ]
                                 if (*active *&& meta < 4)
                                 {
                                    *world*.setBlock(*x*, *y*, *z*, MechanicalCraft.crusher, meta + 4, 1)%(#aaa9a7)[;
                            ]      }
                                 else if(meta >= 4)
                                 {
                                    *world*.setBlock(*x*, *y*, *z*, MechanicalCraft.crusher, meta - 4, 1)%(#aaa9a7)[;
                            ]      }
                        
                                 keepFurnaceInventory = false%(#aaa9a7)[;
                            ]
                                 if (tileentity != null)
                                 {
                                    tileentity.validate()%(#aaa9a7)[;
                            ]         *world*.setTileEntity(*x*, *y*, *z*, tileentity)%(#aaa9a7)[;
                            ]      }
                              }
                        
                              %(#278c3c)[***@Override
                            ***]   public TileEntity createNewTileEntity(World *world*, int *metadata*)
                              {
                                 return new TileEntityCrusher()%(#aaa9a7)[;
                            ]   }
                        
                              %(#278c3c)[***@Override
                            ***]   public boolean hasTileEntity(int *metadata*)
                              {
                                 return true%(#aaa9a7)[;
                            ]   }
                        
                              public void breakBlock(World *world*, int *x*, int *y*, int *z*, Block *block*, int *metadata*)
                              {
                                 TileEntity tileentity = *world*.getTileEntity(*x*, *y*, *z*)%(#aaa9a7)[;
                            ]
                                 if (tileentity instanceof IInventory)
                                 {
                                    if (keepFurnaceInventory = true) {}
                        
                                    %(#0187df)[else
                            ]         {
                                       IInventory inv = (IInventory)tileentity%(#aaa9a7)[;
                            ]            for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1)
                                       {
                                          ItemStack itemstack = inv.getStackInSlot(i1)%(#aaa9a7)[;
                            ]
                                          if (itemstack != null)
                                          {
                                             float f = *world*.rand.nextFloat() %(#aaa9a7)*   0.8F + 0.1F%(#aaa9a7)[;
                            ]                  float f1 = *world*.rand.nextFloat() %(#aaa9a7)*   0.8F + 0.1F%(#aaa9a7)[;
                            ]                  EntityItem entityitem%(#aaa9a7)[;
                            ]
                                             for (float f2 = *world*.rand.nextFloat() %(#aaa9a7)*   0.8F + 0.1F; itemstack.stackSize > 0; *world*.spawnEntityInWorld(entityitem))
                                             {
                                                int j1 = *world*.rand.nextInt(21) + 10%(#aaa9a7)[;
                            ]
                                                if (j1 > itemstack.stackSize)
                                                {
                                                   j1 = itemstack.stackSize%(#aaa9a7)[;
                            ]                     }
                        
                                                itemstack.stackSize -= j1%(#aaa9a7)[;
                            ]                     entityitem = new EntityItem(*world*, (double) ((float) *x *+ f), (double) ((float) *y *+ f1), (double) ((float) *z *+ f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()))%(#aaa9a7)[;
                            ]                     float f3 = 0.05F%(#aaa9a7)[;
                            ]                     entityitem.motionX = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)*   f3)%(#aaa9a7)[;
                            ]                     entityitem.motionY = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)*   f3 + 0.2F)%(#aaa9a7)[;
                            ]                     entityitem.motionZ = (double) ((float) *world*.rand.nextGaussian() %(#aaa9a7)*   f3)%(#aaa9a7)[;
                            ]
                                                if (itemstack.hasTagCompound())
                                                {
                                                   entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy())%(#aaa9a7)[;
                            ]                     }
                                             }
                                          }
                                       }
                                    }
                                    *world*.func_147453_f(*x*, *y*, *z*, *block*)%(#aaa9a7)[;
                            ]      }
                                 super.breakBlock(*world*, *x*, *y*, *z*, *block*, *metadata*)%(#aaa9a7)[;
                            ]   }
                        
                              public boolean onBlockActivated(World *world*, int *x*, int *y*, int *z*, EntityPlayer *player*, int *side*, float *hitx*, float *hity*, float *hitz*)
                              {
                                 if (*world*.isRemote)
                                 {
                                    return true%(#aaa9a7)[;
                            ]      }
                                 %(#0187df)[else
                            ]      {
                                    *player*.openGui(MechanicalCraft.instance, 3, *world*, *x*, *y*, *z*)%(#aaa9a7)[;
                            ]         return true%(#aaa9a7)[;
                            ]      }
                              }
                            }
                        
                            ```
                        
                            TileEntityCrusher
                            ```java
                            [color=#0187dfpackage ]com.google.SpyMan.Mechanicalcraft.common.BlockCrusher%(#aaa9a7)[;
                            ]
                            import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft%(#aaa9a7)[;
                            ]import cpw.mods.fml.relauncher.Side%(#aaa9a7)[;
                            ]import ***cpw.mods.fml.relauncher.SideOnly***%(#aaa9a7)[;
                            ]import net.minecraft.entity.player.EntityPlayer%(#aaa9a7)[;
                            ]import net.minecraft.init.Blocks%(#aaa9a7)[;
                            ]import net.minecraft.init.Items%(#aaa9a7)[;
                            ]import net.minecraft.inventory.IInventory%(#aaa9a7)[;
                            ]import net.minecraft.item.ItemStack%(#aaa9a7)[;
                            ]import net.minecraft.nbt.NBTTagCompound%(#aaa9a7)[;
                            ]import net.minecraft.nbt.NBTTagList%(#aaa9a7)[;
                            ]import net.minecraft.network.NetworkManager%(#aaa9a7)[;
                            ]import net.minecraft.network.Packet%(#aaa9a7)[;
                            ]import net.minecraft.network.play.server.S35PacketUpdateTileEntity%(#aaa9a7)[;
                            ]import net.minecraft.tileentity.TileEntity%(#aaa9a7)[;
                            ]import net.minecraft.tileentity.TileEntityFurnace%(#aaa9a7)[;
                            ]
                            public class TileEntityCrusher extends TileEntity implements IInventory
                            {
                              private byte direction%(#aaa9a7)[;
                            ]   private ItemStack[] contents = new ItemStack[4]%(#aaa9a7)[;
                            ]   protected int workingTime = 0%(#aaa9a7)[;
                            ]   protected int workingTimeNeeded = 200%(#aaa9a7)[;
                            ]   protected int burnTime = 0%(#aaa9a7)[;
                            ]   protected int burnTimeTotal = 0%(#aaa9a7)[;
                            ]
                              %(#278c3c)[***@Override
                            ***]   public void readFromNBT(NBTTagCompound *compound*)
                              {
                                 super.readFromNBT(*compound*)%(#aaa9a7)[;
                            ]      this.direction = *compound*.getByte("Direction")%(#aaa9a7)[;
                            ]      NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[;
                            ]      this.contents = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[;
                            ]
                                 for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*)
                                 {
                                    NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
                            ]         int j = nbttagcompound1.getByte("Slot") & 255%(#aaa9a7)[;
                            ]
                                    if(j >= 0 && j < this.contents.length)
                                    {
                                       this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1)%(#aaa9a7)[;
                            ]         }
                                 }
                                 this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[;
                            ]      this.workingTimeNeeded = *compound*.getShort("workingTimeNeeded")%(#aaa9a7)[;
                            ]   }
                        
                              %(#278c3c)[***@Override
                            ***]   public void writeToNBT(NBTTagCompound *compound*)
                              {
                                 super.writeToNBT(*compound*)%(#aaa9a7)[;
                            ]      NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[;
                            ]      *compound*.setByte("Direction", this.direction)%(#aaa9a7)[;
                            ]      for(int %(#666965)_= 0; %(#666965)_< this.contents.length; ++%(#666965)*)
                                 {
                                    if(this.contents[%(#666965)*] != null)
                                    {
                                       NBTTagCompound nbttagcompound1 = new NBTTagCompound()%(#aaa9a7)[;
                            ]            nbttagcompound1.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[;
                            ]            this.contents[%(#666965)*].writeToNBT(nbttagcompound1)%(#aaa9a7)[;
                            ]            nbttaglist.appendTag(nbttagcompound1)%(#aaa9a7)[;
                            ]
                                    }
                                 }
                                 *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[;
                            ]      *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[;
                            ]      *compound*.setShort("workingTimeNeeded", (short)this.workingTimeNeeded)%(#aaa9a7)[;
                            ]   }
                        
                              public byte getDirection()
                              {
                                 return direction%(#aaa9a7)[;
                            ]   }
                        
                              public void setDirection(byte *direction*)
                              {
                                 this.direction = *direction*%(#aaa9a7)[;
                            ]      this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
                            ]   }
                        
                              public Packet getDescriptionPacket()
                              {
                                 NBTTagCompound nbttagcompound = new NBTTagCompound()%(#aaa9a7)[;
                            ]      this.writeToNBT(nbttagcompound)%(#aaa9a7)[;
                            ]      return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound)%(#aaa9a7)[;
                            ]   }
                        
                              public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*)
                              {
                                 this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[;
                            ]   }
                        
                              public int getSizeInventory()
                              {
                                 return this.contents.length%(#aaa9a7)[;
                            ]   }
                        
                              public void openInventory() {}
                        
                              public void closeInventory() {}
                        
                              public String getInventoryName()
                              {
                                 return MechanicalCraft.crusher.getLocalizedName()%(#aaa9a7)[;
                            ]   }
                        
                              public boolean hasCustomInventoryName()
                              {
                                 return false%(#aaa9a7)[;
                            ]   }
                        
                              public int getInventoryStackLimit()
                              {
                                 return 64%(#aaa9a7)[;
                            ]   }
                        
                              public boolean isUseableByPlayer(EntityPlayer *player*)
                              {
                                 return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : *player*.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#aaa9a7)[;
                            ]   }
                        
                              public ItemStack getStackInSlot(int *slotIndex*)
                              {
                                 return this.contents[*slotIndex*]%(#aaa9a7)[;
                            ]   }
                        
                              public ItemStack decrStackSize(int *slotIndex*, int *amount*)
                              {
                                 if(this.contents[*slotIndex*] != null)
                                 {
                                    ItemStack itemstack%(#aaa9a7)[;
                            ]
                                    if(this.contents[*slotIndex*].stackSize <= *amount*)
                                    {
                                       itemstack = this.contents[*slotIndex*]%(#aaa9a7)[;
                            ]            this.contents[*slotIndex*] = null%(#aaa9a7)[;
                            ]            this.markDirty()%(#aaa9a7)[;
                            ]            return itemstack%(#aaa9a7)[;
                            ]         }
                                    %(#0187df)[else
                            ]         {
                                       itemstack = this.contents[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[;
                            ]
                                       if(this.contents[*slotIndex*].stackSize == 0)
                                       {
                                          this.contents[*slotIndex*] = null%(#aaa9a7)[;
                            ]            }
                                       this.markDirty()%(#aaa9a7)[;
                            ]            return itemstack%(#aaa9a7)[;
                            ]         }
                                 }
                                 %(#0187df)[else
                            ]      {
                                    return null%(#aaa9a7)[;
                            ]      }
                              }
                        
                              public ItemStack getStackInSlotOnClosing(int *slotIndex*)
                              {
                                 if(this.contents[*slotIndex*] != null)
                                 {
                                    ItemStack itemstack = this.contents[*slotIndex*]%(#aaa9a7)[;
                            ]         this.contents[*slotIndex*] = null%(#aaa9a7)[;
                            ]         return itemstack%(#aaa9a7)[;
                            ]      }
                                 %(#0187df)[else
                            ]      {
                                    return null%(#aaa9a7)[;
                            ]      }
                              }
                        
                              public void setInventorySlotContents(int *slotIndex*, ItemStack *stack*)
                              {
                                 this.contents[*slotIndex*] = *stack*%(#aaa9a7)[;
                            ]
                                 if(*stack *!= null && *stack*.stackSize > this.getInventoryStackLimit())
                                 {
                                    *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[;
                            ]      }
                                 this.markDirty()%(#aaa9a7)[;
                            ]   }
                        
                              public boolean isItemValidForSlot(int *slot*, ItemStack *stack*)
                              {
                                 return *slot *== 2 ? false : true%(#aaa9a7)[;
                            ]   }
                        
                              public boolean isBurning()
                              {
                                 return this.workingTime > 0%(#aaa9a7)[;
                            ]   }
                        
                              protected boolean canSmelt()
                              {
                                 if(this.contents[0] == null)
                                 {
                                    return false%(#aaa9a7)[;
                            ]      }
                                 %(#0187df)[else
                            ]      {
                                    ItemStack itemstack = CrusherRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]})%(#aaa9a7)[;
                            ]         if(itemstack == null)
                                       return false%(#aaa9a7)[;
                            ]         if(this.contents[2] == null)
                                       return true%(#aaa9a7)[;
                            ]         if(!this.contents[2].isItemEqual(itemstack))
                                       return false%(#aaa9a7)[;
                            ]         int result = contents[2].stackSize + itemstack.stackSize%(#aaa9a7)[;
                            ]         return result <= getInventoryStackLimit() && result <= this.contents[2].getMaxStackSize()%(#aaa9a7)[;
                            ]      }
                              }
                        
                              public void smeltItem()
                              {
                                 if(this.canSmelt())
                                 {
                                    ItemStack itemstack = CrusherRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0]})%(#aaa9a7)[;
                            ]         if(this.contents[2] == null)
                                    {
                                       this.contents[2] = itemstack.copy()%(#aaa9a7)[;
                            ]         }
                                    else if(this.contents[2].getItem() == itemstack.getItem())
                                    {
                                       this.contents[2].stackSize += itemstack.stackSize%(#aaa9a7)[;
                            ]         }
                        
                                    this.decrStackSize(0, 1)%(#aaa9a7)[;
                            ]      }
                              }
                        
                              boolean flag%(#aaa9a7)[;
                            ]   public void updateEntity()
                              {
                                 %(#ff9205)[//System.out.println(burnTime + "/" + burnTimeTotal);
                            ]      if(this.burnTime > 0)
                                 {
                                    burnTime%(#aaa9a7)[–;
                            ]         flag = true%(#aaa9a7)[;
                            ]      }
                                 %(#0187df)[else
                            ]      {
                                    flag = false%(#aaa9a7)[;
                            ]      }
                                 if(this.canSmelt())
                                 {
                                    if(this.burnTime <= 0)
                                    {
                                       int %(#666965)____
                        1 réponse Dernière réponse Répondre Citer 0
                        • SCAREXS Hors-ligne
                          SCAREX
                          dernière édition par

                          Normal que ça marche pas…

                          package com.google.SpyMan.Mechanicalcraft.common.BlockCrusher;
                          
                          import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
                          import net.minecraft.block.Block;
                          import net.minecraft.init.Blocks;
                          import net.minecraft.init.Items;
                          import net.minecraft.item.Item;
                          import net.minecraft.item.ItemStack;
                          
                          import java.util.HashMap;
                          import java.util.Iterator;
                          import java.util.Map;
                          
                          public class CrusherRecipes
                          {
                          private static final CrusherRecipes smeltingBase = new CrusherRecipes();
                          private Map <itemstack[], itemstack="">smeltingList = new HashMap<itemstack[], itemstack="">();
                          private MechanicalCraft m; // ici la variable n'est jamais initialisée
                          
                          public CrusherRecipes()
                          {
                          this.m.crusherRecipes(); // Et ici tu appelles la variable
                          }
                          }
                          

                          L’instance ne va pas se créer toute seule.

                          PS : pense vraiment à respecter la convention java</itemstack[],></itemstack[],>

                          Site web contenant mes scripts : http://SCAREXgaming.github.io

                          Pas de demandes de support par MP ni par skype SVP.
                          Je n'accepte sur skype que l…

                          1 réponse Dernière réponse Répondre Citer 0
                          • SpyManS Hors-ligne
                            SpyMan
                            dernière édition par robin4002

                            9a ne change pas grand chose ça crash toujours  😕

                            Pour la code convention alors y’a 24 pages et je ne suis qu’à la 13ème pages

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

                              Si MechanicalCraft est le nom de ta classe Mod, alors ça ne sert strictement à rien de lui faire une instance puisqu’elle est censée être singleton. Tu as déjà dedans (dans ta classe MechanicalCraft) une variable instance, normalement, si tu as bien suivi le tuto. Alors tu aurais juste à faire MechanicalCraft.instance.crusherRecipes()

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

                                9a ?? C’est quoi ça ?

                                Si tu veux avoir une instance de ton mod, tu peux aussi faire “MechanicalCraft m = MechanicalCraft.INSTANCE;” ou quelque chose dans le genre, ça dépend de ce que tu as mis.

                                Les conventions sont assez simples :

                                • écriture en lowerCamelCase pour les variables et les fonctions
                                • écriture en UpperCamelCase pour les noms de classes
                                • écriture en SCREAMING_SNAKE_CASE pour les constantes
                                • les noms de packages doivent êtres entièrement en minuscules

                                Site web contenant mes scripts : http://SCAREXgaming.github.io

                                Pas de demandes de support par MP ni par skype SVP.
                                Je n'accepte sur skype que l…

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

                                  @SCAREX
                                  Je pense qu’il voulait dire “Ca” dans son début de réponse.
                                  Et au passage ouais, pas besoin de te taper 30 pages de blabla, juste pour 4/5 règles grand maxi (citées au-dessus) de convention Java. Perso pour l’apprendre, je n’ai eu besoin que de 5 min ^^’

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

                                    Ok ça marche merci 🙂
                                    Mais comment je peut changer la texture de front de ma machine car j’ai essayé tout ce que on n’a pu me donner comme code et ça marche pas ou je ne mit prend pas correctement 😢

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

                                      Sinon si rien ne marche, fais deux blocs (on et off) et imite le code vanilla

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

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

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

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

                                        C’est à dire ? La texture n’est pas chargée (Il faut regarder dans les logs pour savoir si la texture est trouvée) ?

                                        Site web contenant mes scripts : http://SCAREXgaming.github.io

                                        Pas de demandes de support par MP ni par skype SVP.
                                        Je n'accepte sur skype que l…

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

                                          Non le jeu crash, mais je vais essayé de faire ça dans la fonction updateEntity de mon TileEntity voir ce que cela donne

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

                                            Envoi le crash report et les classes concernées

                                            Site web contenant mes scripts : http://SCAREXgaming.github.io

                                            Pas de demandes de support par MP ni par skype SVP.
                                            Je n'accepte sur skype que l…

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB