本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getStaticDimensionIDs方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getStaticDimensionIDs方法的具体用法?Java DimensionManager.getStaticDimensionIDs怎么用?Java DimensionManager.getStaticDimensionIDs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.DimensionManager
的用法示例。
在下文中一共展示了DimensionManager.getStaticDimensionIDs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorld
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
* Get world instance by dimension name or id, case insensitive
* @param dimension Dimension name or id
* @return World instance
*/
public static UWorld getWorld(String dimension) {
for (int dim : DimensionManager.getStaticDimensionIDs()) {
if (DimensionManager.getWorld(dim) == null) {
DimensionManager.initDimension(dim);
}
}
for (World world : DimensionManager.getWorlds()) {
UWorld uWorld = new UWorld(world);
if (uWorld.getDimensionName().equalsIgnoreCase(dimension) || String.valueOf(uWorld.getDimensionID()).equalsIgnoreCase(dimension)) {
return uWorld;
}
}
return null;
}
示例2: updateBonfires
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private void updateBonfires() {
bonfires.clear();
for (int dim : DimensionManager.getStaticDimensionIDs()) {
Map<Integer, List<List<Bonfire>>> series = createSeries(dim);
if (series != null)
if (series.get(dim) != null)
bonfires.put(dim, series.get(dim));
}
}
示例3: getFormattedRegisteredDimensionsDump
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> getFormattedRegisteredDimensionsDump()
{
DimensionDump dimensionDump = new DimensionDump(6);
Integer[] ids = DimensionManager.getStaticDimensionIDs();
for (int i = 0; i < ids.length; i++)
{
DimensionType type = DimensionManager.getProviderType(ids[i]);
if (type == null)
{
continue;
}
String dimId = ids[i].toString();
String typeId = String.valueOf(type.getId());
String name = type.getName();
String shouldLoadSpawn = String.valueOf(type.shouldLoadSpawn());
String worldProviderClass;
String currentlyLoaded = String.valueOf(DimensionManager.getWorld(ids[i]) != null);
try
{
worldProviderClass = ((Class<? extends WorldProvider>) field_worldProvider.get(type)).getSimpleName();
}
catch (Exception e)
{
worldProviderClass = "ERROR";
}
dimensionDump.addData(dimId, typeId, name, shouldLoadSpawn, worldProviderClass, currentlyLoaded);
}
dimensionDump.addTitle("ID", "Type ID", "Name", "Load Spawn?", "WorldProvider class", "Loaded?");
dimensionDump.setColumnAlignment(0, Alignment.RIGHT); // dim ID
dimensionDump.setColumnAlignment(1, Alignment.RIGHT); // type ID
dimensionDump.setColumnAlignment(3, Alignment.RIGHT); // shouldLoadSpawn
dimensionDump.setColumnAlignment(5, Alignment.RIGHT); // currentlyLoaded
dimensionDump.setUseColumnSeparator(true);
return dimensionDump.getLines();
}