本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getWorlds方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getWorlds方法的具体用法?Java DimensionManager.getWorlds怎么用?Java DimensionManager.getWorlds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.DimensionManager
的用法示例。
在下文中一共展示了DimensionManager.getWorlds方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorld
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
* Performs a case-sensitive search for a loaded world by a given name.
*
* First, it tries to match the name with dimension 0 (overworld), then it tries to
* match from the world's save folder name (e.g. DIM_MYST10) and then finally the
* Dynmap compatible identifier (e.g. DIM10)
*
* @param name Name of world to find
* @return World if found, else null
*/
public static WorldServer getWorld(String name)
{
if ( name == null || name.isEmpty() )
throw new IllegalArgumentException("World name cannot be empty or null");
for ( WorldServer world : DimensionManager.getWorlds() )
{
String dimName = "DIM" + world.provider.getDimension();
String saveFolder = world.provider.getSaveFolder();
if (world.provider.getDimension() == 0)
{ // Special case for dimension 0 (overworld)
if ( WorldBorder.SERVER.getFolderName().equals(name) )
return world;
}
else if ( saveFolder.equals(name) || dimName.equals(name) )
return world;
}
return null;
}
示例2: getGameRuleInstance
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static GameRules getGameRuleInstance(DerivedWorldInfo worldInfo)
{
World worldObj = null;
for (World world : DimensionManager.getWorlds())
{
if (world.getWorldInfo() == worldInfo)
{
worldObj = world;
break;
}
}
if (worldObj != null)
{
return getGameRuleInstance(worldObj);
}
return null;
}
示例3: getWorld
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
* Performs a case-sensitive search for a loaded world by a given name.
*
* First, it tries to match the name with dimension 0 (overworld), then it tries to
* match from the world's save folder name (e.g. DIM_MYST10) and then finally the
* Dynmap compatible identifier (e.g. DIM10)
*
* @param name Name of world to find
* @return World if found, else null
*/
public static WorldServer getWorld(String name)
{
if ( name == null || name.isEmpty() )
throw new IllegalArgumentException("World name cannot be empty or null");
for ( WorldServer world : DimensionManager.getWorlds() )
{
String dimName = "DIM" + world.provider.dimensionId;
String saveFolder = world.provider.getSaveFolder();
if (world.provider.dimensionId == 0)
{ // Special case for dimension 0 (overworld)
if ( WorldBorder.SERVER.getFolderName().equals(name) )
return world;
}
else if ( saveFolder.equals(name) || dimName.equals(name) )
return world;
}
return null;
}
示例4: serverStarted
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public void serverStarted()
{
LogManager.getLogger().log(Level.INFO, "Hooking in Emergent Villagers' spawn logic");
// Every dimension should have a VillagerData attached
for(WorldServer srv : DimensionManager.getWorlds()){
NBTDataHandler.init(srv);
TickHandler.init(srv);
}
TickHandler.findNextWorldToTick();
}
示例5: 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;
}
示例6: getFairy
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
* Find a fairy in the world by entity id. This method was in the base class
* in the original mod, and I can't find a better place to put it for now...
*
* @param fairyID
* @return The fairy in question, null if not found.
*/
public static EntityFairy getFairy(int fairyID) {
for( WorldServer dim : DimensionManager.getWorlds() ) {
if( dim != null ) {
List<Entity> entities = dim.loadedEntityList;
if( entities != null && !entities.isEmpty() ) {
for( Entity entity : entities ) {
if( entity instanceof EntityFairy && entity.getEntityId() == fairyID )
return (EntityFairy)entity;
}
}
}
}
return null;
}
示例7: PlayerChunkViewerTracker
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public PlayerChunkViewerTracker(EntityPlayer player, PlayerChunkViewerManager manager) {
owner = player;
this.manager = manager;
PacketCustom packet = new PacketCustom(ChunkLoaderSPH.channel, 1);
packet.sendToPlayer(player);
for (WorldServer world : DimensionManager.getWorlds()) {
loadDimension(world);
}
}
示例8: updateChunkChangeMap
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SuppressWarnings ("unchecked")
private void updateChunkChangeMap() {
for (WorldServer world : DimensionManager.getWorlds()) {
HashSet<ChunkPos> allChunks = new HashSet<>();
ArrayList<Chunk> loadedChunkCopy = new ArrayList<>(world.getChunkProvider().getLoadedChunks());
for (Chunk chunk : loadedChunkCopy) {
allChunks.add(chunk.getPos());
}
lastLoadedChunkMap.put(CommonUtils.getDimension(world), allChunks);
}
}