MFF

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

    OnItemRightClick sur une entity.

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    125 Messages 8 Publieurs 21.6k 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

      Merci! mais,
      Je définie le niveau d’alcool avec mon ancien système ?
      code:
      if (lvl != 0)
           lvl2 = Math.abs(lvl / 2);
         else if (lvl == 0) {
           lvl2 = Math.abs(lvl);
         }
         this.lvlS = Integer.toString(lvl2);

      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

        J’ai viré ça car j’ai pas réussi a comprendre l’intérêt x)  (Math.abs(0) ça fait 0, et puis sauf si ton niveau d’alcool peut se retrouver dans le négatif (wtf ?!?) il n’a pas d’intérêt non plus dans la première condition).
        Mais oui tu peux le remettre.

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

          Bah sinon donne moi un autre code car mon non plus j’ai pas compris mdr je les trouvé sur internet

          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

            x)
            GG
            Le code que je t’ai donné fonctionne normalement.

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

              crash: at com.AltisMine.mod.AT.func_111207_a(AT.java:32)
              ligne 32:
              stack.getTagCompound().setInteger(“level”, prop.getAlcool());

              EDIT:
              C’est je crois que j’ai trouvé .

              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

                Rapport de crash complet ?

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

                  –-- Minecraft Crash Report ----
                  // I let you down. Sorry :(
                  
                  Time: 24/12/15 00:06
                  Description: Unexpected error
                  
                  java.lang.NullPointerException: Unexpected error
                  at com.AltisMine.mod.AT.func_111207_a(AT.java:32)
                  at net.minecraft.item.ItemStack.func_111282_a(ItemStack.java:324)
                  at net.minecraft.entity.player.EntityPlayer.func_70998_m(EntityPlayer.java:1135)
                  at net.minecraft.client.multiplayer.PlayerControllerMP.func_78768_b(PlayerControllerMP.java:413)
                  at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1431)
                  at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1953)
                  at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)
                  at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
                  at net.minecraft.client.main.Main.main(SourceFile:148)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:483)
                  at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                  at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                  
                  A detailed walkthrough of the error, its code path and all known details is as follows:
                  ---------------------------------------------------------------------------------------
                  
                  -- Head --
                  Stacktrace:
                  at com.AltisMine.mod.AT.func_111207_a(AT.java:32)
                  at net.minecraft.item.ItemStack.func_111282_a(ItemStack.java:324)
                  at net.minecraft.entity.player.EntityPlayer.func_70998_m(EntityPlayer.java:1135)
                  at net.minecraft.client.multiplayer.PlayerControllerMP.func_78768_b(PlayerControllerMP.java:413)
                  at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1431)
                  
                  -- Affected level --
                  Details:
                  Level name: MpServer
                  All players: 3 total; [MCH_ViewEntityDummy['McHeliDummyEntity'/14, l='MpServer', x=677,50, y=66,62, z=153,50], EntityClientPlayerMP['floriangabet'/56, l='MpServer', x=696,27, y=73,62, z=1097,51], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=697,50, y=72,00, z=1098,72]]
                  Chunk stats: MultiplayerChunkCache: 71, 71
                  Level seed: 0
                  Level generator: ID 02 - largeBiomes, ver 0\. Features enabled: false
                  Level generator options:
                  Level spawn location: World: (677,64,153), Chunk: (at 5,4,9 in 42,9; contains blocks 672,0,144 to 687,255,159), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
                  Level time: 275531588 game time, 102350000 day time
                  Level dimension: 0
                  Level storage version: 0x00000 - Unknown?
                  Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
                  Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
                  Forced entities: 8 total; [EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=697,50, y=72,00, z=1098,72], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=718,63, y=73,00, z=1186,53], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=699,27, y=72,71, z=1130,01], EntityClientPlayerMP['floriangabet'/56, l='MpServer', x=696,27, y=73,62, z=1097,51], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=697,50, y=72,00, z=1098,72], EntityClientPlayerMP['floriangabet'/56, l='MpServer', x=746,45, y=72,62, z=1136,70], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=745,06, y=71,00, z=1134,88], EntityOtherPlayerMP['Mr_KIKI_72'/140, l='MpServer', x=739,08, y=73,12, z=1086,82]]
                  Retry entities: 0 total; []
                  Server brand: cauldron,craftbukkit,mcpc,fml,forge
                  Server type: Non-integrated multiplayer server
                  Stacktrace:
                  at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373)
                  at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2444)
                  at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:927)
                  at net.minecraft.client.main.Main.main(SourceFile:148)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:483)
                  at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                  at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                  
                  – System Details --
                  Details:
                  Minecraft Version: 1.7.10
                  Operating System: Windows 7 (amd64) version 6.1
                  Java Version: 1.8.0_25, Oracle Corporation
                  Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                  Memory: 626870992 bytes (597 MB) / 1430659072 bytes (1364 MB) up to 2134114304 bytes (2035 MB)
                  JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
                  AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                  IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 103
                  FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 Optifine OptiFine_1.7.10_HD_B7 23 mods loaded, 23 mods active
                  States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                  UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
                  UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1448-1.7.10.jar)
                  UCHIJA Forge{10.13.4.1448} [Minecraft Forge] (forge-1.7.10-10.13.4.1448-1.7.10.jar)
                  UCHIJA amm{1.0} [§aAltisMineMod] (AltisMineModV1.0(1.7.10).jar)
                  UCHIJA BiblioCraft{1.9.0} [BiblioCraft] (BiblioCraft[v1.9.0][MC1.7.10].jar)
                  UCHIJA AlcoholMod{1.5-Beta} [Alcohol Mod] (booze.jar)
                  UCHIJA CarpentersBlocks{3.2.5} [Carpenter's Blocks] (Carpenters-Blocks-Mod-1.7.10.zip)
                  UCHIJA chisel{1.5.7} [Chisel] (Chisel-1.7.10-1.5.7.jar)
                  UCHIJA customnpcs{1.7.10c} [CustomNpcs] (CustomNPCs_1.7.10c.jar)
                  UCHIJA PTRModelLib{1.0.0} [PTRModelLib] (Decocraft-2.1.1_1.7.10.jar)
                  UCHIJA props{2.1.1} [Decocraft] (Decocraft-2.1.1_1.7.10.jar)
                  UCHIJA Dynmap{2.2-143} [Dynmap] (Dynmap-2.2-forge-1.7.10.jar)
                  UCHIJA flansmod{4.10.0} [Flan's Mod] (Flans Mod.jar)
                  UCHIJA flenixcities{0.9.0} [FlenixCities] (FlenixCitiesCore_[1.7.10]-0.9.0.jar)
                  UCHIJA mcheli{0.10.7} [MC Helicopter] (mcheli)
                  UCHIJA Monoblocks{1.9.11} [§1M§2o§3n§4o§5b§6l§7o§8c§9k§as] (Monoblocks-1.9.11.jar)
                  UCHIJA MonoblocksMultipart{1.9.11} [MonoblocksMultipart] (Monoblocks-1.9.11.jar)
                  UCHIJA cfm{3.3.5} [§6MrCrayfish's Furniture Mod] (MrCrayfishs-Furniture-Mod-1.7.10.jar)
                  UCHIJA MumbleLink{4.1.1-2b3035b} [MumbleLink for Forge] (MumbleLink-1.7.10-4.1.1-2b3035b.jar)
                  UCHIJA ExtendedPASupport{1.0.0-2b3035b} [ExtendedPASupport for MumbleLink] (MumbleLink-1.7.10-4.1.1-2b3035b.jar)
                  UCHIJA pseudoeraser{0.1} [Pseudo' Eraser] (Pseudo' Eraser v0.1 - 1.7.10.jar)
                  UCHIJA RopesPlus{1.6.3} [Ropes+] (Ropes-Plus-Mod-1.7.10.jar)
                  UCHIJA thirstmod{1.8.8} [Thirst Mod] (thirstmod-1.8.8.jar)
                  Launched Version: 1.7.10-Forge10.13.4.1448-1.7.10
                  LWJGL: 2.9.1
                  OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 355.82, NVIDIA Corporation
                  GL Caps: Using GL 1.3 multitexturing.
                  Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                  Anisotropic filtering is supported and maximum anisotropy is 16.
                  Shaders are available because OpenGL 2.1 is supported.
                  
                  Is Modded: Definitely; Client brand changed to 'fml,forge'
                  Type: Client (map_client.txt)
                  Resource Packs: []
                  Current Language: English (US)
                  Profiler Position: N/A (disabled)
                  Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                  Anisotropic Filtering: Off (1)
                  

                  Au fait j’ai pas trouvé pour le crash.

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

                    Tu as enregistré ton ExtendedEntityPropAlcool ?

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

                      J’ai rien régister c’est ou que je dois le register ?

                      EDIT: J’ai mis ça dans la class principale :

                           FMLCommonHandler.instance().bus().register(new ExtendedEntityPropAlcool(null));
                      
                          MinecraftForge.EVENT_BUS.register(new ExtendedEntityPropAlcool(null));
                      
                      1 réponse Dernière réponse Répondre Citer 0
                      • BrokenSwingB Hors-ligne
                        BrokenSwing Moddeurs confirmés Rédacteurs
                        dernière édition par

                        Euh …. Fait plus ça s’il te plaît

                        Je crois qu’il voulait parler de l’event EntityEvent.EntityConstructing

                        **EDIT : ** ou pas xD

                        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 pas du tout comme ça qu’il faut l’enregistrer. Il faut passer par l’event EntityEvent.EntityConstructing.

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

                            Peut-etre mieux non?

                               @SubscribeEvent
                            public void onEntityConstructing(EntityConstructing event) 
                            {
                            if (event.entity instanceof EntityPlayer && ExtendedEntityPropAlcool.get((EntityPlayer) event.entity) == null)
                            ExtendedEntityPropAlcool.register((EntityPlayer) event.entity);
                            }
                            
                            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

                              Oui. Tu as bien mit cette ligne dans une classe que tu as enregistré avec MinecraftForge.EVENT_BUS.register(new NomDeLaClasse()); ?

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

                                Alors oui mais je les mis dans ExtendedEntityPropAlcool c’est pas grave ?

                                car j’ai une érreur sur le: [font=Ubuntu, sans-serif```java
                                MinecraftForge.EVENT_BUS.register(new ExtendedEntityPropAlcool());

                                [font=Ubuntu, sans-serifil me demande de vire le EntityPlayer de cette ligne (cette ligne est dans le ExtendedEntityPropAlcool):]
                                [font=Ubuntu, sans-serif```java
                                  public ExtendedEntityPropAlcool*(***EntityPlayer player***)* {]
                                [font=Ubuntu, sans-serif}
                                ```]
                                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

                                  Fait une autre classe nommé EntityEvent, ça sera mieux.

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

                                    Ouaip merci j’essaye ça je vous dis.

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

                                      Crash réglé mais quand un joueur boit et que j’interagi avec le clic droit sa m’indique 0 et quand on inverse c’est pareil 0 aussi.

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

                                        Tu as bien changé le code dans les autres items ?

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

                                          J’ai j’ai changer la class At qui permet de prendre le niveau d’alcool par contre j’ai pas touché a la class LIIT qui est la class pour les boissons d’alcool est donc normalement ajouté le niveau d’alcool .

                                          package com.AltisMine.mod;
                                          
                                          import net.minecraft.entity.player.EntityPlayer;
                                          import net.minecraft.item.EnumAction;
                                          import net.minecraft.item.ItemFood;
                                          import net.minecraft.item.ItemStack;
                                          import net.minecraft.potion.Potion;
                                          import net.minecraft.potion.PotionEffect;
                                          import net.minecraft.world.World;
                                          
                                          public class LIIT extends ItemFood {
                                          
                                           AT alcohol = new AT();
                                          
                                          public LIIT (int itemID, int i, boolean b)
                                           {
                                             super(itemID, i, b);
                                          
                                          }
                                          
                                           public EnumAction getItemUseAction(ItemStack itemstack)
                                           {
                                             return EnumAction.drink;
                                           }
                                             public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
                                             {
                                                 if (player.canEat(true))
                                                 {
                                                     player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
                                                 }
                                                 return stack;
                                             }
                                          
                                             public int getMaxItemUseDuration(ItemStack stack)
                                             {
                                                 return 32;
                                             }
                                          
                                             public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player)
                                             {
                                                 –stack.stackSize;
                                                 ExtendedEntityPropAlcool.alcoolvl = Math.abs(ExtendedEntityPropAlcool.alcoolvl +1);
                                                 player.getFoodStats().addStats(1, 2); // nombre de demi-gigots + saturation
                                                 world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
                                                 player.addPotionEffect(new PotionEffect(Potion.confusion.id, 315,0));
                                                 player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 315,0));
                                                 player.addPotionEffect(new PotionEffect(Potion.hunger.id, 315,0));
                                                 player.addPotionEffect(new PotionEffect(Potion.weakness.id, 315,0));
                                          return stack;
                                             }
                                             @Override
                                           public boolean hasEffect(ItemStack par1ItemStack){
                                            return true;
                                           }
                                          
                                          }
                                          
                                          
                                          1 réponse Dernière réponse Répondre Citer 0
                                          • BrokenSwingB Hors-ligne
                                            BrokenSwing Moddeurs confirmés Rédacteurs
                                            dernière édition par

                                            ExtendedEntityPropAlcool prop = ExtendedEntityPropAlcool.get(player);
                                            prop.setAlcool(prop.getAlcool() + 1);
                                            
                                            1 réponse Dernière réponse Répondre Citer 1
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 1 / 7
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB