コード例 #1
0
  /**
   * Opens a Gui for the player.
   *
   * @param mod The mod associated with the gui
   * @param ID The ID number for the Gui
   * @param world The World
   * @param X X Position
   * @param Y Y Position
   * @param Z Z Position
   */
  public void openGui(BaseMod mod, int ID, World world, int x, int y, int z) {
    if (!(this instanceof EntityPlayerMP)) {
      return;
    }

    EntityPlayerMP player = (EntityPlayerMP) this;

    if (!(mod instanceof NetworkMod)) {
      return;
    }

    IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
    if (handler != null) {
      Container container = (Container) handler.getGuiElement(ID, player, world, x, y, z);
      if (container != null) {
        player.realGetNextWidowId();
        player.closeCraftingGui();
        PacketOpenGUI pkt =
            new PacketOpenGUI(
                player.getCurrentWindowIdField(),
                MinecraftForge.getModID((NetworkMod) mod),
                ID,
                x,
                y,
                z);
        player.playerNetServerHandler.sendPacket(pkt.getPacket());
        craftingInventory = container;
        craftingInventory.windowId = player.getCurrentWindowIdField();
        craftingInventory.onCraftGuiOpened(player);
      }
    }
  }
コード例 #2
0
  public void load() {
    if (!DatabaseHelper.has()) {
      ModLoader.throwException(
          "Can not start Pixelmon without SQLite jar or database!!! Please reinstall!!",
          new java.lang.Error(
              "Can not start Pixelmon without SQLite jar or database!!! Please reinstall!!"));
    }
    if (!(ModLoader.isModLoaded("mod_MinecraftForge")))
      ModLoader.throwException(
          "Can not start Pixelmon without Minecraft Forge!!! Please download it!!!",
          new java.lang.Error(
              "Can not start Pixelmon without Minecraft Forge!!! Please download it!!!"));
    if (ModLoader.isModLoaded("mod_pokemobs")) System.exit(1);
    instance = this;

    MinecraftForge.setGuiHandler(this, new GuiHandler());

    ModLoader.setInGUIHook(this, true, true);
    ModLoader.setInGameHook(this, true, true);
    starterList.add(EntityBulbasaur.class);
    starterList.add(EntitySquirtle.class);
    starterList.add(EntityCharmander.class);
    starterList.add(EntityEevee.class);
    addNames();
    registerEntities();
    addSpawns();
    addRecipes();
    MinecraftForge.registerSaveHandler(pokeballManager);
    MinecraftForge.registerSaveHandler(computerManager);
    MinecraftForge.registerConnectionHandler(new PacketHandler());

    alreadySet = true;
  }
コード例 #3
0
 public void registerEntities() {
   removeNormalMobsAndCreatures();
   PixelmonEntityList.registerEntities();
   MinecraftForge.registerEntity(EntityEmptyPokeBall.class, this, IDListPixelmon.i, 50, 1, true);
   IDListPixelmon.i++;
   MinecraftForge.registerEntity(EntityPokeBall.class, this, IDListPixelmon.i, 50, 1, true);
   IDListPixelmon.i++;
 }
コード例 #4
0
ファイル: MTDCore.java プロジェクト: ali4z/Eury-s-Mods
 public static void initialize() {
   MultiTexturedDoors.initialize();
   MinecraftForge.registerConnectionHandler(new NetworkConnection());
 }