当前位置: 首页>>代码示例>>Java>>正文


Java LoaderState类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.LoaderState的典型用法代码示例。如果您正苦于以下问题:Java LoaderState类的具体用法?Java LoaderState怎么用?Java LoaderState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoaderState类属于net.minecraftforge.fml.common包,在下文中一共展示了LoaderState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Nonnull
@Override
public Fluid get() {
  if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) {
    return defaultValue;
  }
  if (defaultFluid == null) {
    FluidRegistry.getFluid(defaultValueName);
  }
  if (value == null || valueGeneration != generation) {
    if (serverConfig != null && serverConfig.containsKey(keyname)) {
      value = FluidRegistry.getFluid((String) serverConfig.get(keyname));
    } else {
      value = FluidRegistry.getFluid(config.getString(keyname, section, defaultValueName, text));
      if (!inInit && config.hasChanged()) {
        config.save();
      }
    }
    valueGeneration = generation;
  }
  return NullHelper.first(value, defaultFluid, defaultValue);
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:23,代码来源:ValueFactory.java

示例2: isIc2Available

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
public static boolean isIc2Available() {
	if (ic2Available != null) return ic2Available;

	boolean loaded = Loader.isModLoaded("IC2");

	if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) {
		ic2Available = loaded;
	}

	return loaded;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:12,代码来源:Info.java

示例3: registerRecipe

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Load(LoaderState.INITIALIZATION)
public void registerRecipe(){
    itemSet.forEach(item -> {
        if (item.getItem() instanceof IRecipeProvider) {
            // check is a provider
            IRecipeProvider provider = (IRecipeProvider) item.getItem();
            Arrays.stream(provider.createRecipes()).forEach(GameData::register_impl);
        } else if (item.getItem() instanceof IRecipe){
            // check if is a recipe
            registerRecipe(item.getAnnotation().value(), (IRecipe) item.getItem());
        }
    });
}
 
开发者ID:MinecraftPangu,项目名称:Pangu,代码行数:14,代码来源:RecipeRegister.java

示例4: enqueueStartupMessage

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
private static boolean enqueueStartupMessage(String modTarget, IMCMessage message)
{
    if (Loader.instance().activeModContainer() == null)
    {
        return false;
    }
    enqueueMessage(Loader.instance().activeModContainer(), modTarget, message);
    return Loader.isModLoaded(modTarget) && !Loader.instance().hasReachedState(LoaderState.POSTINITIALIZATION);

}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:FMLInterModComms.java

示例5: enableUniversalBucket

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
/**
 * Enables the universal bucket in forge.
 * Has to be called before pre-initialization.
 * Actually just call it statically in your mod class.
 */
public static void enableUniversalBucket()
{
    if (Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION))
    {
        FMLLog.getLogger().log(Level.ERROR, "Trying to activate the universal filled bucket too late. Call it statically in your Mods class. Mod: {}", Loader.instance().activeModContainer().getName());
    }
    else
    {
        universalBucketEnabled = true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:FluidRegistry.java

示例6: setPermissionHandler

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
/**
 * <b>Only use this in PreInit state!</b>
 */
public static void setPermissionHandler(IPermissionHandler handler)
{
    Preconditions.checkNotNull(handler, "Permission handler can't be null!");
    Preconditions.checkState(Loader.instance().getLoaderState().ordinal() <= LoaderState.PREINITIALIZATION.ordinal(), "Can't register after IPermissionHandler PreInit!");
    FMLLog.log(Level.WARN, "Replacing " + permissionHandler.getClass().getName() + " with " + handler.getClass().getName());
    permissionHandler = handler;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:PermissionAPI.java

示例7: registerNode

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
/**
 * <b>Only use this after PreInit state!</b>
 *
 * @param node  Permission node, best if it's lowercase and contains '.' (e.g. <code>"modid.subgroup.permission_id"</code>)
 * @param level Default permission level for this node. If not isn't registered, it's level is going to be 'NONE'
 * @param desc  Optional description of the node
 */
public static String registerNode(String node, DefaultPermissionLevel level, String desc)
{
    Preconditions.checkNotNull(node, "Permission node can't be null!");
    Preconditions.checkNotNull(level, "Permission level can't be null!");
    Preconditions.checkNotNull(desc, "Permission description can't be null!");
    Preconditions.checkArgument(!node.isEmpty(), "Permission node can't be empty!");
    Preconditions.checkState(Loader.instance().getLoaderState().ordinal() > LoaderState.PREINITIALIZATION.ordinal(), "Can't register permission nodes before Init!");
    permissionHandler.registerNode(node, level, desc);
    return node;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:PermissionAPI.java

示例8: construct

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void construct(FMLConstructionEvent event) {
    super.construct(event);
    getLoaderManager().invoke(event, LoaderState.CONSTRUCTING, Side.CLIENT);
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:6,代码来源:ClientProxy.java

示例9: loadDrinkRecipes

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Load(LoaderState.AVAILABLE)
    public void loadDrinkRecipes() {
        FruitEnumLoader fruitLoader = FoodCraftReloaded.getProxy().getLoaderManager().getLoader(FruitEnumLoader.class).get();
        VegetableEnumLoader vegetableLoader = FoodCraftReloaded.getProxy().getLoaderManager().getLoader(VegetableEnumLoader.class).get();
        for (FruitType fruitType : FruitType.values()) {
            RecipeManager.getInstance().addRecipe(new DrinkRecipe(new ItemStack[]{new ItemStack(fruitLoader.getInstanceMap(ItemFruit.class).get(fruitType))}, new FluidStack(fruitLoader.getFluidJuiceEnumMap().get(fruitType), 1000)));
        }
        for (VegetableType vegetableType : VegetableType.values()) {
            RecipeManager.getInstance().addRecipe(new DrinkRecipe(new ItemStack[]{new ItemStack(vegetableLoader.getInstanceMap(ItemVegetable.class).get(vegetableType))}, new FluidStack(vegetableLoader.getFluidJuiceEnumMap().get(vegetableType), 1000)));
        }
//        ForgeRegistries.RECIPES.register(new CakeRecipe().setRegistryName(FoodCraftReloaded.MODID, "cake_recipe"));
    }
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:13,代码来源:RecipeLoader.java

示例10: loadColors

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Load(side = Side.CLIENT, value = LoaderState.POSTINITIALIZATION)
@SideOnly(Side.CLIENT)
public void loadColors() {
    try {
        Field field = ItemColors.class.getDeclaredField("itemColorMap");
        field.setAccessible(true);
        Map<IRegistryDelegate<Item>, IItemColor> itemColorMap = (Map<IRegistryDelegate<Item>, IItemColor>) field.get(Minecraft.getMinecraft().getItemColors());
        cachedLiqueurs.forEach(liqueur -> itemColorMap.entrySet().stream().filter(entry -> entry.getKey().get().equals(liqueur)).forEach(entry -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(entry.getValue(), entry.getKey().get())));
    } catch (Exception e) {
        FoodCraftReloaded.getLogger().error("Cannot get custom mesh definitions", e);
    }
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:13,代码来源:LiqueurLoader.java

示例11: tileCompat

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@SubscribeEvent
public static void tileCompat(AttachCapabilitiesEvent<TileEntity> ace) {
	if (Loader.instance().hasReachedState(LoaderState.SERVER_ABOUT_TO_START)) {
		final TileEntity te = ace.getObject();
		if (te == null || blacklisted(te)) return;
		ace.addCapability(COMPAT, new LazyEnergyCapProvider(te));
	}
}
 
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:9,代码来源:FluxCompat.java

示例12: registerEntity

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
/** Registers an entity as possible backpack carrier, meaning
 *  they'll get constructed with an IBackpack capability.
 *  Must be called in pre-initialization phase (or before). */
public static void registerEntity(String entityID, RenderOptions renderOptions) {
	if (entityID == null) throw new NullPointerException("entityID must not be null");
	if (getDefaultEntityEntry(entityID) != null)
		throw new IllegalArgumentException("entityID '" + entityID + "' has already been registered");
	if (Loader.instance().getLoaderState().compareTo(LoaderState.PREINITIALIZATION) > 0)
		throw new IllegalStateException("Must be called during (or before) pre-initialization phase.");
	_defaultEntities.add(new BackpackEntityEntry(entityID, renderOptions, new ArrayList<>(), true));
}
 
开发者ID:copygirl,项目名称:WearableBackpacks,代码行数:12,代码来源:BackpackRegistry.java

示例13: registerBackpack

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
/** Registers a backpack to randomly spawn on the specified entity.
 *  Must be called after registerEntity, in pre-initialization phase (or before).
 * 
 * @param entityID   The entity to register to spawn with this backpack.
 * 
 * @param entryID    String uniquely identifying this entry for this entity.
 *                   For example "wearblebackpacks:default".
 * @param backpack   Backpack item ID to spawn on the entity.
 *                   For example "wearablebackpacks:backpack".
 * @param chance     Chance in 1 out of X. For example 100 = 1% and 1000 = 0.1%.
 * @param lootTable  Loot table for the backpack when spawned on this mob (if any).
 * @param colorRange A range of colors to spawn the backpack with, or null if default. 
 **/
public static void registerBackpack(String entityID,
                                    String entryID, String backpack, int chance,
                                    String lootTable, ColorRange colorRange) {
	if (entityID == null) throw new NullPointerException("entityID must not be null");
	if (entryID == null) throw new NullPointerException("entryID must not be null");
	BackpackEntityEntry entityEntry = getDefaultEntityEntry(entityID);
	if (entityEntry == null) new IllegalStateException("entityID '" + entityID + "' has not been registered yet");
	if (entityEntry._backpackEntries.stream().anyMatch(e -> e.id.equals(entryID)))
		throw new IllegalArgumentException("entryID '" + entryID + "' has already been used for entityID '" + entityID + "'");
	if (Loader.instance().getLoaderState().compareTo(LoaderState.PREINITIALIZATION) > 0)
		throw new IllegalStateException("Must be called during (or before) pre-initialization phase.");
	entityEntry._backpackEntries.add(new BackpackEntry(entryID, backpack, chance, lootTable, colorRange, true));
}
 
开发者ID:copygirl,项目名称:WearableBackpacks,代码行数:27,代码来源:BackpackRegistry.java

示例14: registerMessageHandler

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Load(LoaderState.INITIALIZATION)
public static void registerMessageHandler(){
    PanguCore.getNetwork().registerMessage(Handler.class, Context.class, Network.getNextID(), Side.SERVER);
}
 
开发者ID:MinecraftPangu,项目名称:Pangu,代码行数:5,代码来源:KeyMessage.java

示例15: preInit

import net.minecraftforge.fml.common.LoaderState; //导入依赖的package包/类
@Override
public void preInit(FMLPreInitializationEvent event) {
    super.preInit(event);
    Proxy.INSTANCE.invoke(event, LoaderState.PREINITIALIZATION, Side.CLIENT);
}
 
开发者ID:MinecraftPangu,项目名称:Pangu,代码行数:6,代码来源:ClientProxy.java


注:本文中的net.minecraftforge.fml.common.LoaderState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。