MFF

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

    Ajouter des NBT TAG a des tile entity

    Planifier Épinglé Verrouillé Déplacé Résolu 1.11.x
    1.11.x
    40 Messages 5 Publieurs 6.7k 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.
    • DeletedD Hors-ligne
      Deleted
      dernière édition par

      Salut,
      Le soucis dans ta fonction onBlockActivated et onMessage (du packet), c’est qu’à chaque fois tu fais un new TileEntityBlockVault, donc finalement des instances de te, tu en as plein.
      Or toi ici tu cherches à ne te servir que d’une seule instance, il faudrait donc opter pour World#getTileEntity pour instancier la te.

      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

        Il manque la balise de version.

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

          @robin4002:

          Il manque la balise de version.

          Oups désolé robin ^^

          @Plaigon:

          Salut,
          Le soucis dans ta fonction onBlockActivated et onMessage (du packet), c’est qu’à chaque fois tu fais un new TileEntityBlockVault, donc finalement des instances de te, tu en as plein.
          Or toi ici tu cherches à ne te servir que d’une seule instance, il faudrait donc opter pour World#getTileEntity pour instancier la te.

          Yep merci j’ai changé x) C’était une bête erreur, comme d’hab mais du coup j’ai un crash, nullPointerException mais je vois pas pourquoi Oo

          [00:12:59] [Client thread/FATAL]: Unreported exception thrown!
          java.lang.NullPointerException
          at fr.fifou.economy.blocks.blockVault.onBlockActivated(blockVault.java:64) ~[blockVault.class:?]
          at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442) ~[PlayerControllerMP.class:?]
          at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1606) ~[Minecraft.class:?]
          at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2276) ~[Minecraft.class:?]
          at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2053) ~[Minecraft.class:?]
          at net.minecraft.client.Minecraft.runTick(Minecraft.java:1841) ~[Minecraft.class:?]
          at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1119) ~[Minecraft.class:?]
          at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?]
          at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
          at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
          at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
          at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
          at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
          at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
          at GradleStart.main(GradleStart.java:26) [start/:?]
          [00:12:59] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: –-- Minecraft Crash Report ----
          // I let you down. Sorry :(
          
          Time: 6/29/17 12:12 AM
          Description: Unexpected error
          
          java.lang.NullPointerException: Unexpected error
          at fr.fifou.economy.blocks.blockVault.onBlockActivated(blockVault.java:64)
          at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442)
          at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1606)
          at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2276)
          at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2053)
          at net.minecraft.client.Minecraft.runTick(Minecraft.java:1841)
          at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1119)
          at net.minecraft.client.Minecraft.run(Minecraft.java:407)
          at net.minecraft.client.main.Main.main(Main.java:118)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
          at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
          at GradleStart.main(GradleStart.java:26)
          
          A detailed walkthrough of the error, its code path and all known details is as follows:
          ---------------------------------------------------------------------------------------
          
          -- Head --
          Thread: Client thread
          Stacktrace:
          at fr.fifou.economy.blocks.blockVault.onBlockActivated(blockVault.java:64)
          at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442)
          at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1606)
          at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2276)
          at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2053)
          
          -- Affected level --
          Details:
          Level name: MpServer
          All players: 1 total; [EntityPlayerSP['Fifou_BE'/8237, l='MpServer', x=1.19, y=63.00, z=-0.09]]
          Chunk stats: MultiplayerChunkCache: 562, 562
          Level seed: 0
          Level generator: ID 00 - default, ver 1\. Features enabled: false
          Level generator options:
          Level spawn location: World: (85,64,203), Chunk: (at 5,4,11 in 5,12; contains blocks 80,0,192 to 95,255,207), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
          Level time: 3173 game time, 3173 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: creative (ID 1). Hardcore: false. Cheats: false
          Forced entities: 123 total; [EntityEnderman['Enderman'/8448, l='MpServer', x=16.50, y=41.00, z=-45.50], EntityZombie['Zombie'/8455, l='MpServer', x=80.50, y=46.00, z=-0.50], EntitySkeleton['Skeleton'/8473, l='MpServer', x=-72.21, y=29.00, z=-68.50], EntitySpider['Spider'/8477, l='MpServer', x=42.50, y=46.00, z=-39.50], EntityCreeper['Creeper'/8478, l='MpServer', x=35.50, y=45.00, z=-42.50], EntitySkeleton['Skeleton'/8479, l='MpServer', x=33.50, y=46.00, z=-40.50], EntityCreeper['Creeper'/8480, l='MpServer', x=38.50, y=46.00, z=-38.50], EntitySheep['Sheep'/8481, l='MpServer', x=40.50, y=66.00, z=-33.50], EntitySheep['Sheep'/8482, l='MpServer', x=41.50, y=67.00, z=-35.50], EntityZombie['Zombie'/8483, l='MpServer', x=66.49, y=43.77, z=-47.46], EntityChicken['Chicken'/8484, l='MpServer', x=61.87, y=70.00, z=-48.33], EntityItem['item.tile.flower1.dandelion'/8485, l='MpServer', x=51.18, y=64.00, z=-52.43], EntitySheep['Sheep'/8486, l='MpServer', x=42.50, y=70.00, z=-27.50], EntitySheep['Sheep'/8487, l='MpServer', x=36.74, y=70.00, z=-24.81], EntityItem['item.tile.torch'/8488, l='MpServer', x=59.38, y=44.00, z=-32.64], EntityChicken['Chicken'/8489, l='MpServer', x=60.12, y=72.00, z=-38.62], EntityChicken['Chicken'/8490, l='MpServer', x=58.36, y=71.00, z=-42.31], EntityChicken['Chicken'/8491, l='MpServer', x=57.50, y=71.00, z=-42.50], EntityZombie['Zombie'/7980, l='MpServer', x=-52.51, y=14.00, z=7.74], EntityItem['item.tile.rail'/8492, l='MpServer', x=36.20, y=46.00, z=-51.56], EntityZombie['Zombie'/7981, l='MpServer', x=-49.50, y=14.00, z=9.50], EntityItem['item.tile.rail'/8493, l='MpServer', x=37.28, y=46.00, z=-50.23], EntityCreeper['Creeper'/7982, l='MpServer', x=-53.50, y=32.00, z=9.50], EntityItem['item.item.sulphur'/8494, l='MpServer', x=38.07, y=39.00, z=-5.06], EntitySquid['Squid'/7983, l='MpServer', x=-48.16, y=57.62, z=0.84], EntityItem['item.item.bone'/8495, l='MpServer', x=38.65, y=39.00, z=-6.02], EntitySquid['Squid'/7984, l='MpServer', x=-57.86, y=57.27, z=15.07], EntityItem['item.item.ingotIron'/8496, l='MpServer', x=38.46, y=39.00, z=-5.28], EntityItem['item.item.wheat'/8497, l='MpServer', x=38.65, y=39.00, z=-6.19], EntityItem['item.item.coal'/8498, l='MpServer', x=38.30, y=39.00, z=-4.48], EntityItem['item.item.bone'/8499, l='MpServer', x=39.08, y=39.00, z=-4.45], EntityItem['item.item.saddle'/8500, l='MpServer', x=38.27, y=39.00, z=-5.14], EntityItem['item.item.record'/8501, l='MpServer', x=38.28, y=39.00, z=-5.94], EntityItem['item.item.coal'/8502, l='MpServer', x=38.73, y=39.00, z=-5.74], EntityItem['item.item.sulphur'/8503, l='MpServer', x=37.47, y=39.00, z=-5.94], EntitySkeleton['Skeleton'/8504, l='MpServer', x=42.50, y=39.00, z=-7.50], EntityBat['Bat'/8506, l='MpServer', x=44.77, y=47.00, z=-68.25], EntitySkeleton['Skeleton'/7995, l='MpServer', x=-33.50, y=17.00, z=6.50], EntityItem['item.tile.torch'/8507, l='MpServer', x=52.57, y=40.00, z=-5.03], EntitySquid['Squid'/7996, l='MpServer', x=-33.31, y=47.74, z=29.39], EntitySquid['Squid'/7997, l='MpServer', x=-46.60, y=60.29, z=27.54], EntityBat['Bat'/8509, l='MpServer', x=61.24, y=32.73, z=-49.64], EntitySquid['Squid'/7998, l='MpServer', x=-48.83, y=62.32, z=47.36], EntityCreeper['Creeper'/8510, l='MpServer', x=76.50, y=22.00, z=-33.50], EntityCreeper['Creeper'/8511, l='MpServer', x=77.50, y=22.00, z=-33.50], EntityCreeper['Creeper'/8512, l='MpServer', x=66.39, y=42.00, z=-2.30], EntitySpider['Spider'/8513, l='MpServer', x=64.61, y=42.00, z=-2.63], EntityPlayerSP['Fifou_BE'/8237, l='MpServer', x=1.19, y=63.00, z=-0.09], EntityBat['Bat'/8515, l='MpServer', x=65.51, y=16.00, z=-26.75], EntitySkeleton['Skeleton'/8010, l='MpServer', x=-30.50, y=18.00, z=22.50], EntitySquid['Squid'/8011, l='MpServer', x=-23.40, y=55.27, z=25.98], EntityItem['item.tile.gravel'/8012, l='MpServer', x=-21.83, y=41.00, z=32.13], EntityItem['item.tile.gravel'/8013, l='MpServer', x=-23.00, y=41.00, z=33.13], EntitySkeleton['Skeleton'/8277, l='MpServer', x=-76.50, y=37.00, z=-23.50], EntityCreeper['Creeper'/8278, l='MpServer', x=-73.50, y=30.00, z=-47.50], EntityCreeper['Creeper'/8279, l='MpServer', x=-68.50, y=32.00, z=-47.50], EntityCreeper['Creeper'/8285, l='MpServer', x=-65.50, y=21.00, z=-63.50], EntityZombie['Zombie'/8286, l='MpServer', x=-75.49, y=30.00, z=-60.52], EntityItem['item.tile.torch'/8035, l='MpServer', x=-11.13, y=41.00, z=13.90], EntityItem['item.tile.rail'/8036, l='MpServer', x=-11.22, y=41.00, z=7.76], EntityItem['item.tile.rail'/8037, l='MpServer', x=-11.13, y=41.00, z=12.25], EntityItem['item.tile.rail'/8038, l='MpServer', x=-11.73, y=41.00, z=14.48], EntityItem['item.tile.rail'/8039, l='MpServer', x=-11.57, y=41.00, z=16.03], EntityBat['Bat'/8297, l='MpServer', x=-71.55, y=52.10, z=-80.52], EntityBat['Bat'/8298, l='MpServer', x=-72.97, y=50.00, z=-77.92], EntityBat['Bat'/8053, l='MpServer', x=10.53, y=25.76, z=17.42], EntityBat['Bat'/8054, l='MpServer', x=-1.57, y=18.31, z=16.54], EntitySquid['Squid'/8313, l='MpServer', x=-55.01, y=54.16, z=-29.08], EntityItem['item.item.string'/8314, l='MpServer', x=-38.12, y=40.00, z=-55.94], EntityChicken['Chicken'/8315, l='MpServer', x=-46.50, y=63.00, z=-61.50], EntityChicken['Chicken'/8317, l='MpServer', x=-37.83, y=64.00, z=-67.11], EntityChicken['Chicken'/8318, l='MpServer', x=-45.63, y=64.00, z=-71.55], EntitySkeleton['Skeleton'/8319, l='MpServer', x=-46.51, y=22.00, z=-2.73], EntityMinecartChest['Minecart with Chest'/8064, l='MpServer', x=17.50, y=42.06, z=9.50], EntitySkeleton['Skeleton'/8320, l='MpServer', x=-52.50, y=23.00, z=-72.50], EntityMinecartChest['Minecart with Chest'/8065, l='MpServer', x=19.50, y=42.06, z=7.50], EntitySkeleton['Skeleton'/8321, l='MpServer', x=-50.50, y=23.00, z=-73.50], EntitySkeleton['Skeleton'/8326, l='MpServer', x=-77.50, y=28.00, z=-33.50], EntityCreeper['Creeper'/8072, l='MpServer', x=33.20, y=53.00, z=78.42], EntityItem['item.tile.torch'/8091, l='MpServer', x=50.85, y=40.00, z=5.39], EntitySheep['Sheep'/8092, l='MpServer', x=62.50, y=71.00, z=37.50], EntitySheep['Sheep'/8093, l='MpServer', x=51.79, y=71.00, z=31.60], EntityCreeper['Creeper'/8094, l='MpServer', x=60.50, y=22.00, z=78.50], EntityBat['Bat'/8354, l='MpServer', x=-18.44, y=37.10, z=-40.74], EntityZombie['Zombie'/8355, l='MpServer', x=-23.30, y=40.00, z=-57.30], EntityZombie['Zombie'/8356, l='MpServer', x=-24.99, y=40.00, z=-64.41], EntityZombie['Zombie'/8357, l='MpServer', x=-25.52, y=41.00, z=-68.73], EntityZombie['Zombie'/8358, l='MpServer', x=-25.70, y=40.00, z=-67.33], EntitySkeleton['Skeleton'/8359, l='MpServer', x=-26.50, y=13.00, z=-8.50], EntitySkeleton['Skeleton'/8360, l='MpServer', x=-26.50, y=16.00, z=-26.50], EntityMinecartChest['Minecart with Chest'/8106, l='MpServer', x=75.50, y=40.06, z=7.50], EntitySheep['Sheep'/8107, l='MpServer', x=68.50, y=69.00, z=34.50], EntitySpider['Spider'/8108, l='MpServer', x=68.50, y=14.00, z=67.50], EntitySkeleton['Skeleton'/8109, l='MpServer', x=64.50, y=29.00, z=66.50], EntitySkeleton['Skeleton'/8110, l='MpServer', x=66.50, y=29.00, z=66.50], EntityCreeper['Creeper'/8111, l='MpServer', x=70.50, y=29.00, z=67.50], EntityBat['Bat'/8374, l='MpServer', x=-26.48, y=39.00, z=-39.25], EntityItem['item.tile.torch'/8384, l='MpServer', x=29.71, y=40.00, z=-14.57], EntityZombie['Zombie'/8398, l='MpServer', x=0.50, y=60.00, z=-71.50], EntityBat['Bat'/8402, l='MpServer', x=2.74, y=61.53, z=-67.05], EntityItem['item.tile.torch'/8407, l='MpServer', x=-5.78, y=42.00, z=-5.93], EntityMinecartChest['Minecart with Chest'/8408, l='MpServer', x=-7.50, y=42.06, z=-7.50], EntityBat['Bat'/8409, l='MpServer', x=-14.60, y=37.10, z=-4.48], EntitySpider['Spider'/8410, l='MpServer', x=-2.73, y=43.95, z=-15.30], EntitySquid['Squid'/8411, l='MpServer', x=-6.78, y=58.43, z=-22.34], EntityMinecartChest['Minecart with Chest'/8412, l='MpServer', x=-9.50, y=42.06, z=-18.50], EntitySquid['Squid'/8413, l='MpServer', x=1.27, y=51.11, z=-24.42], EntitySquid['Squid'/8414, l='MpServer', x=-16.39, y=48.45, z=-23.85], EntityBat['Bat'/8419, l='MpServer', x=13.75, y=40.04, z=-56.50], EntityItem['item.tile.torch'/8420, l='MpServer', x=-2.24, y=40.00, z=-44.55], EntityMinecartChest['Minecart with Chest'/8421, l='MpServer', x=-2.50, y=44.06, z=-47.50], EntityBat['Bat'/8422, l='MpServer', x=-13.25, y=38.10, z=-42.37], EntityBat['Bat'/8423, l='MpServer', x=-12.25, y=37.10, z=-41.25], EntityEnderman['Enderman'/8424, l='MpServer', x=-11.50, y=41.00, z=-35.50], EntityBat['Bat'/8427, l='MpServer', x=-44.46, y=20.73, z=-0.75], EntityZombie['Zombie'/8437, l='MpServer', x=23.80, y=51.00, z=-79.45], EntityMinecartChest['Minecart with Chest'/8441, l='MpServer', x=17.50, y=43.06, z=-25.50], EntityItem['item.tile.torch'/8442, l='MpServer', x=27.75, y=45.00, z=-31.82], EntityZombie['Zombie'/8443, l='MpServer', x=10.30, y=42.00, z=-5.30], EntitySkeleton['Skeleton'/8444, l='MpServer', x=2.30, y=42.00, z=-4.70], EntityCreeper['Creeper'/8445, l='MpServer', x=1.30, y=42.00, z=-15.70], EntityItem['item.tile.torch'/8446, l='MpServer', x=15.47, y=43.00, z=-21.11], EntityItem['item.tile.torch'/8447, l='MpServer', x=27.73, y=41.00, z=-34.47]]
          Retry entities: 0 total; []
          Server brand: fml,forge
          Server type: Integrated singleplayer server
          Stacktrace:
          at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:456)
          at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2774)
          at net.minecraft.client.Minecraft.run(Minecraft.java:436)
          at net.minecraft.client.main.Main.main(Main.java:118)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
          at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
          at GradleStart.main(GradleStart.java:26)
          
          

          Oui ce gif est drôle.

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

            Ligne 64 de ta classe blockVault ? Je pense que ta te est null, mais que tu cherches à accéder à ses données, d’où le NPE et la nécessité de mettre un null check.

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

              @‘Plaigon’:

              Ligne 64 de ta classe blockVault ? Je pense que ta te est null, mais que tu cherches à accéder à ses données, d’où le NPE et la nécessité de mettre un null check.

              @Override
              public boolean onBlockActivated(World worldIn, BlockPos pos,IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
              {
                  EntityPlayer player = Minecraft.getMinecraft().player;
                  TileEntity te = worldIn.getTileEntity(pos);
              
                  if(te.getTileData().hasKey("Owner"))
                  {
                  this.setBlockUnbreakable();
                  this.setResistance(20000.0F);
                  }
                  else
                  {
                  System.out.println(te.getTileData().hasKey("Owner"));
                  if (worldIn.isRemote)
                         {
                  playerIn.openGui(ModEconomy.instance, GuiHandler.BLOCK_VAULT_NEW, worldIn, 0, 0, 0);
                         }
                  }
              
                      return true;
                  }
              

              C’est la ligne

              if(te.getTileData().hasKey("Owner"))
              

              Oui ce gif est drôle.

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

                Si ta tileEntity est null, c’est surement que tu n’utilise pas BlockContainer ( ou ITileEntityProvider ) pour ton block. Si ton block extends déja quelque chose autre que BlockContainer, alors tu doit utiliser l’interface ITileEntityProvider (sinon, tu extends BlockContainer ).
                (Oui extends, tu verbe extendir)

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

                  Je crois qu’on emploie plutôt le verbe étendre dans ce contexte-là.
                  Perso ça me fait + penser à un linge sur un fil qu’à du Java _

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

                    @LeBossMax2:

                    Si ta tileEntity est null, c’est surement que tu n’utilise pas BlockContainer ( ou ITileEntityProvider ) pour ton block. Si ton block extends déja quelque chose autre que BlockContainer, alors tu doit utiliser l’interface ITileEntityProvider (sinon, tu extends BlockContainer ).
                    (Oui extends, tu verbe extendir)

                    Mon block est juste un block custom, donc avec un modèle custom par json, du coup si je l’extends BlockContainer, le rendu disparait et si j’implémente ITileEntityProvider mon tileentity bug et n’est pas supprimer du monde correctement ^^

                    Du coup, je sais pas trop quoi faire…

                    Oui ce gif est drôle.

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

                      As-tu bien override la fonction createNewTileEntity dans ta classe Block ??

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

                        Par défaut, BlockContainer enlève le rendu normal pour utiliser un rendu TESR. Mais Si tu veux remettre le rendu normal, il te faut cette methode :

                        @Override
                        public EnumBlockRenderType getRenderType(IBlockState state)
                        {
                            return EnumBlockRenderType.MODEL;
                        }
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • FlowF Hors-ligne
                          Flow
                          dernière édition par

                          Oui j’ai extends BlockContainer et Override la fonction createNewTileEntity et la ca marche. Mais sinon si j’extends juste block je peut pas l’override il veut pas …

                          EDIT :

                          Merci LebossMax j’ai juste cette erreur quand je place mon block :

                          A TileEntity type fr.fifou.economy.blocks.tileentity.TileEntityBlockVault has throw an exception trying to write state. It will not persist. Report this to the mod author
                          java.lang.RuntimeException: class fr.fifou.economy.blocks.tileentity.TileEntityBlockVault is missing a mapping! This is a bug!
                          at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:89) ~[TileEntity.class:?]
                          at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:80) ~[TileEntity.class:?]
                          at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:418) [AnvilChunkLoader.class:?]
                          at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:191) [AnvilChunkLoader.class:?]
                          at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:210) [ChunkProviderServer.class:?]
                          at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:238) [ChunkProviderServer.class:?]
                          at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:1066) [WorldServer.class:?]
                          at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:426) [MinecraftServer.class:?]
                          at net.minecraft.server.integrated.IntegratedServer.saveAllWorlds(IntegratedServer.java:238) [IntegratedServer.class:?]
                          at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:141) [IntegratedServer.class:?]
                          at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?]
                          at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
                          

                          Oui ce gif est drôle.

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

                            Alors, ça c’est que tu n’a pas register ton tileEntity !

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

                              @LeBossMax2:

                              Alors, ça c’est que tu n’a pas register ton tileEntity !

                              Serait-ce la fatigue ? Je pense, désoler la je suis débile, j’ai rajouté l’enregistrement de la tile entity T_T ^^ Dernière question, comment je suis censé faire dans mon packet ?

                              ublic static class Handler implements IMessageHandler <packetvaultcreated, imessage="">{
                              
                              @Override
                              public IMessage onMessage(PacketVaultCreated message, MessageContext ctx)
                              {
                              EntityPlayer player = ctx.getServerHandler().playerEntity;
                              String owner = player.getUniqueID().toString();
                              World world = ?;
                              BlockPos pos = ?;
                              TileEntity te = world.getTileEntity(pos);
                              if(te.getTileData().hasNoTags())
                              {
                              new NBTTagCompound();
                              te.getTileData().setString("Owner", owner);
                              te.getTileData().setString("password", pass);
                              }
                              player.closeScreen();
                              return null;
                              }
                              }
                              ``` Je ne sais jamais comment instancier mes variables de type world et BlockPos, en fait si je sais à quoi elle correspondent mais ici elle concerne le TileEntity du coup je sais pas quoi mettre :/</packetvaultcreated,>

                              Oui ce gif est drôle.

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

                                Ici, tu veux que l’action soit faite dans le monde où est le joueur donc pour le world, tu peux faire player.world et pour le blockPos, il faut que tu envoie la position du tileEntity dans le packet (sous la forme des 3 coordonnées). Et il ne va pas falloir oublier le null check pour la tileEntity, sinon, il peut y avoir des crash, surtout si quelqu’un s’amuse à envoyer des faux packets au server.

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

                                  @LeBossMax2:

                                  Ici, tu veux que l’action soit faite dans le monde où est le joueur donc pour le world, tu peux faire player.world et pour le blockPos, il faut que tu envoie la position du tileEntity dans le packet (sous la forme des 3 coordonnées). Et il ne va pas falloir oublier le null check pour la tileEntity, sinon, il peut y avoir des crash, surtout si quelqu’un s’amuse à envoyer des faux packets au server.

                                  Pour le blockpos je vois ce que tu veut dire seulement je passe par un Gui pour créer mon chest et dans le gui je n’ai pas la position du block non plus 😕

                                  Oui ce gif est drôle.

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

                                    Il faut donc que ton gui possède un constructeur avec un paramètre de type BlockPos.

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

                                      Hummm, genre je dois faire comme ça ?

                                      protected void actionPerformed(GuiButton button, BlockPos pos) throws IOException
                                      {
                                      if(button == this.create)
                                      {
                                      if(textbox != null)
                                      {
                                      int x = pos.getX();
                                      int y = pos.getY();
                                      int z = pos.getZ();
                                      pass = textbox.toString();
                                      ModEconomy.network.sendToServer(new PacketVaultCreated(pass, x,y,z));
                                      }
                                      }
                                      }
                                      
                                      

                                      Oui ce gif est drôle.

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

                                        Oui, ou directement envoyer le pos dans ton packet.

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

                                          @‘Plaigon’:

                                          Oui, ou directement envoyer le pos dans ton packet.

                                          Ah mince, je pensais avoir fait une erreur car en faisant un débug il n’y a aucune pos…

                                          Je dois bien faire comme ça ? BlockPos pos = new BlockPos(x,y,z);

                                          Oui ce gif est drôle.

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

                                            @‘Legrandfifou’:

                                            @‘Plaigon’:

                                            Oui, ou directement envoyer le pos dans ton packet.

                                            Ah mince, je pensais avoir fait une erreur car en faisant un débug il n’y a aucune pos…

                                            Je dois bien faire comme ça ? BlockPos pos = new BlockPos(x,y,z);

                                            Faudrait que tu m’expliques l’intérêt, vu que tu as déjà le BlockPos à l’entrée de ta fonction ? x)

                                            EDIT: Si tu veux ouvrir un screen, prends juste la position du joueur dans onMessage

                                            
                                            player.getPosition()
                                            
                                            

                                            Si je t'ai aidé, n'hésite pas à cliquer sur le nombre vert en dessous de mon image de profil, pour me le faire savoir. Ca me motive pour continuer …

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB