本文整理汇总了Java中net.minecraftforge.fml.common.ProgressManager类的典型用法代码示例。如果您正苦于以下问题:Java ProgressManager类的具体用法?Java ProgressManager怎么用?Java ProgressManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgressManager类属于net.minecraftforge.fml.common包,在下文中一共展示了ProgressManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onModelBake
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@SubscribeEvent (priority = EventPriority.HIGHEST)
public void onModelBake(ModelBakeEvent event) {
IModel missingIModel = ModelLoaderRegistry.getMissingModel();
IBakedModel missingModel = missingIModel.bake(missingIModel.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter);
Map<IModel, IBakedModel> bakedModels = new HashMap<>();
HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
Multimaps.invertFrom(Multimaps.forMap(toBake), models);
ProgressBar bar = ProgressManager.push("CCL ModelLoading: Baking", models.keySet().size());
for (IModel model : models.keySet()) {
bar.step(String.format("[%s]", Joiner.on(", ").join(models.get(model))));
if (model == missingIModel) {
bakedModels.put(model, missingModel);
continue;
}
bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter));
}
ProgressManager.pop(bar);
for (Entry<ModelResourceLocation, IModel> entry : toBake.entrySet()) {
event.getModelRegistry().putObject(entry.getKey(), bakedModels.get(entry.getValue()));
}
}
示例2: processSetFiles
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
public void processSetFiles() {
if(setFiles.size() <= 0) return;
// > Be fancy.
ProgressBar setProgress = ProgressManager.push("Processing", setFiles.size());
for(File config : setFiles) {
setProgress.step(config.getName());
LogHelper.info("Reading " + config.getPath());
try {
NashornConfigProcessor.getInstance().ReadConfigFile(config);
} catch (Exception e) {
LogHelper.error("Error processing file " + config.getPath() + ": " + e.getMessage());
}
}
// > Stop being fancy
ProgressManager.pop(setProgress);
}
示例3: init
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
try {
proxy.init(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
ProgressManager.ProgressBar progressBar = ProgressManager.push("Initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
wrapper.init(evt);
});
novaWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
wrapper.init(evt);
});
fmlProgressBar.finish();
ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during init", e);
e.printStackTrace();
throw new InitializationException(e);
}
}
示例4: postInit
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent evt) {
try {
proxy.postInit(evt);
nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.postInit(evt));
Game.recipes().init();
ProgressManager.ProgressBar progressBar = ProgressManager.push("Post-initializing NOVA wrappers", (novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
novaModWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
wrapper.postInit(evt);
});
novaWrappers.stream().forEachOrdered(wrapper -> {
fmlProgressBar.step(wrapper.getClass());
wrapper.postInit(evt);
});
fmlProgressBar.finish();
ProgressManager.pop(progressBar);
} catch (Exception e) {
Game.logger().error("Error during postInit", e);
e.printStackTrace();
throw new InitializationException(e);
}
}
示例5: onResourceManagerReload
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@Override
public void onResourceManagerReload(@Nullable IResourceManager resourceManager) {
ProgressManager.ProgressBar bar = ProgressManager.push("Reloading Sprite Manager", 0);
reloading = true;
for(Map.Entry<ResourceLocation, SpriteResource> entry : SPRITE_RESOURCE_MAP.entrySet()) {
SpriteResource bind = entry.getValue();
bind.reload();
}
reloading = false;
ProgressManager.pop(bar);
}
示例6: onResourceManagerReload
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@Override
public void onResourceManagerReload(IResourceManager manager) {
ProgressManager.ProgressBar bar = ProgressManager.push("Reloading Shader Manager", 0);
reloading = true;
SHADER_RESOURCES.forEach(shader -> shader.reload(manager));
reloading = false;
ProgressManager.pop(bar);
}
示例7: loadRegisteredPatterns
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
/***
* loadRegisteredPatterns() is called on onFMLInitialization after all blocks have been loaded. This allows for
* cross-mod blocks to be used within the structure.
*/
public static void loadRegisteredPatterns()
{
final ProgressBar blockBar = ProgressManager.push("Structure", registeredStructures.size());
for (final Pair<StructureBlock, StructureShapeBlock> strucPair : registeredStructures)
{
final StructureBlock block = strucPair.first();
blockBar.step(block.getLocalizedName());
try
{
block.setStructureDefinition(
block.getStructureBuild().build(),
strucPair.second(),
block.getUnlocalizedName().hashCode()
);
structures.put(block.getUnlocalizedName().hashCode(), block);
} catch (StructureDefinitionError e)
{
throw new StructureDefinitionError(e.getMessage() + " on '" + block.getUnlocalizedName() + '\'');
}
}
ProgressManager.pop(blockBar);
//StructureLogger.info("Analytical Engine constructed " + structures.size() + " noteworthy contraptions");
}
示例8: loadModels
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
static void loadModels() {
ProgressManager.ProgressBar progressBarModels;
progressBarModels = ProgressManager.push("Registry Models", CSRegistryHelper.loadModelList.size());
for (LoadElement el : CSRegistryHelper.loadModelList) {
progressBarModels.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]");
registry(EnumResourceType.MODEL, el.resourceLoc, el.ressourceName);
}
ProgressManager.pop(progressBarModels);
CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s models", CSRegistryHelper.loadModelList.size()));
CSRegistryHelper.loadModelList = null;
}
示例9: loadAnims
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
static void loadAnims() {
ProgressManager.ProgressBar progressBarAnim;
progressBarAnim = ProgressManager.push("Registry Animations", CSRegistryHelper.loadAnimList.size());
for (LoadElement el : CSRegistryHelper.loadAnimList) {
progressBarAnim.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]");
registry(EnumResourceType.ANIM, el.resourceLoc, el.ressourceName);
}
ProgressManager.pop(progressBarAnim);
CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s animations", CSRegistryHelper.loadAnimList.size()));
CSRegistryHelper.loadAnimList = null;
}
示例10: saveGlTexture
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
public static void saveGlTexture(String name, int textureId, int mipmapLevels, File outputFolder) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
ProgressManager.ProgressBar progressBar = ProgressManager.push("Dumping TextureMap to file", mipmapLevels + 1);
for (int level = 0; level <= mipmapLevels; level++) {
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
int size = width * height;
BufferedImage bufferedimage = new BufferedImage(width, height, 2);
String fileName = name + "_mipmap_" + level + ".png";
progressBar.step(fileName);
File output = new File(outputFolder, fileName);
IntBuffer buffer = BufferUtils.createIntBuffer(size);
int[] data = new int[size];
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
buffer.get(data);
bufferedimage.setRGB(0, 0, width, height, data, 0, width);
try {
ImageIO.write(bufferedimage, "png", output);
Log.info("Exported png to: {}", output.getAbsolutePath());
} catch (IOException ioexception) {
Log.info("Unable to write: ", ioexception);
}
}
ProgressManager.pop(progressBar);
}
示例11: processRenderers
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private static void processRenderers() {
log.info("Start processing " + modelList.size() + " models");
ProgressBar bar = ProgressManager.push("Loading Renderers", modelList.size());
for (Entry<Item, Entry<ModelResourceLocation, Integer>> e : modelList) {
addRenderToRegistry(e.getKey(), e.getValue().getValue(), e.getValue().getKey(), bar);
}
log.info("Loaded " + modelList.size() + " models.");
modelList.clear();
ProgressManager.pop(bar);
}
示例12: init
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
/**
* Initializes the operations
*/
void init() {
isInitialized = true;
ProgressManager.ProgressBar setProgress = ProgressManager.push("Initializing", operations.size());
Side curSide = FMLCommonHandler.instance().getEffectiveSide();
for(IOperation op : operations) {
setProgress.step(op.toString());
// If we're not supposed to run here...
if((curSide == Side.CLIENT && !op.isClientOperation())
|| (curSide == Side.SERVER && !op.isServerOperation())) continue;
try {
op.runInit();
} catch (Exception ex) {
LogHelper.error("Error initializing operation.", ex);
}
}
ProgressManager.pop(setProgress);
// So we're only sorting it once...
try {
Collections.sort(operations);
} catch(Exception e) {
LogHelper.error("Error sorting operations in set {}; please report this error.", setName, e);
}
}
示例13: apply
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
void apply() {
ProgressManager.ProgressBar setProgress = ProgressManager.push("Applying", operations.size());
Side curSide = FMLCommonHandler.instance().getEffectiveSide();
for(IOperation op : operations) {
setProgress.step(op.toString());
// If we're not supposed to run here...
if((curSide == Side.CLIENT && !op.isClientOperation())
|| (curSide == Side.SERVER && !op.isServerOperation())
|| !op.shouldApply()) continue;
try {
op.runApply();
}
catch(Exception ex) {
LogHelper.error("Error applying operation.", ex);
}
}
// Remove any operations now...
if(0 < getRemovedSets().length) {
CraftingHarmonicsMod.undoSets(getRemovedSets());
}
if(0 < getDuration()) {
SetManager.setWithDurationApplied(setName, getDuration());
}
ProgressManager.pop(setProgress);
}
示例14: loadModSubsets
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
private static void loadModSubsets() {
ProgressBar bar = ProgressManager.push("Mod Subsets", ForgeRegistries.ITEMS.getKeys().size());
HashMap<String, ItemStackSet> modSubsets = new HashMap<>();
for (Item item : ForgeRegistries.ITEMS) {
ResourceLocation ident = item.getRegistryName();
bar.step(ident.toString());
if (ident == null) {
LogHelper.error("Failed to find identifier for: " + item);
continue;
}
String modId = ident.getResourceDomain();
ItemInfo.itemOwners.put(item, modId);
ItemStackSet itemset = modSubsets.computeIfAbsent(modId, k -> new ItemStackSet());
itemset.with(item);
}
ProgressManager.pop(bar);
API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
for (Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
if (mc == null) {
LogHelper.error("Missing container for " + entry.getKey());
} else {
API.addSubset("Mod." + mc.getName(), entry.getValue());
}
}
}
示例15: loadRagdolls
import net.minecraftforge.fml.common.ProgressManager; //导入依赖的package包/类
public void loadRagdolls() {
SekCPhysics.logger.debug("Loading ragdolls and checking for supported mods");
List<ModContainer> modlist = Loader.instance().getActiveModList();
ProgressManager.ProgressBar bar = ProgressManager.push("SekCPhysics", modlist.size());
for(ModContainer mod : modlist) {
bar.step("Processing " + mod.getModId());
this.generateRagdollsFrom(mod.getModId());
}
ProgressManager.pop(bar);
}