MFF

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

    Temps de recharge dans un onRightClickEvent

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.10.x
    49 Messages 5 Publieurs 6.8k 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.
    • GabsG Hors-ligne
      Gabs
      dernière édition par

      @‘SCAREX’:

      Maintenant tu dois accéder à cette valeur lorsque tu frappes avec ton item (il y a une fonction pour ça)

      La fonction c’est hitentity non?

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

        Tout dépend de ce que tu veux faire, si c’est infliger des dégâts de feu oui

        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
        • GabsG Hors-ligne
          Gabs
          dernière édition par

          @‘SCAREX’:

          Tout dépend de ce que tu veux faire, si c’est infliger des dégâts de feu oui

          Oui voila je veux augmenter les dégats de un seul coup d’épée de 10 quand mon timer et a 0

          public boolean hitEntity(ItemStack stack, EntityLivingBase base1,
          EntityLivingBase base2){
          if (!stack.hasTagCompound())// Même condition, si ton item n'a pas de tag
          // on lui en ajoute avec l'int timer en +
          {
          stack.setTagCompound(new NBTTagCompound());
          stack.stackTagCompound.setInteger("timer", 0);
          }
          if (stack.stackTagCompound.getInteger("timer") == 0){
          
          base2.attackEntityFrom(DamageSource.inFire, 10);
          stack.stackTagCompound.setInteger("timer", 1);
          }
          return true;
          }
          
          1 réponse Dernière réponse Répondre Citer 0
          • DeletedD Hors-ligne
            Deleted
            dernière édition par

            • [font=monospaceif] font=monospace
              Inutile puisque la fonction onupdate sera fired dès le premier tick, donc bien avant que tu n’aies le temps de frapper une entity avec. Ce qui veut dire, que ton itemstack aura depuis bien longtemps associer des tags. Tu peux donc virer toute la condition et ce qui en résultat (setTagCompound() et setInteger())
            • Et pour ta fonction onUpdate, peux-tu nous la renvoyer avec du code bien formaté et propre, et sans les commentaires, on n’en a pas besoin …
            • Et dernière chose, indiquer que le damagesource de la méthode attackEntityFrom est celui du feu, ne veut pas dire que ton entity sera en feu, hein ?! Si tu souhaites lui faire des dégâts liés à un damagesource fire (10 demie-cœurs de dégâts, à ce que je vois), mais que tu veux aussi mettre l’entity en feu, rajoute un setFire(durée en ticks)
            1 réponse Dernière réponse Répondre Citer 0
            • GabsG Hors-ligne
              Gabs
              dernière édition par

              D’accord ^^ j’avais pas compris ok
              tien pour le onupdate:

              
              @Override
              public void onUpdate(ItemStack item, World world, Entity player,
              int slotIndex, boolean inHand) {
              if (item.hasTagCompound())
              {
              if (item.stackTagCompound.getInteger("timer") > 0)
              {
              item.stackTagCompound.setInteger("timer",
              (int) (item.stackTagCompound.getInteger("timer") + 1));
              }
              if (item.stackTagCompound.getInteger("timer") >= (int) (45 * 20))
              {
              item.stackTagCompound.setInteger("timer", 0);
              }
              }
              super.onUpdate(item, world, player, slotIndex, inHand);
              }
              
              

              edit:

              meme après avoir fait se que tu m’as dis je met toujours autant de coup pour tuer le pigman et il n’est pas en feu:

              
              public boolean hitEntity(ItemStack stack, EntityLivingBase base1,
              EntityLivingBase base2){
              
              if (stack.stackTagCompound.getInteger("timer") == 0){
              
              base2.attackEntityFrom(DamageSource.inFire, 10);
              base2.setFire(20);
              }
              return true;
              }
              
              1 réponse Dernière réponse Répondre Citer 0
              • DeletedD Hors-ligne
                Deleted
                dernière édition par

                Pas testé mais ça devrait marcher, je pense :

                
                public class ItemTestSword extends ItemSword
                {
                
                public ItemTestSword()
                {
                super(ToolMaterial.EMERALD);
                }
                
                public void onUpdate(ItemStack stack, World world, Entity entity, int slotIndex, boolean isInhand)
                {
                super.onUpdate(stack, world, entity, slotIndex, isInhand);
                if(!stack.hasTagCompound())
                stack.setTagCompound(new NBTTagCompound());
                
                int timer = !stack.getTagCompound().hasKey("timer") ? 0 : stack.getTagCompound().getInteger("timer");
                timer++;
                stack.getTagCompound().setInteger("timer", timer);
                
                System.out.println(stack.getTagCompound().getInteger("timer"));
                }
                
                public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                {
                if(stack.getTagCompound().getInteger("timer") >= 2 * 20)
                {
                target.setFire(1 * 20);
                target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                stack.getTagCompound().setInteger("timer", 0);
                }
                return true;
                }
                }
                
                
                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

                  print la valeur de stack.stackTagCompound.getInteger(“timer”)
                  Et actuellement ton tag n’est plus jamais créé s’il n’existe pas.

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

                    Non bizarre rien

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

                      Ah j’ai pas fait attention mais remplace le 2*20 par le nombre de ticks que tu souhaitais, et normal que tu ne vois pas le feu sur les pigmans, ils sont immunisés –’
                      Print (comme l’a si bien dit robin), la valeur timer enregistrée dans les tags

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

                        Ah c’est bon!

                        Par contre crash !

                        
                        [18:34:58] [main/INFO] [GradleStart]: username: floriangabet
                        [18:34:58] [main/INFO] [GradleStart]: Extra: []
                        [18:34:58] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --username, floriangabet, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
                        [18:34:58] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
                        [18:34:58] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading
                        [18:34:58] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre
                        [18:34:58] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
                        [18:34:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
                        [18:34:58] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
                        [18:34:58] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
                        [18:34:58] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [18:34:58] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                        [18:34:58] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
                        [18:34:59] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
                        [18:34:59] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                        [18:34:59] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
                        [18:34:59] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                        [18:34:59] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
                        [18:34:59] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
                        [18:34:59] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
                        [18:34:59] [main/INFO]: Setting user: floriangabet
                        [18:35:00] [Client thread/INFO]: LWJGL Version: 2.9.1
                        [18:35:00] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
                        [18:35:00] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized
                        [18:35:00] [Client thread/INFO] [FML]: Replaced 183 ore recipies
                        [18:35:00] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
                        [18:35:00] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\mods for mods
                        [18:35:00] [Client thread/INFO] [lc]: Mod lc is missing the required element 'name'. Substituting lc
                        [18:35:02] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
                        [18:35:02] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at CLIENT
                        [18:35:02] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, lc] at SERVER
                        [18:35:02] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip
                        [18:35:02] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
                        [18:35:02] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations
                        [18:35:02] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
                        [18:35:02] [Client thread/INFO] [FML]: Applying holder lookups
                        [18:35:02] [Client thread/INFO] [FML]: Holder lookups applied
                        [18:35:02] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:02] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem…
                        [18:35:02] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL
                        [18:35:02] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
                        [18:35:02] [Thread-5/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.
                        [18:35:03] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:03] [Sound Library Loader/INFO]: Sound engine started
                        [18:35:05] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas
                        [18:35:05] [Client thread/INFO]: Created: 256x256 textures/items-atlas
                        [18:35:05] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
                        [18:35:05] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:lc, [1.10] Firewolf v1.36.zip
                        [18:35:07] [Client thread/INFO]: Created: 2048x2048 textures/blocks-atlas
                        [18:35:07] [Client thread/INFO]: Created: 256x256 textures/items-atlas
                        [18:35:07] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:07] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down…
                        [18:35:08] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]:     Author: Paul Lamb, www.paulscode.com
                        [18:35:08] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:08] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:08] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem…
                        [18:35:08] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL
                        [18:35:08] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
                        [18:35:08] [Thread-7/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.
                        [18:35:08] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: 
                        [18:35:08] [Sound Library Loader/INFO]: Sound engine started
                        [18:35:10] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
                        [18:35:10] [Server thread/INFO]: Generating keypair
                        [18:35:10] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance
                        [18:35:10] [Server thread/INFO] [FML]: Injecting new block and item data into this server instance.
                        [18:35:10] [Server thread/INFO] [FML]: Injected new block/item lc:test: 4098 (init) -> 4098 (map).
                        [18:35:10] [Server thread/INFO] [FML]: Applying holder lookups
                        [18:35:10] [Server thread/INFO] [FML]: Holder lookups applied
                        [18:35:11] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@115f9ec)
                        [18:35:11] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@115f9ec)
                        [18:35:11] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@115f9ec)
                        [18:35:11] [Server thread/INFO]: Preparing start region for level 0
                        [18:35:11] [Server thread/INFO]: Changing view distance to 8, from 10
                        [18:35:12] [Netty Client IO #0/INFO] [FML]: Server protocol version 1
                        [18:35:12] [Netty IO #1/INFO] [FML]: Client protocol version 1
                        [18:35:12] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,lc@1.0,Forge@10.13.2.1291,mcp@9.05
                        [18:35:12] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT
                        [18:35:12] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER
                        [18:35:12] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established
                        [18:35:12] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
                        [18:35:12] [Server thread/INFO]: floriangabet[local:E:cfdfeea9] logged in with entity id 353 at (-136.6903569380041, 76.0, 272.62722809298504)
                        [18:35:12] [Server thread/INFO]: floriangabet joined the game
                        [18:35:27] [Server thread/ERROR]: Encountered an unexpected exception
                        net.minecraft.util.ReportedException: Ticking memory connection
                        at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]
                        at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[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 net.legacymod.items.test.hitEntity(test.java:33) ~[test.class:?]
                        at net.minecraft.item.ItemStack.hitEntity(ItemStack.java:371) ~[ItemStack.class:?]
                        at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1436) ~[EntityPlayer.class:?]
                        at net.minecraft.network.NetHandlerPlayServer.processUseEntity(NetHandlerPlayServer.java:881) ~[NetHandlerPlayServer.class:?]
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:51) ~[C02PacketUseEntity.class:?]
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:69) ~[C02PacketUseEntity.class:?]
                        at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]
                        at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]
                        … 5 more
                        [18:35:27] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Admin\Documents\Modding\LegacyMod\eclipse\.\crash-reports\crash-2016-07-05_18.35.27-server.txt
                        [18:35:27] [Server thread/INFO]: Stopping server
                        [18:35:27] [Server thread/INFO]: Saving players
                        [18:35:27] [Server thread/INFO]: Saving worlds
                        [18:35:27] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
                        [18:35:27] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
                        // Quite honestly, I wouldn't worry myself about that.
                        
                        Time: 05/07/16 18:35
                        Description: Ticking memory connection
                        
                        java.lang.NullPointerException: Ticking memory connection
                        at net.legacymod.items.test.hitEntity(test.java:33)
                        at net.minecraft.item.ItemStack.hitEntity(ItemStack.java:371)
                        at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1436)
                        at net.minecraft.network.NetHandlerPlayServer.processUseEntity(NetHandlerPlayServer.java:881)
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:51)
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:69)
                        at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                        at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
                        at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
                        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 net.legacymod.items.test.hitEntity(test.java:33)
                        at net.minecraft.item.ItemStack.hitEntity(ItemStack.java:371)
                        at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1436)
                        at net.minecraft.network.NetHandlerPlayServer.processUseEntity(NetHandlerPlayServer.java:881)
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:51)
                        at net.minecraft.network.play.client.C02PacketUseEntity.processPacket(C02PacketUseEntity.java:69)
                        at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                        
                        -- Ticking connection --
                        Details:
                        Connection: net.minecraft.network.NetworkManager@b84446
                        Stacktrace:
                        at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
                        at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
                        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)
                        
                        -- System Details --
                        Details:
                        Minecraft Version: 1.7.10
                        Operating System: Windows 7 (x86) version 6.1
                        Java Version: 1.8.0_45, Oracle Corporation
                        Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
                        Memory: 812637320 bytes (774 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
                        JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                        AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                        IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
                        FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active
                        mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                        FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                        Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                        lc{1.0} [lc] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                        Profiler Position: N/A (disabled)
                        Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                        Player Count: 1 / 8; [EntityPlayerMP['floriangabet'/353, l='New World', x=-128,64, y=76,00, z=268,90]]
                        Type: Integrated Server (map_client.txt)
                        Is Modded: Definitely; Client brand changed to 'fml,forge'
                        [18:35:27] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2016-07-05_18.35.27-server.txt
                        [18:35:27] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
                        [18:35:27] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
                        [18:35:27] [Server thread/INFO]: Saving chunks for level 'New World'/The End
                        [18:35:27] [Server thread/INFO] [FML]: Unloading dimension 0
                        [18:35:27] [Server thread/INFO] [FML]: Unloading dimension -1
                        [18:35:27] [Server thread/INFO] [FML]: Unloading dimension 1
                        [18:35:27] [Server thread/INFO] [FML]: Applying holder lookups
                        [18:35:27] [Server thread/INFO] [FML]: Holder lookups applied
                        [18:35:27] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
                        [18:35:27] [Client thread/INFO] [FML]: Server terminated.
                        AL lib: (EE) alc_cleanup: 1 device not closed
                        Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
                        
                        

                        Ligne 33 de test correspond à:

                        
                        public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                           {
                            if(stack.getTagCompound().getInteger("timer2") >= 2 * 20) // ici
                            {
                            target.setFire(20 * 20);
                            target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                            stack.getTagCompound().setInteger("timer2", 0);
                            }
                               return true;
                           }
                        
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • DeletedD Hors-ligne
                          Deleted
                          dernière édition par

                          Pourquoi t’as renommé l’id par timer2 ? T’as sûrement dû laisser timer dans onUpdate()

                          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

                            getInteger(“valeur inexistante”) renvoie 0 et non null.
                            C’est stack.getTagCompound() qui renvoie null.

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

                              Bizarre car si il a repris la méthode onUpdate() que je lui avais proposé, ça ne devrait pas arriver

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

                                Exact ça marche j’ai mal copier coller x)

                                Mais le problème et que sa met en feu le cochon a chaque coup et moi il faudrait que il y est un temps de recharge de par exemple 30s possible ?

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

                                  Change le 2 * 20 par 30 * 20

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

                                    Ouais nickel! par contre j’ai un problème quand je met mon code dans une autre classe avec un autre timer mon "sors ne se lance jamais.
                                    Je pense que je le fait que il y est deux fonction onupdate dans la même classe fait un conflit et mon second timer ne marche pas ( celui avec le hitentity )

                                    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

                                      Code ?

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

                                        Tien:

                                        
                                        public class epee extends ItemSword {
                                        
                                        public epee(ToolMaterial p_i45356_1_) {
                                        super(p_i45356_1_);
                                        }
                                        @Override
                                        public void onUpdate(ItemStack item, World world, Entity player,
                                        int slotIndex, boolean inHand) {
                                        if (item.hasTagCompound())
                                        {
                                        if (item.stackTagCompound.getInteger("timer2") > 0)
                                        {
                                        item.stackTagCompound.setInteger("timer2",
                                        (int) (item.stackTagCompound.getInteger("timer2") + 1));
                                        }
                                        if (item.stackTagCompound.getInteger("timer2") >= (int) (45 * 20))
                                        {
                                        item.stackTagCompound.setInteger("timer2", 0);
                                        }
                                        }
                                        super.onUpdate(item, world, player, slotIndex, inHand);
                                        }
                                        
                                        public ItemStack onItemRightClick(ItemStack item, World world,
                                        EntityPlayer player) {
                                        if (!item.hasTagCompound())
                                        {
                                        item.setTagCompound(new NBTTagCompound());
                                        item.stackTagCompound.setInteger("timer2", 0);
                                        }
                                        if (item.stackTagCompound.getInteger("timer2") == 0
                                        && ServerProxy.RANK.get(player.getUniqueID()) == EnumRank.GUERRIER) {
                                        player.addPotionEffect(new PotionEffect(Potion.digSpeed.id,
                                        600, 0));
                                        item.stackTagCompound.setInteger("timer2", 1);// On le met à 1 pour
                                        // pouvoir rentrer
                                        // dans la condition
                                        // de onUpdate()
                                        world.playSoundAtEntity(player, "sounds/fireworks/blast_far1", 1, 1);
                                        // world.spawnParticle("smoke", (double)(player.posX),
                                        // (double)(player.posY), (double)(player.posZ), 0.0D, 0.0D, 0.0D);
                                        } else {
                                        if (world.isRemote)
                                        player.addChatComponentMessage(new ChatComponentTranslation(
                                        "Tu dois attendre que le sort se recharge !"));// On
                                        // indique
                                        // au
                                        // joueur
                                        // via
                                        // ce
                                        // message
                                        // si le
                                        // timer
                                        // n'est
                                        // pas
                                        // encore
                                        // arrivé
                                        // à la
                                        // limite
                                        // souhaitée
                                        }
                                        return item;
                                        }
                                        
                                        @SideOnly(Side.CLIENT)
                                        public boolean hasEffect(ItemStack item)
                                        {
                                        return item.hasTagCompound() ? (item.stackTagCompound.getInteger("timer2")
                                        == 0 ? true : false) : false;//On vérifie déjà si l'ItemStack a set un
                                        // NBTTagCompound si oui, on vérifie si Timer en fait partie et si il est
                                        //égal à 0, si oui, on return true à la méthode
                                        }
                                        
                                        public void addInformation(ItemStack item, EntityPlayer player, List list,
                                        boolean par4) {
                                        if(ServerProxy.RANK.get(player.getUniqueID()) == EnumRank.GUERRIER){
                                        list.add("§6Epee de guerrier !");
                                        list.add("§6Seul les plus puissants,");
                                        list.add("§6peuvent porter cette arme !");
                                        }else{
                                        list.add("§cVous n'êtes pas Guerrier");
                                        list.add("§cvous ne devez pas avoir");
                                        list.add("§ccette épée sur vous!");
                                        }
                                        }
                                        
                                        public void onUpdate2(ItemStack stack, World world, Entity entity, int slotIndex, boolean isInhand)
                                        {
                                        super.onUpdate(stack, world, entity, slotIndex, isInhand);
                                        if(!stack.hasTagCompound())
                                        stack.setTagCompound(new NBTTagCompound());
                                        
                                        int timer = !stack.getTagCompound().hasKey("timer") ? 0 : stack.getTagCompound().getInteger("timer");
                                        timer++;
                                        stack.getTagCompound().setInteger("timer", timer);
                                        
                                        System.out.println(stack.stackTagCompound.getInteger("timer"));
                                        }
                                        
                                            public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                                            {
                                            if(stack.getTagCompound().getInteger("timer") >= 30 * 20 && ClientProxy.keyBindSortG.isPressed())
                                            {
                                            target.setFire(20 * 20);
                                            target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                                            stack.getTagCompound().setInteger("timer", 0);
                                            System.out.println("§c[Sort] §8Frappe foudroyante lancée!");
                                            EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                                        ChatComponentText text1 = new ChatComponentText("§c[Sort] §8Frappe foudroyante lancée!");
                                        player1.addChatComponentMessage(text1);
                                        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
                                                MinecraftServer.getServer().getCommandManager().executeCommand(player, "weather lightning");
                                            }else if (stack.getTagCompound().getInteger("timer") != 30 * 20 && ClientProxy.keyBindSortG.isPressed()){
                                            System.out.println("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                                            EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                                        ChatComponentText text1 = new ChatComponentText("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                                        player1.addChatComponentMessage(text1);
                                            }
                                                return true;
                                            }
                                        
                                        }
                                        
                                        
                                        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

                                          Ta fonction onUpdate2 n’est jamais appelé.

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

                                            Ah bon?

                                            pour quoi alors dans cette classe ça marche ?

                                            
                                            public class test extends ItemSword{
                                            
                                            private static Minecraft mc;
                                            
                                            public test(ToolMaterial p_i45356_1_) {
                                            super(p_i45356_1_);
                                            // TODO Auto-generated constructor stub
                                            }
                                            
                                            public void onUpdate2(ItemStack stack, World world, Entity entity, int slotIndex, boolean isInhand)
                                            {
                                            super.onUpdate(stack, world, entity, slotIndex, isInhand);
                                            if(!stack.hasTagCompound())
                                            stack.setTagCompound(new NBTTagCompound());
                                            
                                            int timer = !stack.getTagCompound().hasKey("timer") ? 0 : stack.getTagCompound().getInteger("timer");
                                            timer++;
                                            stack.getTagCompound().setInteger("timer", timer);
                                            
                                            // System.out.println(stack.stackTagCompound.getInteger("timer"));
                                            }
                                            
                                               public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
                                               {
                                                if(stack.getTagCompound().getInteger("timer") >= 30 * 20 && ClientProxy.keyBindSortG.isPressed())
                                                {
                                                target.setFire(20 * 20);
                                                target.attackEntityFrom(DamageSource.inFire, 5 * 2);
                                                stack.getTagCompound().setInteger("timer", 0);
                                                System.out.println("§c[Sort] §8Frappe foudroyante lancée!");
                                                EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                                            ChatComponentText text1 = new ChatComponentText("§c[Sort] §8Frappe foudroyante lancée!");
                                            player1.addChatComponentMessage(text1);
                                                }else if (stack.getTagCompound().getInteger("timer") != 30 * 20 && ClientProxy.keyBindSortG.isPressed()){
                                                System.out.println("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                                                EntityPlayer player1 = Minecraft.getMinecraft().thePlayer;
                                            ChatComponentText text1 = new ChatComponentText("§c[Erreur] §7Tu dois attendre que le sors se recharge! ");
                                            player1.addChatComponentMessage(text1);
                                                }
                                                   return true;
                                               }
                                            
                                            }
                                            
                                            

                                            Je n’ai pourtant rien changer

                                            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