当前位置: 首页>>代码示例>>Java>>正文


Java DimensionManager.getWorlds方法代码示例

本文整理汇总了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;
}
 
开发者ID:abused,项目名称:World-Border,代码行数:32,代码来源:Worlds.java

示例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;
}
 
开发者ID:lumien231,项目名称:Dimension-Rules,代码行数:21,代码来源:RuleHandler.java

示例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;
}
 
开发者ID:RoyCurtis,项目名称:WorldBorder-Forge,代码行数:32,代码来源:Worlds.java

示例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();
}
 
开发者ID:Edicatad,项目名称:EmergentVillages,代码行数:12,代码来源:ClientProxy.java

示例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;
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:20,代码来源:UWorld.java

示例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;
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:22,代码来源:FairyFactions.java

示例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);
    }
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:12,代码来源:PlayerChunkViewerTracker.java

示例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);
    }
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:13,代码来源:PlayerChunkViewerManager.java


注:本文中的net.minecraftforge.common.DimensionManager.getWorlds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。