本文整理汇总了Java中net.minecraftforge.fml.common.ProgressManager.ProgressBar方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressManager.ProgressBar方法的具体用法?Java ProgressManager.ProgressBar怎么用?Java ProgressManager.ProgressBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fml.common.ProgressManager
的用法示例。
在下文中一共展示了ProgressManager.ProgressBar方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
}
示例9: 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);
}
示例10: 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);
}
示例11: loadRecipes
import net.minecraftforge.fml.common.ProgressManager; //导入方法依赖的package包/类
public Map<DynamicMachine, List<MachineRecipe>> loadRecipes(@Nullable EntityPlayer player) {
ProgressManager.ProgressBar barRecipes = ProgressManager.push("RecipeRegistry", 3);
barRecipes.step("Discovering Files");
DataLoadProfiler profiler = new DataLoadProfiler();
boolean frozen = MachineRecipe.isFrozen();
if(frozen) {
MachineRecipe.unfreeze();
}
Map<RecipeLoader.FileType, List<File>> potentialRecipes = RecipeLoader.discoverDirectory(CommonProxy.dataHolder.getRecipeDirectory());
barRecipes.step("Loading Recipes");
List<MachineRecipe> recipes = RecipeLoader.loadRecipes(potentialRecipes, earlyRecipes);
DataLoadProfiler.StatusLine sl = profiler.createLine("Load-Phase: ");
DataLoadProfiler.Status success = sl.appendStatus("%s loaded");
DataLoadProfiler.Status failed = sl.appendStatus("%s failed");
success.setCounter(recipes.size());
Map<String, Exception> failures = RecipeLoader.captureFailedAttempts();
failed.setCounter(failures.size());
if(failures.size() > 0) {
ModularMachinery.log.warn("Encountered " + failures.size() + " problems while loading recipe!");
for (String fileName : failures.keySet()) {
ModularMachinery.log.warn("Couldn't load recipe from file " + fileName);
failures.get(fileName).printStackTrace();
}
}
Map<DynamicMachine, List<MachineRecipe>> out = new HashMap<>();
DataLoadProfiler.StatusLine unknown = profiler.createLine("");
DataLoadProfiler.Status unknownCounter = unknown.appendStatus("Unknown Machinery: %s");
Map<DynamicMachine, Tuple<DataLoadProfiler.Status, DataLoadProfiler.Status>> statusMap = new HashMap<>();
Map<ResourceLocation, MachineRecipe> tempRegistry = new HashMap<>();
barRecipes.step("Validation");
for (MachineRecipe mr : recipes) {
DynamicMachine m = mr.getOwningMachine();
if(m == null) {
unknownCounter.incrementCounter();
ModularMachinery.log.warn("MachineRecipe loaded for unknown machine: " + mr.getOwningMachineIdentifier() + " - responsible file: " + mr.getRecipeFilePath());
continue;
}
Tuple<DataLoadProfiler.Status, DataLoadProfiler.Status> status = statusMap.get(m);
if(status == null) {
DataLoadProfiler.StatusLine line = profiler.createLine(m.getLocalizedName() + " (Recipes): ");
status = new Tuple<>(line.appendStatus("%s loaded"), line.appendStatus("%s failed"));
statusMap.put(m, status);
}
DataLoadProfiler.Status loaded = status.getFirst();
DataLoadProfiler.Status fail = status.getSecond();
if(tempRegistry.containsKey(mr.getRegistryName())) {
MachineRecipe other = tempRegistry.get(mr.getRegistryName());
if(other != null) {
ModularMachinery.log.warn("MachineRecipe with registryName " + mr.getRegistryName() + " already exists!");
ModularMachinery.log.warn("Offending files: '" + mr.getRecipeFilePath() + "' and '" + other.getRecipeFilePath() + "' !");
fail.incrementCounter();
continue;
}
}
loaded.incrementCounter();
tempRegistry.put(mr.getRegistryName(), mr);
List<MachineRecipe> recipeList = out.computeIfAbsent(mr.getOwningMachine(), r -> Lists.newArrayList());
recipeList.add(mr);
}
profiler.printLines(player);
ProgressManager.pop(barRecipes);
if(frozen) {
MachineRecipe.freezeChanges();
}
return out;
}
示例12: saveModStats
import net.minecraftforge.fml.common.ProgressManager; //导入方法依赖的package包/类
public void saveModStats(String name, TextureMap map, File outputFolder) {
Map<String, Long> modPixelCounts = map.mapUploadedSprites.values().stream()
.collect(Collectors.groupingBy(
sprite -> new ResourceLocation(sprite.getIconName()).getResourceDomain(),
Collectors.summingLong(sprite -> sprite.getIconWidth() * sprite.getIconHeight()))
);
final long totalPixels = modPixelCounts.values().stream().mapToLong(longValue -> longValue).sum();
final String filename = name + "_mod_statistics";
File output = new File(outputFolder, filename + ".js");
List<Map.Entry<String, Long>> sortedEntries = modPixelCounts.entrySet().stream()
.sorted(Collections.reverseOrder(Comparator.comparing(Map.Entry::getValue)))
.collect(Collectors.toList());
ProgressManager.ProgressBar progressBar = ProgressManager.push("Dumping Mod TextureMap Statistics", sortedEntries.size());
try {
FileWriter fileWriter = new FileWriter(output);
fileWriter.write("var modStatistics = \n//Start of Data\n");
JsonWriter jsonWriter = new JsonWriter(fileWriter);
jsonWriter.setIndent(" ");
jsonWriter.beginArray();
{
for (Map.Entry<String, Long> modPixels : sortedEntries) {
String resourceDomain = modPixels.getKey();
progressBar.step(resourceDomain);
long pixelCount = modPixels.getValue();
ModMetadata metadata = getModMetadata(resourceDomain);
jsonWriter.beginObject()
.name("resourceDomain").value(resourceDomain)
.name("pixelCount").value(pixelCount)
.name("percentOfTextureMap").value(pixelCount * 100f / totalPixels)
.name("modName").value(metadata.name)
.name("url").value(metadata.url);
jsonWriter.name("authors").beginArray();
for (String author : metadata.authorList) {
jsonWriter.value(author);
}
jsonWriter.endArray();
jsonWriter.endObject();
}
}
jsonWriter.endArray();
jsonWriter.close();
fileWriter.close();
Log.info("Saved mod statistics to {}.", output.getAbsoluteFile());
} catch (IOException e) {
Log.error("Failed to save mod statistics info.", e);
}
ProgressManager.pop(progressBar);
}