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


Java DimensionManager.getProviderType方法代码示例

本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getProviderType方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getProviderType方法的具体用法?Java DimensionManager.getProviderType怎么用?Java DimensionManager.getProviderType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.DimensionManager的用法示例。


在下文中一共展示了DimensionManager.getProviderType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDimensionName

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static final String getDimensionName(UUID requestID, int dimension){
	if(FMLCommonHandler.instance().getSide() == Side.SERVER){
		try{
			DimensionType type = DimensionManager.getProviderType(dimension);
			return type.getName();
		} catch(Exception e){}
	} else {
		if(!DIMENSION_NAMES.containsKey(dimension)){
			CrystalModNetwork.sendToServer(new PacketDimensionNameRequest(requestID, dimension));
		} else {
			return DIMENSION_NAMES.get(dimension);
		}
	}
	
	return ""+dimension;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:StringUtils.java

示例2: registerDimension

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private static void registerDimension(int id, DimensionConfigEntry entry)
{
    if (entry.getUnregister() || entry.hasDimensionTypeEntry() == false)
    {
        return;
    }

    if (DimensionManager.isDimensionRegistered(id))
    {
        DimensionType type = DimensionManager.getProviderType(id);

        if (type.createDimension().getClass() != entry.getDimensionTypeEntry().getProviderClass())
        {
            JustEnoughDimensions.logInfo("DimensionSyncPacket.registerDimension: Dimension {} already registered, unregistering the old one", id);
            DimensionManager.unregisterDimension(id);
        }
    }

    if (DimensionManager.isDimensionRegistered(id) == false)
    {
        JustEnoughDimensions.logInfo("DimensionSyncPacket.registerDimension: Registering dimension {}", id);
        DimensionManager.registerDimension(id, entry.getDimensionTypeEntry().registerDimensionType());
    }
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:25,代码来源:DimensionSyncPacket.java

示例3: loadDimension

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
private void loadDimension(int dimensionID, WorldInfo worldInfo)
{
	WorldServer overworld = (WorldServer) FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld();
	if (overworld == null)
	{
		throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!");
	}
	try
	{
		DimensionManager.getProviderType(dimensionID);
	}
	catch (Exception e)
	{
		System.err.println("Cannot Hotload Dim: " + e.getMessage());
		return;
	}
	
	MinecraftServer mcServer = overworld.getMinecraftServer();
	ISaveHandler savehandler = overworld.getSaveHandler();
	EnumDifficulty difficulty = mcServer.getEntityWorld().getDifficulty();

	WorldServer world = (WorldServer) (new WorldCustom(worldInfo, mcServer, savehandler, dimensionID, overworld, mcServer.profiler).init());
	world.addEventListener(new ServerWorldEventHandler(mcServer, world));
	MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));

	if (!mcServer.isSinglePlayer())
	{
		world.getWorldInfo().setGameType(mcServer.getGameType());
	}

	mcServer.setDifficultyForAllWorlds(difficulty);
}
 
开发者ID:lumien231,项目名称:Simple-Dimensions,代码行数:33,代码来源:DimensionHandler.java

示例4: addInformation

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean adv){
	super.addInformation(stack, player, list, adv);
	if(isValid(stack)){
		BlockPos pos = getBlockPos(stack);
		list.add("Panel location {"+pos.getX()+", "+pos.getY()+", "+pos.getZ()+"}");
		
		int dim = ItemNBTHelper.getInteger(stack, "PanelDim", 0);
		String name = ""+dim;
		if (!DimensionManager.isDimensionRegistered(dim)) {
	      name = Integer.toString(dim);
	    }else {
		    DimensionType type = DimensionManager.getProviderType(dim);
		    if (type == null) {
		      name = Integer.toString(dim);
		    }else {
			    name = type.getName();
			    int[] dims = DimensionManager.getDimensions(type);
			    if (dims != null && dims.length > 1) {
			      name += " " + dim;
			    }
		    }
	    }
		
		list.add("Panel Dimension: "+name);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:29,代码来源:ItemWirelessPanel.java

示例5: getDimensionType

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public DimensionType getDimensionType()
{
    DimensionType type = null;

    try
    {
        type = DimensionManager.getProviderType(this.getDimension());
    }
    catch (IllegalArgumentException e)
    {
    }

    return type != null ? type : DimensionType.OVERWORLD;
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:16,代码来源:WorldProviderJED.java

示例6: getDimensionType

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public DimensionType getDimensionType()
{
    DimensionType type = null;

    try
    {
        type = DimensionManager.getProviderType(this.getDimension());
    }
    catch (IllegalArgumentException e)
    {
    }

    return type != null ? type : super.getDimensionType();
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:16,代码来源:WorldProviderEndJED.java

示例7: getStationData

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
/**
 * Retrieve a space station data entry, creating if necessary (with provided data)
 */
public static SpaceStationWorldData getStationData(World world, int stationID, int homeID, int providerIdDynamic, int providerIdStatic, EntityPlayer owner)
{
    int providerType = DimensionManager.getProviderType(stationID);

    boolean foundMatch = false;

    // Loop through all registered satellites, checking for a provider ID match. If none is found, this method is
    // being called on an incorrect
    for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values())
    {
        if (satellite.getDimensionIdStatic() == providerType || satellite.getDimensionID() == providerType)
        {
            foundMatch = true;
            break;
        }
    }

    if (!foundMatch)
    {
        return null;
    }
    else
    {
        final String stationIdentifier = SpaceStationWorldData.getSpaceStationID(stationID);
        SpaceStationWorldData stationData = (SpaceStationWorldData) world.loadItemData(SpaceStationWorldData.class, stationIdentifier);

        if (stationData == null)
        {
            stationData = new SpaceStationWorldData(stationIdentifier);
            world.setItemData(stationIdentifier, stationData);
            stationData.dataCompound = new NBTTagCompound();

            if (owner != null)
            {
                stationData.owner = owner.getGameProfile().getName().replace(".", "");
            }

            stationData.spaceStationName = "Station: " + stationData.owner;

            if (owner != null)
            {
                stationData.allowedPlayers.add(owner.getGameProfile().getName());
            }

            if (homeID == -1)
            {
                throw new RuntimeException("Space station being created on bad home planet ID!");
            }
            else
            {
                stationData.homePlanet = homeID;
            }

            if (providerIdDynamic == -1 || providerIdStatic == -1)
            {
                throw new RuntimeException("Space station being created on bad provider IDs!");
            }
            else
            {
                stationData.dimensionIdDynamic = providerIdDynamic;
                stationData.dimensionIdStatic = providerIdStatic;
            }

            stationData.markDirty();
        }

        if (stationData.getSpaceStationName().replace(" ", "").isEmpty())
        {
            stationData.setSpaceStationName("Station: " + stationData.owner);
            stationData.markDirty();
        }

        return stationData;
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:79,代码来源:SpaceStationWorldData.java

示例8: 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();
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:44,代码来源:DimensionDump.java

示例9: getFormattedLoadedDimensionsDump

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> getFormattedLoadedDimensionsDump()
{
    DimensionDump dimensionDump = new DimensionDump(7);
    Integer[] ids = DimensionManager.getIDs();

    for (int i = 0; i < ids.length; i++)
    {
        WorldServer world = DimensionManager.getWorld(ids[i]);
        DimensionType type = DimensionManager.getProviderType(ids[i]);

        if (world == null || 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 loadedChunks = String.valueOf(WorldUtils.getLoadedChunkCount(world));
        String loadedEntities = String.valueOf(world.loadedEntityList.size());

        try
        {
            worldProviderClass = ((Class<? extends WorldProvider>) field_worldProvider.get(type)).getSimpleName();
        }
        catch (Exception e)
        {
            worldProviderClass = "ERROR";
        }

        dimensionDump.addData(dimId, typeId, name, shouldLoadSpawn, worldProviderClass, loadedChunks, loadedEntities);
    }

    dimensionDump.addTitle("ID", "Type ID", "Name", "Load Spawn?", "WorldProvider class", "Loaded chunks", "Loaded entities");
    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); // loaded chunks
    dimensionDump.setColumnAlignment(6, Alignment.RIGHT); // loaded entities
    dimensionDump.setUseColumnSeparator(true);

    return dimensionDump.getLines();
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:47,代码来源:DimensionDump.java


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