Exemplo n.º 1
0
  protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) {
    if (p_147049_1_.getTabPage() != tabPage) {
      if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) {
        return false;
      }
    }

    int k = p_147049_1_.getTabColumn();
    int l = 28 * k;
    byte b0 = 0;

    if (k == 5) {
      l = this.xSize - 28 + 2;
    } else if (k > 0) {
      l += k;
    }

    int i1;

    if (p_147049_1_.isTabInFirstRow()) {
      i1 = b0 - 32;
    } else {
      i1 = b0 + this.ySize;
    }

    return p_147049_2_ >= l && p_147049_2_ <= l + 28 && p_147049_3_ >= i1 && p_147049_3_ <= i1 + 32;
  }
Exemplo n.º 2
0
  /**
   * Renders the creative inventory hovering text if mouse is over it. Returns true if did render or
   * false otherwise. Params: current creative tab to be checked, current mouse x position, current
   * mouse y position.
   */
  protected boolean renderCreativeInventoryHoveringText(
      CreativeTabs p_147052_1_, int p_147052_2_, int p_147052_3_) {
    int k = p_147052_1_.getTabColumn();
    int l = 28 * k;
    byte b0 = 0;

    if (k == 5) {
      l = this.xSize - 28 + 2;
    } else if (k > 0) {
      l += k;
    }

    int i1;

    if (p_147052_1_.isTabInFirstRow()) {
      i1 = b0 - 32;
    } else {
      i1 = b0 + this.ySize;
    }

    if (this.func_146978_c(l + 3, i1 + 3, 23, 27, p_147052_2_, p_147052_3_)) {
      this.drawCreativeTabHoveringText(
          I18n.format(p_147052_1_.getTranslatedTabLabel(), new Object[0]),
          p_147052_2_,
          p_147052_3_);
      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 3
0
public class ChaosTabs {
  public ChaosTabs() {}

  public static final CreativeTabs tabChaosMaterials =
      new CreativeTabs(CreativeTabs.getNextID(), "tabChaosMaterials") {
        public Item getTabIconItem() {
          return ChaosItems.ItemRuby;
        }
      };

  public static final CreativeTabs tabChaosCombat =
      new CreativeTabs(CreativeTabs.getNextID(), "tabChaosCombat") {
        public Item getTabIconItem() {
          return ChaosItems.swordangelic;
        }
      };

  public static final CreativeTabs tabChaosTools =
      new CreativeTabs(CreativeTabs.getNextID(), "tabChaosTools") {
        public Item getTabIconItem() {
          return ChaosItems.pickaxeSapphire;
        }
      };

  public static final CreativeTabs tabChaosBlocks =
      new CreativeTabs(CreativeTabs.getNextID(), "tabChaosBlocks") {
        public Item getTabIconItem() {
          return Item.getItemFromBlock(ChaosBlocks.EnergyReactor);
        }
      };
}
Exemplo n.º 4
0
  /** Draw the foreground layer for the GuiContainer (everything in front of the items) */
  protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
    CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];

    if (creativetabs != null && creativetabs.drawInForegroundOfTab()) {
      GL11.glDisable(GL11.GL_BLEND);
      this.fontRendererObj.drawString(
          I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
    }
  }
Exemplo n.º 5
0
  protected void renderToolTip(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_) {
    if (selectedTabIndex == CreativeTabs.tabAllSearch.getTabIndex()) {
      List list =
          p_146285_1_.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
      CreativeTabs creativetabs = p_146285_1_.getItem().getCreativeTab();

      if (creativetabs == null && p_146285_1_.getItem() == Items.enchanted_book) {
        Map map = EnchantmentHelper.getEnchantments(p_146285_1_);

        if (map.size() == 1) {
          Enchantment enchantment =
              Enchantment.enchantmentsList[((Integer) map.keySet().iterator().next()).intValue()];
          CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
          int k = acreativetabs.length;

          for (int l = 0; l < k; ++l) {
            CreativeTabs creativetabs1 = acreativetabs[l];

            if (creativetabs1.func_111226_a(enchantment.type)) {
              creativetabs = creativetabs1;
              break;
            }
          }
        }
      }

      if (creativetabs != null) {
        list.add(
            1,
            ""
                + EnumChatFormatting.BOLD
                + EnumChatFormatting.BLUE
                + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
      }

      for (int i1 = 0; i1 < list.size(); ++i1) {
        if (i1 == 0) {
          list.set(i1, p_146285_1_.getRarity().rarityColor + (String) list.get(i1));
        } else {
          list.set(i1, EnumChatFormatting.GRAY + (String) list.get(i1));
        }
      }

      this.func_146283_a(list, p_146285_2_, p_146285_3_);
    } else {
      super.renderToolTip(p_146285_1_, p_146285_2_, p_146285_3_);
    }
  }
Exemplo n.º 6
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile());

    tabRu =
        new CreativeTabs(CreativeTabs.getNextID(), Reference.Mod.MODID) { // Creative tab
          @Override
          public Item getTabIconItem() {
            return ItemInit.itemPancake;
          }

          @Override
          public String getTranslatedTabLabel() {
            return "Random Utilities";
          }
        };

    // Registration
    ItemInit.init();
    BlockInit.init();
    RecipeInit.init();
    MiscInit.init();
    MiscInit.eventInit();
    syncConfig();
  }
Exemplo n.º 7
0
 @Override
 public int compare(CreativeTabs o1, CreativeTabs o2) {
   if (isVanillaTab(o1) && isVanillaTab(o2)) {
     // ReikaJavaLibrary.pConsole(o1.getTabLabel()+"@"+o1.tabIndex+" :
     // "+o2.getTabLabel()+"@"+o2.tabIndex+" > "+(o1.tabIndex-o2.tabIndex));
     return o1.tabIndex - o2.tabIndex;
   } else if (isVanillaTab(o1)) {
     return Integer.MIN_VALUE;
   } else if (isVanillaTab(o2)) {
     return Integer.MAX_VALUE;
   } else {
     return DragonOptions.SORTCREATIVE.getState()
         ? String.CASE_INSENSITIVE_ORDER.compare(o1.getTabLabel(), o2.getTabLabel())
         : o1.tabIndex - o2.tabIndex;
   }
 }
Exemplo n.º 8
0
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class Particular {

  @Instance(Reference.MOD_ID)
  public static Particular instance;

  @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
  public static CommonProxy proxy;

  public static CreativeTabs tabsParticular =
      new CreativeTabParticular(CreativeTabs.getNextID(), Reference.MOD_ID);

  EventManager eventmanager = new EventManager();

  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    // Register blocks & items
    ModItems.init();
    ModBlocks.init();
  }

  @EventHandler
  public void load(FMLInitializationEvent event) {
    // Register events
    NetworkRegistry.instance().registerGuiHandler(instance, proxy);
    LanguageRegistry.instance().addStringLocalization("itemGroup.Particular", "Particular");
    GameRegistry.registerWorldGenerator(eventmanager);
  }

  @EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    // Interact with other mods
  }
}
  public void displayAllReleventItems(List items) {
    super.displayAllReleventItems(items);

    if (itemSorter != null) {
      Collections.sort(items, itemSorter);
    }
  }
Exemplo n.º 10
0
  protected void func_147051_a(CreativeTabs p_147051_1_) {
    boolean flag = p_147051_1_.getTabIndex() == selectedTabIndex;
    boolean flag1 = p_147051_1_.isTabInFirstRow();
    int i = p_147051_1_.getTabColumn();
    int j = i * 28;
    int k = 0;
    int l = this.guiLeft + 28 * i;
    int i1 = this.guiTop;
    byte b0 = 32;

    if (flag) {
      k += 32;
    }

    if (i == 5) {
      l = this.guiLeft + this.xSize - 28;
    } else if (i > 0) {
      l += i;
    }

    if (flag1) {
      i1 -= 28;
    } else {
      k += 64;
      i1 += this.ySize - 4;
    }

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glColor3f(1F, 1F, 1F); // Forge: Reset color in case Items change it.
    GL11.glEnable(
        GL11.GL_BLEND); // Forge: Make sure blend is enabled else tabs show a white border.
    this.drawTexturedModalRect(l, i1, j, k, 28, b0);
    this.zLevel = 100.0F;
    itemRender.zLevel = 100.0F;
    l += 6;
    i1 += 8 + (flag1 ? 1 : -1);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    ItemStack itemstack = p_147051_1_.getIconItemStack();
    itemRender.renderItemAndEffectIntoGUI(
        this.fontRendererObj, this.mc.getTextureManager(), itemstack, l, i1);
    itemRender.renderItemOverlayIntoGUI(
        this.fontRendererObj, this.mc.getTextureManager(), itemstack, l, i1);
    GL11.glDisable(GL11.GL_LIGHTING);
    itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
  }
Exemplo n.º 11
0
/** Created by Tim on 7/29/2014. */
@Mod(modid = Defaults.MODID, version = Defaults.VERSION, name = Defaults.NAME)
public class Bagginses {
  @Mod.Instance(Defaults.MODID)
  public static Bagginses instance;

  @SidedProxy(clientSide = Defaults.CLIENTPROXY, serverSide = Defaults.COMMONPROXY)
  public static CommonProxy proxy;

  public static GuiHandler guiHandler = new GuiHandler();

  public static CreativeTabs BagTab = new BagTab(CreativeTabs.getNextID(), "Bagginses");

  public static String path;

  public static Configuration configuration;

  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) {

    path =
        event.getModConfigurationDirectory().getAbsolutePath()
            + File.separator
            + Defaults.MODID.toLowerCase()
            + File.separator;
    ConfigHandler.init(path);

    ModItems.init();
  }

  @Mod.EventHandler
  public void init(FMLInitializationEvent event) {
    instance = this;
    proxy.registerEvents();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    MinecraftForge.EVENT_BUS.register(this);
  }

  @Mod.EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    BlockList.addFromString(ModConfig.black, "black");
    BlockList.addFromString(ModConfig.red, "red");
    BlockList.addFromString(ModConfig.brown, "brown");
    BlockList.addFromString(ModConfig.blue, "blue");
    BlockList.addFromString(ModConfig.cyan, "cyan");
    BlockList.addFromString(ModConfig.gray, "gray");
    BlockList.addFromString(ModConfig.green, "green");
    BlockList.addFromString(ModConfig.lightBlue, "lightBlue");
    BlockList.addFromString(ModConfig.lime, "lime");
    BlockList.addFromString(ModConfig.magenta, "magenta");
    BlockList.addFromString(ModConfig.orange, "orange");
    BlockList.addFromString(ModConfig.pink, "pink");
    BlockList.addFromString(ModConfig.purple, "purple");
    BlockList.addFromString(ModConfig.silver, "silver");
    BlockList.addFromString(ModConfig.white, "white");
    BlockList.addFromString(ModConfig.yellow, "yellow");
  }
}
Exemplo n.º 12
0
  @Override
  public void init(FMLInitializationEvent event) {
    super.init(event);

    ClientCommandHandler.instance.registerCommand(new ClientCommandsVC());

    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(new RenderFog());

    if (VintageCraftConfig.rearrangeCreativeTabs) {
      int i = 0;

      CreativeTabs[] tabs = new CreativeTabs[CreativeTabs.creativeTabArray.length];

      for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
        if (tab instanceof CreativeTabsVC) {
          if (i == 5 || i == 11) i++; // don't touch search tab or inventory tab
          tab.tabIndex = i;
          tabs[i++] = tab;
        }
      }

      tabs[5] = CreativeTabs.tabAllSearch;
      tabs[11] = CreativeTabs.tabInventory;
      i = 7;

      for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
        if (!(tab instanceof CreativeTabsVC)
            && !tab.getTabLabel().equals("search")
            && !tab.getTabLabel().equals("inventory")) {
          if (i == 11) i++;
          tab.tabIndex = i;
          tabs[i++] = tab;
        }
      }

      CreativeTabs.creativeTabArray = tabs;

      /*for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
      	System.out.println(tab.getTabLabel() + ": " + tab.tabIndex);
      }*/
    }
  }
Exemplo n.º 13
0
@Mod(modid = "Ash_AmossomaAllTabs", name = "AmosomaAllTabs", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class AmossomaAllTabs {
  @SidedProxy(
      clientSide = "amossoma.ClientProxyAmossoma",
      serverSide = "amossoma.CommonProxyAmossoma")
  public static CommonProxyAmossoma proxy;

  @Init
  public void load(FMLInitializationEvent event) {
    proxy.registerRenderThings();
  }

  public static CreativeTabs AmossomaBlocksTab =
      new AmossomaBlocksTab(
          CreativeTabs.getNextID(), "AmossomaBlocksTab"); // Our custom creative tab's object
  public static CreativeTabs AmossomaReefsTab =
      new AmossomaReefsTab(
          CreativeTabs.getNextID(), "AmossomaReefsTab"); // Our custom creative tab's object
  public static CreativeTabs AmossomaDecoTab =
      new AmossomaDecoTab(
          CreativeTabs.getNextID(), "AmossomaDecoTab"); // Our custom creative tab's object
  public static CreativeTabs AmossomaMaterialsTab =
      new AmossomaMaterialsTab(
          CreativeTabs.getNextID(), "AmossomaMaterialsTab"); // Our custom creative tab's object
  public static CreativeTabs AmossomaPlantsTab =
      new AmossomaPlantsTab(
          CreativeTabs.getNextID(), "AmossomaPlantsTab"); // Our custom creative tab's object
  public static CreativeTabs AmossomaProductsTab =
      new AmossomaProductsTab(
          CreativeTabs.getNextID(), "AmossomaProductsTab"); // Our custom creative tab's object
}
Exemplo n.º 14
0
public class Reference {
  public static final String MOD_ID = "MMOMats";
  public static final String MOD_NAME = "MMO Materials";
  public static final String VERSION_NUMBER = "Alpha 0.1";
  public static final String CHANNEL_NAME = MOD_ID;
  public static final String DEPENDENCIES = "required-after:Forge@[7.7.1.650,)";
  public static final String FINGERPRINT = "@FINGERPRINT@";
  public static final int SECOND_IN_TICKS = 20;
  public static final int SHIFTED_ID_RANGE_CORRECTION = 256;
  public static final String SERVER_PROXY_CLASS = "uk.co.alteff4.mm.core.proxy.CommonProxy";
  public static final String CLIENT_PROXY_CLASS = "uk.co.alteff4.mm.core.proxy.ClientProxy";
  public static final int VERSION_CHECK_ATTEMPTS = 3;

  public static CreativeTabs CREATIVE_TAB_MATERIALS =
      new CreativeTabMaterials(CreativeTabs.getNextID(), MOD_ID + "Materials");
  public static CreativeTabs CREATIVE_TAB_GENERAL =
      new CreativeTabGeneral(CreativeTabs.getNextID(), MOD_ID);

  public static String createUnlocalizedName(String name) {
    return MOD_ID.toLowerCase() + "." + name;
  }
}
Exemplo n.º 15
0
 private void collectSortAndReplace(Comparator c) {
   ArrayList<CreativeTabs> list =
       ReikaJavaLibrary.makeListFromArray(CreativeTabs.creativeTabArray);
   for (CreativeTabs t : childTabs) {
     list.remove(t);
   }
   Collections.sort(list, c);
   for (CreativeTabs p : tabGroups.keySet()) {
     LinkedList<CreativeTabs> ch = tabGroups.get(p);
     int index = list.indexOf(p) + 1;
     for (CreativeTabs t : ch) {
       list.add(index, t);
       index++;
     }
   }
   CreativeTabs.creativeTabArray = new CreativeTabs[list.size()];
   for (int i = 0; i < list.size(); i++) {
     CreativeTabs t = list.get(i);
     t.tabIndex = i;
     CreativeTabs.creativeTabArray[i] = t;
   }
 }
Exemplo n.º 16
0
  private void updateCreativeSearch() {
    CreativeInv.ContainerCreative containercreative =
        (CreativeInv.ContainerCreative) this.inventorySlots;
    containercreative.itemList.clear();

    CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex];
    if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) {
      tab.displayAllReleventItems(containercreative.itemList);
      updateFilteredItems(containercreative);
      return;
    }

    Iterator iterator = Item.itemRegistry.iterator();

    while (iterator.hasNext()) {
      Item item = (Item) iterator.next();

      if (item != null && item.getCreativeTab() != null) {
        item.getSubItems(item, (CreativeTabs) null, containercreative.itemList);
      }
    }
    updateFilteredItems(containercreative);
  }
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
@NetworkMod(
    channels = {Reference.CHANNEL_NAME},
    clientSideRequired = true,
    serverSideRequired = false,
    packetHandler = PacketHandler.class)
public class IndustrialAddons {

  @Instance(Reference.MOD_ID)
  public static IndustrialAddons instance;

  @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.COMMON_PROXY_CLASS)
  public static CommonProxy proxy;

  public static CreativeTabs tabsIndustrialAddons =
      new CreativeTabs(CreativeTabs.getNextID(), Reference.MOD_ID);

  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    ModFluids.init();
    ModBlocks.init();
    ModItems.init();

    // MultiPartContent.init();

    proxy.registerTileEntities();
  }

  @EventHandler
  public void init(FMLInitializationEvent event) {
    proxy.initRenderingAndTextures();
  }

  @EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    ExtraRecipes.init();
  }
}
Exemplo n.º 18
0
/** Created by Tim on 7/29/2014. */
@Mod(modid = Defaults.MODID, version = Defaults.VERSION, name = Defaults.NAME)
public class Bagginses {
  @Mod.Instance(Defaults.MODID)
  public static Bagginses instance;

  @SidedProxy(clientSide = Defaults.CLIENTPROXY, serverSide = Defaults.COMMONPROXY)
  public static CommonProxy proxy;

  public static GuiHandler guiHandler = new GuiHandler();

  public static CreativeTabs BagTab = new BagTab(CreativeTabs.getNextID(), "Bagginses");

  public static String path;

  public static Configuration configuration;

  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    path =
        event.getModConfigurationDirectory().getAbsolutePath()
            + File.separator
            + Defaults.MODID.toLowerCase()
            + File.separator;
    ConfigHandler.init(path);

    ModItems.init();
  }

  @Mod.EventHandler
  public void init(FMLInitializationEvent event) {
    instance = this;
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
    MinecraftForge.EVENT_BUS.register(this);
  }

  @Mod.EventHandler
  public void postInit(FMLPostInitializationEvent event) {}
}
Exemplo n.º 19
0
@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION)
public class MicroMod {

  public static Item farmerTop, farmerBottom, farmerBoots;

  @SidedProxy(
      clientSide = References.CLIENTPROXYLOCATION,
      serverSide = References.COMMONPROXYLOCATION)
  public static CommonProxy proxy;

  @Mod.Instance public static MicroMod instance;

  private static CreativeTabs wardTab = new MicroTab(CreativeTabs.getNextID(), References.MODID);

  public static CreativeTabs getCreativeTab() {
    return wardTab;
  }

  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    final ArmorMaterial farmer =
        EnumHelper.addArmorMaterial("Farmer", 3, new int[] {1, 3, 2, 1}, 2);
    int armor = proxy.addArmor("FarmerArmor");
    farmerTop = new FarmerArmor(farmer, armor, 1);
    farmerBottom = new FarmerArmor(farmer, armor, 2);
    farmerBoots = new FarmerArmor(farmer, armor, 3);
    CreateBlocks.init();
    CreateItems.init();
    CraftingHandler.init();
  }

  @Mod.EventHandler
  public static void init(FMLInitializationEvent event) {}

  @Mod.EventHandler
  public static void postInit(FMLPostInitializationEvent event) {}
}
Exemplo n.º 20
0
@Mod(
    modid = ReferenceLib.MOD_ID,
    name = ReferenceLib.MOD_ID,
    version = ReferenceLib.MOD_VERSION,
    certificateFingerprint = "5c22df6c25d089dce879c287801a862b3fe2cc4d",
    useMetadata = false)
@NetworkMod(
    versionBounds = ReferenceLib.MOD_VERSION,
    clientSideRequired = ReferenceLib.clientSideRequired,
    serverSideRequired = ReferenceLib.serverSideRequired)
public class CraftMineCore implements ISmartMod {
  @SidedProxy(
      clientSide = ReferenceLib.CLIENT_PROXY_CLASS,
      serverSide = ReferenceLib.SERVER_PROXY_CLASS)
  public static CommonProxy proxy;

  @Instance(ReferenceLib.MOD_ID)
  public static CraftMineCore instance;

  /** Is this the server? */
  public static boolean isServer = false;

  /** The logger instance. */
  public static Logger logger = Logger.getLogger("CraftMine");

  // CreativeTab
  public static CreativeTabs tabsCraftMine =
      new CreativeTabCraftMine(CreativeTabs.getNextID(), "CraftMine");
  public static CreativeTabs tabsCraftMineConstruction =
      new CreativeTabCraftMineConstruction(
          CreativeTabs.getNextID(), "CraftMine Construction Blocks");
  public static CreativeTabs tabsCraftMineTools =
      new CreativeTabCraftMineTools(CreativeTabs.getNextID(), "CraftMine Tools");

  public static Material liquidMat = (new MaterialLiquid(MapColor.woodColor));

  public static TextureEngine textureEngine = new TextureEngine(ReferenceLib.MOD_ID);
  public static LanguageEngine langEngine = new LanguageEngine("/mods/CraftMine/lang/");

  // Preinitialisation Event
  @PreInit
  public void preInit(FMLPreInitializationEvent event) throws Exception {
    logger.setParent(FMLLog.getLogger());
    try {
      if (CoreLoadingPlugin.callBack()) {
        CraftMineCore.logger.info("nintendofan9797-Core callback succeeded!");
      } else {
        throw new Exception();
      }
    } catch (Exception e) {
      throw new RuntimeException("nintendofan9797-Core is not installed/corrupt! Cannot proceed!");
    }

    try {
      Validator.verify(); // Do some loading checks, for example checking
      // the jar signature.

      EnumPacketType.put(
          "KEYARMOR",
          PacketKeyArmor.class,
          "KEYARMOR",
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "SOUND",
          PacketSound.class,
          "SOUND",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "ENDPICK",
          PacketEndPick.class,
          "ENDPICK",
          PacketChannelLib.CHANNEL_ENDPICK,
          EnumDirection.SERVER);
      EnumPacketType.put(
          "RENAME",
          PacketRename.class,
          "RENAME",
          PacketChannelLib.CHANNEL_SV_TO_CL,
          EnumDirection.CLIENT);
      EnumPacketType.put(
          "GUI", PacketGui.class, "GUI", PacketChannelLib.CHANNEL_SV_TO_CL, EnumDirection.CLIENT);
      EnumPacketType.put(
          "CAMO", PacketCamo.class, "CAMO", PacketChannelLib.CHANNEL_CAMO, EnumDirection.CLIENT);
      EnumPacketType.put(
          "KEY", PacketKey.class, "KEY", PacketChannelLib.CHANNEL_KEY, EnumDirection.SERVER);

      CoreLoadingPlugin.manager.registerMod(new PacketHandlerClient(), "CMPKC");
      CoreLoadingPlugin.manager.registerMod(new PacketHandlerServer(), "CMPKS");

      CoreLoadingPlugin.manager.getContainerForId("CMPKC").setSide(Side.CLIENT);
      CoreLoadingPlugin.manager.getContainerForId("CMPKS").setSide(Side.SERVER);

      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ARMOR_TO_SERVER, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CL_TO_SV, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_DATA_UPDATE, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_ENDPICK, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_INV_CHANGE, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_MAIN, "CMPKS");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_SV_TO_CL, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_CAMO, "CMPKC");
      CoreLoadingPlugin.manager.registerChannelToMultipleHandlers(
          PacketChannelLib.CHANNEL_KEY, "CMPKS");

      proxy.registerConfigurationCategories();

      ReferenceLib.DAY = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
      // CraftMineCore.logger.info("Day: " + ReferenceLib.DAY);
      ReferenceLib.MONTH = Calendar.getInstance().get(Calendar.MONTH);
      // CraftMineCore.logger.info("Month: " + ReferenceLib.MONTH);

      logger.info("Attempting AutoUpdate...");
      UpdateMain.doVersionCheck();

      CapeLib.init();
      proxy.registerGuis();

      logger.info("Configuring API...");
      CraftMineApi.constructionTab = tabsCraftMineConstruction;
      CraftMineApi.coreTab = tabsCraftMine;
      CraftMineApi.toolsTab = tabsCraftMineTools;

      if (event.getSide() == Side.SERVER) {
        logger.info("Initializing Server-side...");
        isServer = true;
      } else {
        logger.info("Initializing Client-side...");
      }

      proxy.registerSounds();

      MinecraftForge.EVENT_BUS.register(new AttackHandler());

      logger.info("Reading/Writing configuration values...");

      try {
        Config.init();
      } catch (Exception e) {
        CraftMineCore.logger.warning("Error while initialising configuration!");
        CraftMineCore.logger.warning("Re-writing configuration file.");
        Config.rewriteConfig();
        Config.init();
      }

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during pre-initialization");
    }
  }

  // Initialisation Event
  @Init
  public void loadSequence(FMLInitializationEvent event) {
    try {

      MaterialRegistry.init();

      logger.info("Loading Module Aurora...");
      AuroraInit.init();

      proxy.registerCommonEventHandlers();
      proxy.registerClientEventHandlers();
      proxy.registerTileEntities();
      proxy.registerEntities();

      EnchantmentRegistry.init();

      ItemRegistry.init();
      BlockRegistry.init();
      ItemRegistry.initDepend();
      BlockRegistry.initDepend();

      LoaderEngine.registerMod(instance);

      CorruptionRegistry.init();

      OreDictionaryHelper.registerItems();
      LiquidDictionaryHelper.init();

      HandleRegistry.registerTools();

      ArmorRegistry.init();

      LiquidRegistry.init();

      EnergyNetMain.init();

      BiomeRegistry.init();

      Debug.init();

      DimensionManager.registerProviderType(
          Config.providerIDAtlantis.getValueInt(), CraftMineWorldProvider.class, true);
      DimensionManager.registerDimension(
          Config.dimensionIDAtlantis.getValueInt(), Config.providerIDAtlantis.getValueInt());

      GameRegistry.registerWorldGenerator(new WorldGenHandler());

      proxy.registerClientTicks();
      proxy.registerServerTicks();
      proxy.registerMiscTicks();

      KeyLib.beginKeyValueLocalization();

      proxy.registerKeyBindings();

      RecipeManager.init();

      proxy.registerRenderInformation();
      ItemDuplicatorRegistry.init();

      DictionaryLib.init();

      AchievementManager.init();

      TurretRegistry.init();

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during initialization");
    }
  }

  @PostInit
  public void postInit(FMLPostInitializationEvent event) throws Exception {
    try {

      DispenserActionRegistry.init();

      // Now that all mods have completed their main initialization
      // sequence, scan for other mods we want to
      // use the APIs of.
      ModDetector.beginModDetection();

      // Now, register the stairs and walls because the inclusions have
      // been registered.
      WallStairRegistrationHandler.addWallsAndStairs();

      CoreLoadingPlugin.EVENT_BUS.register(new ArmorProjectionHandler());

      logger.info("Registered " + BlockRegistry.blockcount + " blocks!");
      logger.info("Registered " + ItemRegistry.itemcount + " items!");

      FuelController.registerFuel(ItemRegistry.EndimoniumIngot.itemID, Integer.MAX_VALUE);

    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during post-initialization");
    }
  }

  // Server Start Event
  @ServerStarting
  public void serverStarting(FMLServerStartingEvent event) {
    try {
      ServerPlatform.registerCommand(new CommandPortal());
      ServerPlatform.registerCommand(new CommandCraftMine());
      ServerPlatform.registerCommand(new CommandAFK());
      ServerPlatform.registerCommand(new CommandExtinguish());
      ServerPlatform.registerCommand(new CommandHat());
      ServerPlatform.registerCommand(new CommandMute());
      ServerPlatform.registerCommand(new CommandRename());
    } catch (Exception e) {
      CrashLogger.killWithError(e, "Fatal error during server start sequence");
    }
  }

  // Run NEI Integration
  @ServerStarted
  public void serverStarted(FMLServerStartedEvent event) {
    if (Loader.isModLoaded("NotEnoughItems")) {
      runNEIIntegration(event);
    }
  }

  // Will be used for advanced block checking.
  @VersionCheckHandler
  public boolean versionCheck(String ver, INetworkManager netMan) {
    return true;
  }

  private void runNEIIntegration(FMLServerStartedEvent event) {}

  @Override
  public CreativeTabs getDefaultCreativeTab() {
    return tabsCraftMine;
  }

  @Override
  public TextureEngine getDefaultTextureEngine() {
    return textureEngine;
  }

  @Override
  public LanguageEngine getDefaultLanguageEngine() {
    return langEngine;
  }
}
/**
 * Equivalent-Exchange-3
 *
 * <p>EquivalentExchange3
 *
 * @author pahimar
 * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
 */
@Mod(
    modid = Reference.MOD_ID,
    name = Reference.MOD_NAME,
    version = Reference.VERSION_NUMBER,
    dependencies = Reference.DEPENDENCIES,
    certificateFingerprint = Reference.FINGERPRINT)
@NetworkMod(
    channels = {Reference.CHANNEL_NAME},
    clientSideRequired = true,
    serverSideRequired = false,
    packetHandler = PacketHandler.class)
public class EquivalentExchange3 {

  @Instance(Reference.MOD_ID)
  public static EquivalentExchange3 instance;

  @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
  public static CommonProxy proxy;

  public static CreativeTabs tabsEE3 =
      new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID);

  @FingerprintWarning
  public void invalidFingerprint(FMLFingerprintViolationEvent event) {

    // Report (log) to the user that the version of Equivalent Exchange 3 they are using has been
    // changed/tampered with
    LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
  }

  @ServerStarting
  public void serverStarting(FMLServerStartingEvent event) {

    // Initialize the custom commands
    CommandHandler.initCommands(event);
  }

  @PreInit
  public void preInit(FMLPreInitializationEvent event) {

    // Initialize the log helper
    LogHelper.init();

    // Load the localization files into the LanguageRegistry
    LocalizationHandler.loadLanguages();

    // Initialize the configuration
    ConfigurationHandler.init(
        new File(
            event.getModConfigurationDirectory().getAbsolutePath()
                + File.separator
                + Reference.CHANNEL_NAME
                + File.separator
                + Reference.MOD_ID
                + ".cfg"));

    // Conduct the version check and log the result
    VersionHelper.execute();

    // Initialize the Version Check Tick Handler (Client only)
    TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT);

    // Initialize the Render Tick Handler (Client only)
    proxy.registerRenderTickHandler();

    // Register the KeyBinding Handler (Client only)
    proxy.registerKeyBindingHandler();

    // Register the Sound Handler (Client only)
    proxy.registerSoundHandler();

    // Initialize mod blocks
    ModBlocks.init();

    // Initialize mod items
    ModItems.init();
  }

  @SuppressWarnings("unchecked")
  @Init
  public void load(FMLInitializationEvent event) {

    // Register the GUI Handler
    NetworkRegistry.instance().registerGuiHandler(instance, proxy);

    // Register the PlayerDestroyItem Handler
    MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler());

    // Register the Item Pickup Handler
    MinecraftForge.EVENT_BUS.register(new ItemEventHandler());

    // Register the EntityLiving Handler
    MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());

    MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());

    MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());

    GameRegistry.registerCraftingHandler(new CraftingHandler());

    // Register the DrawBlockHighlight Handler
    proxy.registerDrawBlockHighlightHandler();

    // Initialize mod tile entities
    proxy.registerTileEntities();

    // Initialize custom rendering and pre-load textures (Client only)
    proxy.initRenderingAndTextures();

    // Add in the ability to dye Alchemical Bags
    CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());

    // Register the Fuel Handler
    GameRegistry.registerFuelHandler(new FuelHandler());

    // Quick test to see that sending an encoded recipe to be added to the recipe registry works
    FMLInterModComms.sendMessage(
        Reference.MOD_ID,
        InterModComms.ADD_RECIPE,
        NBTHelper.encodeRecipeAsNBT(
            Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill)));
    FMLInterModComms.sendMessage(
        Reference.MOD_ID,
        InterModComms.ADD_RECIPE,
        NBTHelper.encodeRecipeAsNBT(
            Item.bucketLava, Arrays.asList(Item.bucketEmpty, Block.lavaStill)));
  }

  @PostInit
  public void modsLoaded(FMLPostInitializationEvent event) {

    // Initialize the Addon Handler
    AddonHandler.init();

    // Initialize the DynEMC system
    @SuppressWarnings("unused")
    DynEMC dynEMC = DynEMC.getInstance();
  }

  @IMCCallback
  public void handleIMCMessages(IMCEvent event) {

    InterModCommsHandler.processIMCMessages(event);
  }
}
Exemplo n.º 22
0
@Mod(modid = NeoCraft.modid, name = "NeoCraft", version = "1.0.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class NeoCraft {

  @Instance(NeoCraft.modid)
  public static NeoCraft instance;

  @SidedProxy(
      clientSide = "nucleon.neocraft.client.ClientProxy",
      serverSide = "nucleon.neocraft.CommonProxy")
  public static CommonProxy proxy;

  public static final String modid = "nucleon_neocraft";

  public static final CreativeTabNeoCraft ctab =
      new CreativeTabNeoCraft(net.minecraft.creativetab.CreativeTabs.getNextID(), "NeoCraft");

  Configuration config;

  // Items ============================//
  public static Item ingotChromium;
  public static Item ingotSteel;
  public static Item ingotStainlessSteel;
  public static Item circuitBoard;

  @PreInit
  public void preInit(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    config.save();
  }

  @Init
  public void load(FMLInitializationEvent event) {
    ingotChromium =
        new ItemBase(
            config.get(Configuration.CATEGORY_ITEM, "ingotChromium", 5501).getInt(),
            "ingotChromium");
    ingotSteel =
        new ItemBase(
            config.get(Configuration.CATEGORY_ITEM, "ingotSteel", 5502).getInt(), "ingotSteel");
    ingotStainlessSteel =
        new ItemBase(
            config.get(Configuration.CATEGORY_ITEM, "ingotStainlessSteel", 5503).getInt(),
            "ingotStainlessSteel");
    circuitBoard =
        new ItemBase(
            config.get(Configuration.CATEGORY_ITEM, "circuitBoard", 5504).getInt(), "circuitBoard");

    LanguageRegistry.addName(ingotChromium, "Chromium Ingot");
    LanguageRegistry.addName(ingotSteel, "Steel Ingot");
    LanguageRegistry.addName(ingotStainlessSteel, "Stainless Steel Ingot");
    LanguageRegistry.addName(circuitBoard, "Circuit Board");

    GameRegistry.addRecipe(
        new ItemStack(ingotSteel), "0y0", "yxy", "0y0", 'x', Item.ingotIron, 'y', Item.coal);
    GameRegistry.addRecipe(
        new ItemStack(ingotStainlessSteel, 9),
        "yyy",
        "yxy",
        "yyy",
        'x',
        ingotChromium,
        'y',
        ingotSteel);

    config.save();
  }
}
Exemplo n.º 23
0
  private void setCurrentCreativeTab(CreativeTabs p_147050_1_) {
    if (p_147050_1_ == null) return;
    int i = selectedTabIndex;
    selectedTabIndex = p_147050_1_.getTabIndex();
    CreativeInv.ContainerCreative containercreative =
        (CreativeInv.ContainerCreative) this.inventorySlots;
    this.field_147008_s.clear();
    containercreative.itemList.clear();
    p_147050_1_.displayAllReleventItems(containercreative.itemList);

    if (p_147050_1_ == CreativeTabs.tabInventory) {
      Container container = this.mc.thePlayer.inventoryContainer;

      if (this.field_147063_B == null) {
        this.field_147063_B = containercreative.inventorySlots;
      }

      containercreative.inventorySlots = new ArrayList();

      for (int j = 0; j < container.inventorySlots.size(); ++j) {
        CreativeInv.CreativeSlot creativeslot =
            new CreativeInv.CreativeSlot((Slot) container.inventorySlots.get(j), j);
        containercreative.inventorySlots.add(creativeslot);
        int k;
        int l;
        int i1;

        if (j >= 5 && j < 9) {
          k = j - 5;
          l = k / 2;
          i1 = k % 2;
          creativeslot.xDisplayPosition = 9 + l * 54;
          creativeslot.yDisplayPosition = 6 + i1 * 27;
        } else if (j >= 0 && j < 5) {
          creativeslot.yDisplayPosition = -2000;
          creativeslot.xDisplayPosition = -2000;
        } else if (j < container.inventorySlots.size()) {
          k = j - 9;
          l = k % 9;
          i1 = k / 9;
          creativeslot.xDisplayPosition = 9 + l * 18;

          if (j >= 36) {
            creativeslot.yDisplayPosition = 112;
          } else {
            creativeslot.yDisplayPosition = 54 + i1 * 18;
          }
        }
      }

      this.field_147064_C = new Slot(field_147060_v, 0, 173, 112);
      containercreative.inventorySlots.add(this.field_147064_C);
    } else if (i == CreativeTabs.tabInventory.getTabIndex()) {
      containercreative.inventorySlots = this.field_147063_B;
      this.field_147063_B = null;
    }

    if (this.searchField != null) {
      if (p_147050_1_.hasSearchBar()) {
        this.searchField.setVisible(true);
        this.searchField.setCanLoseFocus(false);
        this.searchField.setFocused(true);
        this.searchField.setText("");
        this.updateCreativeSearch();
      } else {
        this.searchField.setVisible(false);
        this.searchField.setCanLoseFocus(true);
        this.searchField.setFocused(false);
      }
    }

    this.currentScroll = 0.0F;
    containercreative.scrollTo(0.0F);
  }
Exemplo n.º 24
0
@Mod(
    modid = DeeperCaves.MODID,
    version = DeeperCaves.VERSION,
    name = DeeperCaves.NAME) // , guiFactory = "com.kpabr.DeeperCaves.EndPlusConfigGUIFactory")
public class DeeperCaves {
  @SidedProxy(
      clientSide = "com.kpabr.DeeperCaves.client.ClientProxy",
      serverSide = "com.kpabr.DeeperCaves.CommonProxy")
  public static CommonProxy proxy;

  /*Mod ID and Version declarations*/
  public static final String MODID = "DeeperCaves";
  public static final String VERSION = "0.3.0";
  public static final String NAME = "DeeperCaves";
  static int versionID = 6; // Used by version checker!

  static DeeperMaterials materials = new DeeperMaterials();
  static DeeperBlocks blocks = new DeeperBlocks();
  static DeeperFluids fluids = new DeeperFluids();
  static DeeperItems items = new DeeperItems();
  static DeeperRecipes recipes = new DeeperRecipes();
  static DeeperWorldgen worldgen = new DeeperWorldgen();
  static DeeperMobs mobs = new DeeperMobs();
  static DeeperVersionChecker versionChecker = new DeeperVersionChecker();
  public static DeeperCaves instance;
  public static Configuration config;
  public int nearvoid_counter = 0;

  static CreativeTabs tabDeeperCaves =
      new TabDeeperCavesBlocks(
          CreativeTabs.getNextID(), "Deeper Caves Blocks", DeeperCaves.blocks.fragmentedBedrock);
  static CreativeTabs tabDeeperCavesItems =
      new TabDeeperCaves(CreativeTabs.getNextID(), "Deeper Caves Items", 0);
  static CreativeTabs tabDeeperCavesTools =
      new TabDeeperCaves(CreativeTabs.getNextID(), "Deeper Caves Tools", 1);

  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile()); // gets default config file

    this.instance = this;

    FMLCommonHandler.instance().bus().register(worldgen);
    MinecraftForge.EVENT_BUS.register(worldgen);

    FMLCommonHandler.instance().bus().register(versionChecker);
    MinecraftForge.EVENT_BUS.register(versionChecker);

    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);

    ClientCommandHandler.instance.registerCommand(new VersionCommand());

    fluids.setupFluids();
    fluids.setupFluidBlocks();
    items.setupItems();
    items.registerItems();
    items.registerItemsOreDict();
    blocks.setupBlocks();
    blocks.registerBlocks();
    blocks.registerBlocksOreDict();
    blocks.setupHarvestLevels();
    recipes.setupShapelessCrafting();
    recipes.setupShapedCrafting();
    recipes.setupSmelting();
    worldgen.setupWorldgen();
    mobs.setupMobs();
    proxy.registerRenderers();
  }

  @SubscribeEvent
  public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    if (event.player.posY <= 0.0D) {
      try {
        EntityPlayerMP player = (EntityPlayerMP) event.player;
        if (player.dimension == 22) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 0, new DeeperTeleporter(player.mcServer.worldServerForDimension(0)));
        }
        if (player.dimension == 15) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 22, new DeeperTeleporter(player.mcServer.worldServerForDimension(22)));
        } else if (player.dimension == 0) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 7, new DeeperTeleporter(player.mcServer.worldServerForDimension(7)));
        } else if (player.dimension == 12) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 14, new DeeperTeleporter(player.mcServer.worldServerForDimension(14)));
        } else if (player.dimension >= 7 && player.dimension < 15) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player,
                  player.dimension + 1,
                  new DeeperTeleporter(
                      player.mcServer.worldServerForDimension(player.dimension + 1)));
        } else {
        }
      } catch (ClassCastException e) {
        return; // not a player
      }
    } else if (event.player.posY >= 255.0D) {
      try {
        EntityPlayerMP player = (EntityPlayerMP) event.player;
        if (player.dimension == 7) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 0, new DeeperTeleporter(player.mcServer.worldServerForDimension(0)));
        } else if (player.dimension == 15) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player,
                  player.dimension - 2,
                  new DeeperTeleporter(
                      player.mcServer.worldServerForDimension(player.dimension - 2)));
        } else if (player.dimension > 7 && player.dimension < 15) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player,
                  player.dimension - 1,
                  new DeeperTeleporter(
                      player.mcServer.worldServerForDimension(player.dimension - 1)));
        }
        if (player.dimension == 22) {
          player
              .mcServer
              .getConfigurationManager()
              .transferPlayerToDimension(
                  player, 15, new DeeperTeleporter(player.mcServer.worldServerForDimension(14)));
        } else {
        }
      } catch (ClassCastException e) {
        return; // not a player
      }
    } else {
    }
    try {
      EntityPlayerMP player = (EntityPlayerMP) event.player;
      if (event.player.posY <= 240.0D && player.dimension == 14) {
        if (this.nearvoid_counter == 200) {
          player.attackEntityFrom(DamageSource.outOfWorld, 0.5F);
          this.nearvoid_counter = 0;
        } else {
          this.nearvoid_counter = this.nearvoid_counter + 1;
        }
      }
    } catch (ClassCastException e) {
      return; // not a player
    }
  }
}
Exemplo n.º 25
0
 public EETab(String par2Str) {
   super(CreativeTabs.getNextID(), par2Str);
   LanguageRegistry.instance()
       .addStringLocalization("itemGroup.ElectricExpansion", "en_US", "Electric Expansion");
 }
Exemplo n.º 26
0
  protected void drawGuiContainerBackgroundLayer(
      float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.enableGUIStandardItemLighting();
    CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
    CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
    int k = acreativetabs.length;
    int l;

    int start = tabPage * 10;
    k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2));
    if (tabPage != 0) start += 2;

    for (l = start; l < k; ++l) {
      CreativeTabs creativetabs1 = acreativetabs[l];
      this.mc.getTextureManager().bindTexture(field_147061_u);

      if (creativetabs1 == null) continue;
      if (creativetabs1 == creativetabs1.tabInventory) continue;
      if (creativetabs1.getTabIndex() != selectedTabIndex) {
        this.func_147051_a(creativetabs1);
      }
    }

    if (tabPage != 0) {
      if (creativetabs != CreativeTabs.tabAllSearch) {
        this.mc.getTextureManager().bindTexture(field_147061_u);
        func_147051_a(CreativeTabs.tabAllSearch);
      }
      if (creativetabs != CreativeTabs.tabInventory) {
        this.mc.getTextureManager().bindTexture(field_147061_u);
        func_147051_a(CreativeTabs.tabInventory);
      }
    }

    this.mc
        .getTextureManager()
        .bindTexture(
            new ResourceLocation(
                "textures/gui/container/creative_inventory/tab_"
                    + creativetabs.getBackgroundImageName()));

    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int screenwidth = scaledresolution.getScaledWidth();

    this.guiLeft = (int) ((screenwidth - ((this.xSize + this.xSize) / 2)) / 2) + (this.xSize / 2);
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    this.searchField.drawTextBox();

    // Crafting
    ResourceLocation craftingTableGuiTextures =
        new ResourceLocation("textures/gui/container/crafting_table.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
    int b = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(this.guiLeft - 200, b, 0, 0, this.xSize - 20, 80);
    // Crafting

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int i1 = this.guiLeft + 175;
    k = this.guiTop + 18;
    l = k + 112;
    this.mc.getTextureManager().bindTexture(field_147061_u);

    if (creativetabs.shouldHidePlayerInventory()) {
      this.drawTexturedModalRect(
          i1,
          k + (int) ((float) (l - k - 17) * this.currentScroll),
          232 + (this.needsScrollBars() ? 0 : 12),
          0,
          12,
          15);
    }

    if (creativetabs == null || creativetabs.getTabPage() != tabPage) {
      if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) {
        return;
      }
    }

    this.func_147051_a(creativetabs);

    if (creativetabs == CreativeTabs.tabInventory) {
      GuiInventory.func_147046_a(
          this.guiLeft + 43,
          this.guiTop + 45,
          20,
          (float) (this.guiLeft + 43 - p_146976_2_),
          (float) (this.guiTop + 45 - 30 - p_146976_3_),
          this.mc.thePlayer);
    }
  }
@Mod(
    modid = LibModInfo.ID,
    name = LibModInfo.NAME,
    version = LibModInfo.VERSION,
    guiFactory = LibModInfo.GUI_FACTORY_CLASS)
public class ArmourersWorkshop {

  @Mod.Instance(LibModInfo.ID)
  public static ArmourersWorkshop instance;

  @SidedProxy(
      clientSide = LibModInfo.PROXY_CLIENT_CLASS,
      serverSide = LibModInfo.PROXY_COMMNON_CLASS)
  public static CommonProxy proxy;

  public static ModCreativeTab creativeTabArmorersWorkshop = new ModCreativeTab(LibModInfo.ID);
  public static CreativeTabArmourersWorkshop tabArmorersWorkshop =
      new CreativeTabArmourersWorkshop(CreativeTabs.getNextID(), LibModInfo.ID.toLowerCase());

  public static ModItems modItems;
  public static ModBlocks modBlocks;

  @Mod.EventHandler
  public void perInit(FMLPreInitializationEvent event) {
    ModLogger.log("Loading " + LibModInfo.NAME + " " + LibModInfo.VERSION);
    creativeTabArmorersWorkshop.setMinecraftCreativeTab(tabArmorersWorkshop);
    ConfigHandler.init(event.getSuggestedConfigurationFile());

    Addons.preInit();
    proxy.preInit();

    SkinIOUtils.makeLibraryDirectory();
    UpdateCheck.checkForUpdates();
    SkinExtractor.extractSkins();

    modItems = new ModItems();
    modBlocks = new ModBlocks();

    SkinTypeRegistry.init();
    CubeRegistry.init();
    proxy.initLibraryManager();
  }

  @Mod.EventHandler
  public void load(FMLInitializationEvent event) {
    CraftingManager.init();

    modBlocks.registerTileEntities();

    new GuiHandler();
    new ConfigSynchronizeHandler();

    PacketHandler.init();
    EntityEquipmentDataManager.init();
    EntitySkinHandler.init();

    proxy.init();
    proxy.registerKeyBindings();
    proxy.initRenderers();

    Addons.init();
  }

  @Mod.EventHandler
  public void postInit(FMLPostInitializationEvent event) {
    proxy.postInit();
    Addons.postInit();
    proxy.libraryManager.reloadLibrary();
  }

  @Mod.EventHandler
  public void serverStart(FMLServerStartingEvent event) {
    event.registerServerCommand(new CommandArmourers());
    SkinDataCache.INSTANCE.serverStarted();
  }

  @Mod.EventHandler
  public void serverStopped(FMLServerStoppedEvent event) {
    SkinDataCache.INSTANCE.serverStopped();
  }

  @Mod.EventHandler
  public void processIMC(FMLInterModComms.IMCEvent event) {
    for (IMCMessage imcMessage : event.getMessages()) {
      if (!imcMessage.isStringMessage()) continue;
      if (imcMessage.key.equalsIgnoreCase("register")) {
        ModLogger.log(
            String.format(
                "Receiving registration request from %s for class %s",
                imcMessage.getSender(), imcMessage.getStringValue()));
        ApiRegistrar.INSTANCE.addApiRequest(imcMessage.getSender(), imcMessage.getStringValue());
      }
    }
  }

  public static boolean isDedicated() {
    return proxy.getClass() == CommonProxy.class;
  }
}
Exemplo n.º 28
0
 private static boolean isVanillaTab(CreativeTabs t) {
   return t.getTabIndex() <= 11;
 }
Exemplo n.º 29
0
public class ModBlocks {

  /* Mod Block instances */
  public static Block HarmonionOre;
  public static Block HarmonionBlock;
  public static BlockHarmonionPortal HarmonionPortal;
  public static Block HarmonionFire;
  public static Block HarmonionLog;
  public static Block HarmonionLeaves;
  public static Block HarmonionSapling;
  public static Block HarmonionDoor;
  public static Block HarmonionGlass;

  private static Block blockMachineBeta;

  public static BlockMicro blockPower;
  public static BlockMachine blockMachine;
  public static BlockMachinePanel blockMachinePanel;
  public static BlockAppliance blockAppliance;
  public static int customBlockModel;

  public static final CreativeTabs tabHarmonioncraftB =
      new CreativeTabHarmonionB(CreativeTabs.getNextID(), "HarmonionB");
  public static final CreativeTabs tabHarmonioncraftW =
      new CreativeTabHarmonionP(CreativeTabs.getNextID(), "HarmonionP");

  public static void init() {

    /* Initialize each mod block individually */
    HarmonionOre = new BlockHarmonionOre(Config.getBlockID("blocks.base.harmonionore.id"), 0);
    HarmonionBlock = new BlockHarmonionBlock(Config.getBlockID("blocks.base.harmonionblock.id"), 3);
    HarmonionLog = new BlockHarmonionLog(Config.getBlockID("blocks.base.harmonionlog.id"));
    HarmonionLeaves = new BlockHarmonionLeaves(Config.getBlockID("blocks.base.harmonionleaves.id"));
    HarmonionSapling =
        new BlockHarmonionSapling(Config.getBlockID("blocks.base.harmonionsapling.id"), 13);
    HarmonionDoor =
        new BlockHarmonionDoor(
            Config.getBlockID("blocks.base.harmoniondoor.id"), 11, 12, Material.iron);
    HarmonionGlass =
        new BlockHarmonionGlass(
            Config.getBlockID("blocks.base.harmonionglass.id"), 4, Material.glass, false);
    HarmonionPortal =
        (BlockHarmonionPortal)
            ((BlockHarmonionPortal)
                (new BlockHarmonionPortal(
                    Config.getBlockID("blocks.base.harmonionportal.id"), 14)));
    HarmonionFire =
        (new BlockHarmonionFire(
            Config.getBlockID("blocks.base.harmonionfire.id"), Block.fire.blockIndexInTexture));

    blockPower = new BlockMicro(Config.getBlockID("blocks.base.harmonionwire.id"));
    blockPower.setBlockName("Harmonionwire");
    GameRegistry.registerBlock(blockPower, ItemMicro.class, "micro");
    blockPower.addTileEntityMapping(0, TileCovered.class);
    CoverLib.blockCoverPlate = blockPower;

    blockMachine = new BlockMachine(Config.getBlockID("blocks.base.harmonionmachine.id"));
    blockMachine.setBlockName("Harmonionmachine");
    GameRegistry.registerBlock(blockMachine, ItemExtended.class, "machine");
    blockMachine.setItemName(0, "Harmonionbatbox");
    GameRegistry.registerTileEntity(TileBatteryBox.class, "HarmoionBatBox");
    blockMachine.addTileEntityMapping(0, TileBatteryBox.class);

    blockMachinePanel =
        new BlockMachinePanel(Config.getBlockID("blocks.base.harmonionmachinepanel.id"));
    GameRegistry.registerBlock(blockMachinePanel, ItemMachinePanel.class, "machinePanel");
    GameRegistry.registerTileEntity(TileSolarPanel.class, "HarmonionSolar");
    blockMachinePanel.addTileEntityMapping(0, TileSolarPanel.class);
    blockMachinePanel.setItemName(0, "Harmonionsolar");

    blockAppliance = new BlockAppliance(Config.getBlockID("blocks.base.harmonionappliance.id"));
    GameRegistry.registerBlock(blockAppliance, ItemExtended.class, "appliance");
    GameRegistry.registerTileEntity(TileChargingBench.class, "HarmonionCharge");
    blockAppliance.setItemName(0, "harmonioncharge");
    blockAppliance.addTileEntityMapping(0, TileChargingBench.class);

    int var1;
    int var2;
    HarmonionLib.addCompatibleMapping(0, 1);

    for (var1 = 0; var1 < 16; ++var1) {
      HarmonionLib.addCompatibleMapping(0, 2 + var1);
      HarmonionLib.addCompatibleMapping(1, 2 + var1);
      HarmonionLib.addCompatibleMapping(65, 2 + var1);

      for (var2 = 0; var2 < 16; ++var2) {
        HarmonionLib.addCompatibleMapping(19 + var2, 2 + var1);
      }

      HarmonionLib.addCompatibleMapping(18, 2 + var1);
      HarmonionLib.addCompatibleMapping(18, 19 + var1);
    }

    HarmonionLib.addCompatibleMapping(0, 65);
    HarmonionLib.addCompatibleMapping(1, 65);
    HarmonionLib.addCompatibleMapping(64, 65);
    HarmonionLib.addCompatibleMapping(64, 67);
    HarmonionLib.addCompatibleMapping(65, 67);
    HarmonionLib.addCompatibleMapping(66, 67);

    /* Adds Blocks into the game */
    OreDictionary.registerOre("HarmonionOre", HarmonionOre);
    GameRegistry.registerBlock(HarmonionOre, BlockOresMeta.class);
    GameRegistry.registerBlock(HarmonionLeaves);
    GameRegistry.registerBlock(HarmonionLog);
    GameRegistry.registerBlock(HarmonionDoor);
    GameRegistry.registerBlock(HarmonionGlass);

    GameRegistry.registerBlock(HarmonionBlock);
    GameRegistry.registerBlock(HarmonionPortal);
    GameRegistry.registerBlock(HarmonionFire);

    DimensionManager.registerProviderType(
        Config.getBlockID("dimension.dimension.id"), WorldProviderHarmonion.class, false);
    DimensionManager.registerDimension(
        Config.getBlockID("dimension.dimension.id"), Config.getBlockID("dimension.dimension.id"));

    /* WorldGen */
    GameRegistry.registerWorldGenerator(new WorldPopulator());

    EnumMachineBeta[] var6 = EnumMachineBeta.values();
    int var3 = var6.length;
    int var4;
    var3 = var6.length;

    for (var4 = 0; var4 < var3; ++var4) {
      EnumMachineBeta var12 = var6[var4];

      if (var12.isEnabled()) {
        ItemRegistry.registerItem(var12.getTag(), var12.getItem());
      }
    }
  }

  public static void initBlockSmelting() {

    FurnaceRecipes furnaceRecipes = FurnaceRecipes.smelting();

    /* Harmonon Ore Smelting. */
    furnaceRecipes.addSmelting(
        ModBlocks.HarmonionOre.blockID, new ItemStack(ModItems.Refinedsoundstone), 5.0F);
  }

  public static void registerBlockMachineBeta() {
    if (blockMachineBeta == null) {
      int var0 = Config.getBlockID("blocks.base.harmoniontank.id");

      if (var0 > 0) {
        int var1 = Harmonion.proxy.getRenderIdTank();
        int[] var2 = new int[16];
        Arrays.fill(var2, 255);
        var2[EnumMachineBeta.TANK_IRON_WALL.ordinal()] = 0;
        var2[EnumMachineBeta.TANK_IRON_VALVE.ordinal()] = 0;
        var2[EnumMachineBeta.TANK_IRON_GAUGE.ordinal()] = 0;
        blockMachineBeta =
            (new net.Harmonion.tanks.BlockMachine(var0, var1, new MachineProxyBeta(), false, var2))
                .setBlockName("rcBlockMachineBeta");
        GameRegistry.registerBlock(
            blockMachineBeta, ItemMachine.class, blockMachineBeta.getBlockName());
        EnumMachineBeta[] var3 = EnumMachineBeta.values();
        int var4 = var3.length;

        for (int var5 = 0; var5 < var4; ++var5) {
          EnumMachineBeta var6 = var3[var5];
          MinecraftForge.setBlockHarvestLevel(blockMachineBeta, var6.ordinal(), "pickaxe", 2);
        }
      }
    }
  }

  public static Block getBlockMachineBeta() {
    return blockMachineBeta;
  }
}