當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。