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.
    • SpyManS Hors-ligne
      SpyMan
      dernière édition par robin4002

      package com.google.SpyMan.Mechanicalcraft.common.BlockCrusher;
      
      import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
      
      import net.minecraft.block.Block;
      import net.minecraft.block.BlockContainer;
      import net.minecraft.block.ITileEntityProvider;
      import net.minecraft.block.material.Material;
      import net.minecraft.client.renderer.texture.IIconRegister;
      import net.minecraft.entity.EntityLivingBase;
      import net.minecraft.entity.item.EntityItem;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.inventory.IInventory;
      import net.minecraft.item.ItemStack;
      import net.minecraft.nbt.NBTTagCompound;
      import net.minecraft.tileentity.TileEntity;
      import net.minecraft.util.IIcon;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      
      public class Crusher extends BlockContainer implements ITileEntityProvider
      {
          public Crusher(Material material)
          {
              super;
              setResistance;
              setHardness;
              setHarvestLevel("pickaxe", 2);
          }
      
          private static String machineType = "crusher";
          public static String[] blockTexture = new String[]
          {
              MechanicalCraft.TEXTURE_NAME + "machine_side",
              MechanicalCraft.TEXTURE_NAME + machineType+"_front",
              MechanicalCraft.TEXTURE_NAME + machineType+"_front_on",
              MechanicalCraft.TEXTURE_NAME + "machine_bottom",
              MechanicalCraft.TEXTURE_NAME + %(#00b10f)["machine_top"
          };
      
        private IIcon top, bottom, side, frontOn, frontOff;
         TileEntityCrusher tileEntityCrusher;
      
          public void registerBlockIcons(IIconRegister iiconRegister)
          {
              this.frontOn = iiconRegister.%(#afb8c5)registerIcon;
              this.frontOff = iiconRegister.%(#afb8c5)registerIcon;
              this.top = iiconRegister.%(#afb8c5)registerIcon;
              this.bottom = iiconRegister.%(#afb8c5)registerIcon;
              this.side = iiconRegister.%(#afb8c5)registerIcon;
          }
      
          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;
               world.setBlockMetadataWithNotify(x, y, z, direction, 2);
          }
          public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
          {
              int direction = MathHelper.floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
              world.setBlockMetadataWithNotify(x, y, z, direction, 2);
          }
      
          public IIcon getIcon(int side, int metadata)
          {
              if (side == 0) return this.bottom;
               else if (side == 1) return this.top;
      
              if ((side == 3 && metadata == 0) || (side == 4 && metadata == 1) || (side == 2 && metadata == 2) || (side == 5 && metadata == 3))
              {
                  return this.frontOff;
              }
              else if (tileEntityCrusher.isBurning())
              {
                  if ((side == 3 && metadata == 0 + 4) || (side == 4 && metadata == 1 + 4) || (side == 2 && metadata == 2 + 4) || (side == 5 && metadata == 3 + 4))
                  {
                      return this.frontOn;
                  }
              }
              return this.side;
          }
      
          @Override
          public TileEntity createNewTileEntity(World world, int metadata)
          {
              return new TileEntityCrusher();
          }
      
          @Override
          public boolean hasTileEntity(int metadata)
          {
              return true;
          }
      
        public void breakBlock(World world, int x, int y, int z, Block block, int metadata)
        {
           TileEntity tileentity = world.getTileEntity(x, y, z);
      
           if (tileentity instanceof IInventory)
           {
              IInventory inv = (IInventory)tileentity;
              for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1)
              {
                 ItemStack itemstack = inv.getStackInSlot(i1);
      
                 if (itemstack != null)
                 {
                    float f = world.rand.nextFloat() *   0.8F + 0.1F;
                     float f1 = world.rand.nextFloat() *   0.8F + 0.1F;
                     EntityItem entityitem;
      
                    for (float f2 = world.rand.nextFloat() *   0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem))
                    {
                       int j1 = world.rand.nextInt(21) + 10;
      
                       if (j1 > itemstack.stackSize)
                       {
                          j1 = itemstack.stackSize;
                        }
      
                       itemstack.stackSize -= j1;
                        entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
                        float f3 = 0.05F;
                        entityitem.motionX = (double)((float)world.rand.nextGaussian() *   f3);
                        entityitem.motionY = (double)((float)world.rand.nextGaussian() *   f3 + 0.2F);
                        entityitem.motionZ = (double)((float)world.rand.nextGaussian() *   f3);
      
                       if (itemstack.hasTagCompound())
                       {
                          entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                        }
                    }
                 }
              }
              world.func_147453_f(x, y, z, block);
            }
           super.breakBlock(world, x, y, z, block, metadata);
          }
      
          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;
              }
              else
              {
                  player.openGui(MechanicalCraft.instance, 3, world, x, y, z);
                  return true;
              }
          }
      }
      
      1 réponse Dernière réponse Répondre Citer 0
      • XeNeX Hors-ligne
        XeNe
        dernière édition par

        Donc ligne 68 tu as else if (tileEntityCrusher.isBurning()), sauf qu’il ne peux pas l’avoir…du coup ça vient de ton TileEntity…

        Aller voir l’état de mon mod sur trello! https://trello.com/b/p0JMg4ki/taqmod2

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

          “TileEntityCrusher tileEntityCrusher;”
          Il est toujours égal à null donc ça peut pas marcher, et de toute façon faut pas faire ça parce que t’a un tile entity différent par bloc.

          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

            Comment je peut faire alors ???

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

              Il faut que tu return la texture en fonction de la metadata

              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

                D’accord mais le metadata je le trouve où ?

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

                  Il y a un argument metadat dans ta fonction getIcon

                  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

                    Oui mais la valeur du metadata je là sort d’où?

                    –--------------------------------------------------------------------

                    EDIT: Si quelqu’un sait comment resoudre ce crash

                    Ceci n’a strictement rien a voir avec le sujet 🙂

                    [22:34:13] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.world.BlockEvent$HarvestDropsEvent@40e581af:
                    java.lang.NullPointerException
                    at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) ~[BlockEventHandler.class:?]
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic) ~[?:?]
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
                    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?]
                    at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) [ForgeEventFactory.class:?]
                    at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) [Block.class:?]
                    at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) [Explosion.class:?]
                    at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) [WorldServer.class:?]
                    at net.minecraft.world.World.createExplosion(World.java:2655) [World.class:?]
                    at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) [EntityTNTPrimed.class:?]
                    at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) [EntityTNTPrimed.class:?]
                    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) [World.class:?]
                    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) [WorldServer.class:?]
                    at net.minecraft.world.World.updateEntity(World.java:2258) [World.class:?]
                    at net.minecraft.world.World.updateEntities(World.java:2108) [World.class:?]
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515) [WorldServer.class:?]
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) [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:?]
                    [22:34:13] [Server thread/ERROR] [FML]: Index: 1 Listeners:
                    [22:34:13] [Server thread/ERROR] [FML]: 0: NORMAL
                    [22:34:13] [Server thread/ERROR] [FML]: 1: ASM: com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler@5bb1b018 onDrops(Lnet/minecraftforge/event/world/BlockEvent$HarvestDropsEvent;)V
                    [22:34:13] [Server thread/ERROR]: Encountered an unexpected exception
                    net.minecraft.util.ReportedException: Ticking 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.NullPointerException
                    at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50) ~[BlockEventHandler.class:?]
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic) ~[?:?]
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
                    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?]
                    at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162) ~[ForgeEventFactory.class:?]
                    at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806) ~[Block.class:?]
                    at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221) ~[Explosion.class:?]
                    at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974) ~[WorldServer.class:?]
                    at net.minecraft.world.World.createExplosion(World.java:2655) ~[World.class:?]
                    at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98) ~[EntityTNTPrimed.class:?]
                    at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86) ~[EntityTNTPrimed.class:?]
                    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298) ~[World.class:?]
                    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684) ~[WorldServer.class:?]
                    at net.minecraft.world.World.updateEntity(World.java:2258) ~[World.class:?]
                    at net.minecraft.world.World.updateEntities(World.java:2108) ~[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
                    [22:34:13] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Family\Desktop\Java Modding\NewMechanicalCraft\eclipse\.\crash-reports\crash-2016-03-02_22.34.13-server.txt
                    [22:34:13] [Server thread/INFO]: Stopping server
                    [22:34:13] [Server thread/INFO]: Saving players
                    [22:34:13] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
                    // This doesn't make any sense!
                    
                    Time: 02/03/16 22:34
                    Description: Ticking entity
                    
                    java.lang.NullPointerException: Ticking entity
                    at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50)
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic)
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
                    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
                    at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162)
                    at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806)
                    at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221)
                    at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974)
                    at net.minecraft.world.World.createExplosion(World.java:2655)
                    at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98)
                    at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86)
                    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
                    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)
                    at net.minecraft.world.World.updateEntity(World.java:2258)
                    at net.minecraft.world.World.updateEntities(World.java:2108)
                    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)
                    
                    A detailed walkthrough of the error, its code path and all known details is as follows:
                    ---------------------------------------------------------------------------------------
                    
                    -- Head --
                    Stacktrace:
                    at com.google.SpyMan.Mechanicalcraft.common.Event.BlockEventHandler.onDrops(BlockEventHandler.java:50)
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_BlockEventHandler_onDrops_HarvestDropsEvent.invoke(.dynamic)
                    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
                    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
                    at net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ForgeEventFactory.java:162)
                    at net.minecraft.block.Block.dropBlockAsItemWithChance(Block.java:806)
                    at net.minecraft.world.Explosion.doExplosionB(Explosion.java:221)
                    at net.minecraft.world.WorldServer.newExplosion(WorldServer.java:974)
                    at net.minecraft.world.World.createExplosion(World.java:2655)
                    at net.minecraft.entity.item.EntityTNTPrimed.explode(EntityTNTPrimed.java:98)
                    at net.minecraft.entity.item.EntityTNTPrimed.onUpdate(EntityTNTPrimed.java:86)
                    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)
                    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)
                    at net.minecraft.world.World.updateEntity(World.java:2258)
                    
                    -- Entity being ticked --
                    Details:
                    Entity Type: PrimedTnt (net.minecraft.entity.item.EntityTNTPrimed)
                    Entity ID: 274
                    Entity Name: Block of TNT
                    Entity's Exact location: 7,50, 32,49, 192,49
                    Entity's Block location: World: (7,32,192), Chunk: (at 7,2,0 in 0,12; contains blocks 0,0,192 to 15,255,207), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
                    Entity's Momentum: -0,00, -0,00, 0,00
                    Stacktrace:
                    at net.minecraft.world.World.updateEntities(World.java:2108)
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
                    
                    -- Affected level --
                    Details:
                    Level name: TestGenOres
                    All players: 1 total; [EntityPlayerMP['SpyMan'/129, l='TestGenOres', x=7,54, y=33,00, z=194,64]]
                    Chunk stats: ServerChunkCache: 625 Drop: 0
                    Level seed: -7302235049456822426
                    Level generator: ID 00 - default, ver 1\. Features enabled: false
                    Level generator options:
                    Level spawn location: World: (-4,64,252), Chunk: (at 12,4,12 in -1,15; contains blocks -16,0,240 to -1,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
                    Level time: 11121 game time, 11121 day time
                    Level dimension: 0
                    Level storage version: 0x04ABD - Anvil
                    Level weather: Rain time: 3184 (now: false), thunder time: 115577 (now: false)
                    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
                    Stacktrace:
                    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)
                    
                    package com.google.SpyMan.Mechanicalcraft.common.Event;
                    
                    import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
                    
                    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                    import net.minecraft.init.Blocks;
                    import net.minecraft.item.ItemStack;
                    import net.minecraftforge.event.world.BlockEvent;
                    
                    public class BlockEventHandler
                    {
                      @SubscribeEvent
                      public void onDrops(BlockEvent.HarvestDropsEvent event)
                      {
                         if (event.block == Blocks.iron_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenIronOre, 2));
                         }
                         if (event.block == Blocks.gold_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenGoldOre, 2));
                         }
                         if (event.block == Blocks.lit_redstone_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenRedstoneOre, 2));
                         }
                         if (event.block == Blocks.redstone_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenRedstoneOre, 2));
                         }
                         if (event.block == Blocks.coal_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenCoalOre, 2));
                         }
                         if (event.block == Blocks.diamond_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenDiamondOre, 2));
                         }
                         if (event.block == Blocks.emerald_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenEmeraldOre, 2));
                         }
                         if (event.block == MechanicalCraft.copperOre && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenCopperOre, 2));
                         }
                         if (event.block == MechanicalCraft.tinOre && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenTinOre, 2));
                         }
                         if (event.block == Blocks.lapis_ore && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().getItem() == MechanicalCraft.redstoneDrill)
                         {
                            event.drops.clear();
                            event.drops.add(new ItemStack(MechanicalCraft.brokenLapisOre, 2));
                         }
                      }
                    }
                    
                    1 réponse Dernière réponse Répondre Citer 0
                    • AymericRedA Hors-ligne
                      AymericRed
                      dernière édition par

                      Comment ça tu la sort d’où ? C’est le fonction getIcon qui la sort, appelée par mc (sauf erreur de ma part, ai pas codé en 1.7.10 depuis trèèès longtemps)
                      Et pour le crash, je peux pas bien voir sans les numéros de ligne mais vérifies bien que évent.drops soit pas null.

                      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
                      • robin4002R Hors-ligne
                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                        dernière édition par

                        Je pense que vais mettre en place une nouvelle règle.
                        Le prochain qui met une balise code ou une balise java à l’intérieur d’une balise spoiler va se manger un ban. Idem pour le prochain qui poste des logs sans la balise code ou du code sans la balise java.

                        La balise code et la balise java ajoutent AUTOMATIQUEMENT un slider si le code est loin. Mettre une balise java ou code dans un spoiler aura juste pour effet d’avoir un rendu dégueulasse.
                        De même la balise java ajoute AUTOMATIQUEMENT les numéros de ligne et la couleur. C’était quoi ce message dégueulasse fait à base de quote de color, de b et de i ?

                        Bref, pour le crash tu as un npe sur la ligne 50, ce qui est étrange.
                        Ce que je te conseil c’est de faire un bloc
                        if(event.harvester.getHeldItem() != null)
                        {
                        }
                        et de mettre toutes les conditions dedans (et du-coup retirer ce if présent à chaque condition).

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

                          Désolé pour les balises j’avais oublier comme ça faisait longtemps que je n’avais posté de sujet 😕


                          Quand j’ai dit “la valeur du metadata” je pensais a comment je la fait varié en fonction du status de mon block.
                          Elle va pas détecter toute seul si mon block est en marche ou pas, sachant que isBurning() ne fonctionne pas


                          et sinon j’ai oublier de préciser le crash des events c’est uniquement quand les blocks sont cassé avec quelque chose d’autre qu’une pioche, la main ou mon items Ce qui fait crash: un creeper casse les blocks ou la tnt ou les mobs qui le peuvent

                          PS: ça ce fonctionne pas, ça crash encore 😕

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

                            C’est 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
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB