public InventoryTweaksModule() { try { this.api = (InvTweaksAPI) Class.forName( "invtweaks.forge.InvTweaksMod", true, Loader.instance().getModClassLoader() ) .getField( "instance" ) .get( null ); } catch( Exception ex ) { } }
public void preInit() { if(!Loader.instance().isInState(LoaderState.PREINITIALIZATION)) { TConstruct.log.error( "Proxy.preInit has to be called during Pre-Initialisation."); } }
public void init() { if(!Loader.instance().isInState(LoaderState.INITIALIZATION)) { TConstruct.log.error( "Proxy.init has to be called during Initialisation."); } }
public void postInit() { if(!Loader.instance().isInState(LoaderState.POSTINITIALIZATION)) { TConstruct.log.error( "Proxy.postInit has to be called during Post-Initialisation."); } }
public void registerModels() { if(Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { TConstruct.log.error( "Proxy.registerModels has to be called during preInit. Otherwise the models wont be found on first load."); } }
static void putMaterialTrace(String materialIdentifier) { ModContainer activeMod = Loader.instance().activeModContainer(); materialRegisteredByMod.put(materialIdentifier, activeMod); }
/** * Registers a SubTileEntity, a new special flower. Look in the subtile package of the API. * Call this during {@code RegistryEvent.Register<Block>}, and don't forget to register a model in BotaniaAPIClient. */ public static void registerSubTile(String key, Class<? extends SubTileEntity> subtileClass) { subTiles.put(key, subtileClass); subTileMods.put(key, Loader.instance().activeModContainer().getModId()); }
protected TinkerCraftingEvent(ItemStack itemStack, EntityPlayer player, String message) { this.itemStack = itemStack; this.player = player; message += "\n" + TextFormatting.ITALIC + "by " + Loader.instance().activeModContainer().getName(); this.message = message; }
public AERecipeLoader() { this.mod = Loader.instance().getIndexedModList().get( AppEng.MOD_ID ); this.ctx = new JsonContext( AppEng.MOD_ID ); this.initFactories(); }
public static void addTrait(ITrait trait) { // Trait might already have been registered since modifiers and materials share traits if(traits.containsKey(trait.getIdentifier())) { return; } traits.put(trait.getIdentifier(), trait); ModContainer activeMod = Loader.instance().activeModContainer(); putTraitTrace(trait.getIdentifier(), trait, activeMod); }
public static boolean isModLoaded( final String modid ) { try { // if this fails for some reason, try the other method. return Loader.isModLoaded( modid ); } catch( final Throwable ignored ) { } for( final ModContainer f : Loader.instance().getActiveModList() ) { if( f.getModId().equals( modid ) ) { return true; } } return false; }
@Override public void transform(BookData book, SectionData data) { ContentListing listing = new ContentListing(); listing.title = book.translate(sectionName); addPage(data, sectionName, "", listing); // don't do stuff during preinit etc, we only want to fill it once everything is added if(!Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION)) { return; } MATERIAL_TYPES_ON_DISPLAY.forEach(type -> { int pageIndex = data.pages.size(); generateContent(type, data); if(pageIndex < data.pages.size()) { listing.addEntry(getStatName(type), data.pages.get(pageIndex)); } }); }
@Override protected void renderHoveredToolTip( int mouseX, int mouseY ) { final Slot slot = this.getSlot( mouseX, mouseY ); if( slot != null && slot instanceof IMEFluidSlot && slot.isEnabled() ) { final IMEFluidSlot fluidSlot = (IMEFluidSlot) slot; if( fluidSlot.getAEFluidStack() != null && fluidSlot.shouldRenderAsFluid() ) { final IAEFluidStack fluidStack = fluidSlot.getAEFluidStack(); final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( fluidStack.getStackSize() / 1000.0 ) + " B"; final String modName = "" + TextFormatting.BLUE + TextFormatting.ITALIC + Loader.instance() .getIndexedModList() .get( Platform.getModId( fluidStack ) ) .getName(); final List<String> list = new ArrayList<>(); list.add( fluidStack.getFluidStack().getLocalizedName() ); list.add( formattedAmount ); list.add( modName ); this.drawHoveringText( list, mouseX, mouseY ); return; } } super.renderHoveredToolTip( mouseX, mouseY ); }
ModContainer activeMod = Loader.instance().activeModContainer(); putStatTrace(identifier, stats, activeMod);
final Loader loader = Loader.instance(); final List<ModContainer> mods = loader.getActiveModList();
@Override public void registerCustomEMC(@Nonnull Object o, long value) { Preconditions.checkNotNull(o); boolean flag = Loader.instance().isInState(LoaderState.PREINITIALIZATION) || Loader.instance().isInState(LoaderState.INITIALIZATION) || Loader.instance().isInState(LoaderState.POSTINITIALIZATION); Preconditions.checkState(flag, String.format("Mod %s tried to register EMC at an invalid time!", Loader.instance().activeModContainer().getModId())); APICustomEMCMapper.instance.registerCustomEMC(o, value); PECore.debugLog("Mod {} registered emc value {} for Object {}", Loader.instance().activeModContainer().getModId(), value, o); }
@Override public void blacklistInterdiction(@Nonnull Class<? extends Entity> clazz) { Preconditions.checkNotNull(clazz); Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering interdiction blacklist at incorrect time!", Loader.instance().activeModContainer().getModId()); doBlacklistInterdiction(clazz, Loader.instance().activeModContainer().getModId()); }
@Override public void blacklistSwiftwolf(@Nonnull Class<? extends Entity> clazz) { Preconditions.checkNotNull(clazz); Preconditions.checkState(Loader.instance().isInState(LoaderState.POSTINITIALIZATION), "Mod %s registering SWRG repel at incorrect time!", Loader.instance().activeModContainer().getModId()); doBlacklistSwiftwolf(clazz, Loader.instance().activeModContainer().getModId()); }
final ModContainer imb = net.minecraftforge.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" ); if( imb != null )
@SubscribeEvent(priority = EventPriority.LOW) public static void registerAddonBlocks(@Nonnull RegistryEvent.Register<Block> event) { for (ModContainer modContainer : Loader.instance().getModList()) { Object mod = modContainer.getMod(); if (mod instanceof IEnderIOAddon) { ((IEnderIOAddon) mod).injectBlocks(NullHelper.notnullF(event.getRegistry(), "RegistryEvent.Register<Block>.getRegistry()")); } } }