Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Remplacer un block d'un autre mod

    Sans suite
    3
    5
    1950
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SCAREX
      SCAREX last edited by

      Bonjour, depuis quelques jours j’essaie de créer un système de cadenas sur les blocks d’iron chest, cependant j’ai eu quelques problèmes : il n’y a pas d’événements pour sauvegarder des informations en plus dans une tile entity (il n’y en a que pour sauvegarder le monde et le chunk). J’ai donc décidé de créer mon propre block extends BlockIronChest (le block d’Iron Chest), mais je n’ai pas réussi à faire fonctionner la fonction GameRegistry.addSubstitutionAlias :

      package fr.scarex.ascalonmod.block;
      
      import net.minecraft.block.Block;
      import cpw.mods.fml.common.registry.ExistingSubstitutionException;
      import cpw.mods.fml.common.registry.GameRegistry;
      import cpw.mods.ironchest.IronChest;
      import cpw.mods.ironchest.ItemIronChest;
      import fr.scarex.ascalonmod.AscalonMod;
      
      /**
      * @author SCAREX
      *
      */
      public class AscalonModBlocks
      {
      public static Block BLOCK_COINER,
      BLOCK_IRON_CHEST_REPLACER;
      
      public static final void initBlocks() {
      BLOCK_COINER = new BlockCoiner();
      BLOCK_IRON_CHEST_REPLACER = new BlockIronChestReplacer();
      }
      
      public static final void replaceBlocks() {
      try {
      GameRegistry.addSubstitutionAlias("IronChest:BlockIronChest", GameRegistry.Type.BLOCK, BLOCK_IRON_CHEST_REPLACER); // Remplacement du block
      GameRegistry.addSubstitutionAlias("IronChest:BlockIronChest", GameRegistry.Type.ITEM, new ItemIronChest(IronChest.ironChestBlock)); // Après plusieurs essais, il me dit que ce que j'ai donné est incompatible et j'ai remarqué que lorsque cpw enregistre le block, il lui donne un ItemBlock donc je lui en donne un (celui de cpw)
      } catch (ExistingSubstitutionException e) {
      AscalonMod.LOGGER.error("Couldn't replace Iron Chest's block");
      }
      }
      
      public static final void initBlocksCraft() {
      
      }
      }
      

      Voici ce que cela donne lorsque l’on lance un monde :

      [14:08:49] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
      [14:08:49] [Server thread/INFO]: Generating keypair
      [14:08:49] [Server thread/INFO]: Converting map!
      [14:08:49] [Server thread/INFO]: Scanning folders…
      [14:08:49] [Server thread/INFO]: Total conversion count is 0
      [14:08:49] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance
      [14:08:49] [Server thread/FATAL] [FML]: The world state is utterly corrupted and this save is NOT loadable
      
      There is a high probability that a mod has broken the
      ID map and there is
      NOTHING FML or Forge can do to recover this save.
      
      If you changed your mods, try reverting the change
      java.lang.IllegalStateException: Registry entry for ItemBlock cpw.mods.ironchest.ItemIronChest@7a436f0, id 165, is missing or uses the non-matching id -1.
      at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.validateContent(FMLControlledNamespacedRegistry.java:83) ~[FMLControlledNamespacedRegistry.class:?]
      at cpw.mods.fml.common.registry.GameData.testConsistency(GameData.java:1001) ~[GameData.class:?]
      at cpw.mods.fml.common.registry.GameData.injectWorldIDMap(GameData.java:580) ~[GameData.class:?]
      at cpw.mods.fml.common.FMLContainer.readData(FMLContainer.java:277) [FMLContainer.class:?]
      at cpw.mods.fml.common.FMLCommonHandler.handleWorldDataLoad(FMLCommonHandler.java:403) [FMLCommonHandler.class:?]
      at net.minecraft.world.storage.SaveHandler.loadWorldInfo(SaveHandler.java:143) [SaveHandler.class:?]
      at net.minecraft.world.World.<init>(World.java:256) [World.class:?]
      at net.minecraft.world.WorldServer.<init>(WorldServer.java:102) [WorldServer.class:?]
      at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:63) [IntegratedServer.class:?]
      at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) [IntegratedServer.class:?]
      at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
      at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
      [14:08:50] [Server thread/INFO] [FML]: Applying holder lookups
      [14:08:50] [Server thread/INFO] [FML]: Holder lookups applied
      [14:08:50] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.
      [14:08:52] [Client thread/INFO]: Stopping!
      [14:08:52] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:
      [14:08:52] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down…
      [14:08:52] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com
      [14:08:52] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:
      
      ```</init></init>
      1 Reply Last reply Reply Quote 0
      • robin4002
        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

        @‘SCAREX’:

        il n’y a pas d’événements pour sauvegarder des informations en plus dans une tile entity (il n’y en a que pour sauvegarder le monde et le chunk).

        https://github.com/MinecraftForge/MinecraftForge/blob/master/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch#L126-L153
        Sur les versions récentes de Forge tu peux passer par ça.

        Sinon selon la doc de la fonction :
             * @param object a NEW instance that is type compatible with the existing instance
        Il faut sûrement que ton bloc hérite de celui d’ironchest

        1 Reply Last reply Reply Quote 0
        • SCAREX
          SCAREX last edited by

          Je suis en 1.7.10, donc la fonction n’y est pas. Mon block hérite de celui d’iron chest et l’ItemBlock est celui d’iron chest donc je ne vois pas où est le problème.

          1 Reply Last reply Reply Quote 0
          • Diangle
            Diangle last edited by

            tu pourrais nous envoyer la classe principale ?

            1 Reply Last reply Reply Quote 0
            • SCAREX
              SCAREX last edited by

              Que veux-tu ? Toutes les infos sont là. initBlocks est appelé dans la pre-initialisation et replaceBlocks dans l’initialisation.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Design by Woryk
              Contact / Mentions Légales / Faire un don

              MINECRAFT FORGE FRANCE © 2018

              Powered by NodeBB