本文整理匯總了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();
}