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


Java DimensionManager.initDimension方法代码示例

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


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

示例1: loadChunks

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public void loadChunks()
{
    if (this.worldObj.isRemote)
        return;

    this.reference = DimensionManager.getWorld(VoidUtils.DIM);
    if (this.reference == null)
    {
        DimensionManager.initDimension(VoidUtils.DIM);
        this.reference = DimensionManager.getWorld(VoidUtils.DIM);
    }

    //We need to load the chunk, and the chunks around it before we start copying, so that the chunk gets decorated.
    ChunkProviderServer provider = this.reference.getChunkProvider();
    int sX = this.getStart().getX() / 16 - GEN_RANGE;
    int sZ = this.getStart().getZ() / 16 - GEN_RANGE;
    int eX = this.getEnd().getX() / 16 + GEN_RANGE;
    int eZ = this.getEnd().getZ() / 16 + GEN_RANGE;
    for (int x = sX; x <= eX; x++)
        for (int z = sZ; z <= eZ; z++)
            provider.loadChunk(x, z);
}
 
开发者ID:LexManos,项目名称:VoidUtils,代码行数:23,代码来源:TileEntityQuarry.java

示例2: registerDimension

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SubscribeEvent
public void registerDimension(TickEvent.ServerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        throw new IllegalStateException("I should be gone.");
    }
    DimensionManager.initDimension(DeltaChunk.getDimensionId());
    if (!DimensionManager.shouldLoadSpawn(DeltaChunk.getDimensionId())) {
        throw new RuntimeException("hammerWorld is not loaded");
    }
    if (!DimensionManager.isDimensionRegistered(DeltaChunk.getDimensionId())) {
        throw new RuntimeException("Hammer dimension was not registered!?");
    }
    World hammerWorld = DimensionManager.getWorld(DeltaChunk.getDimensionId());
    if (!(hammerWorld.provider instanceof HammerWorldProvider)) {
        throw new RuntimeException("Expected HammerWorldProvider for HammerWorld; is there a dimension ID conflict? Actual provider: " + hammerWorld.provider.getClass());
    }
    hammerWorld.addWorldAccess(new ServerShadowWorldAccess());
    int view_distance = MinecraftServer.getServer().getConfigurationManager().getViewDistance();
    //the undeobfed method comes after "isPlayerWatchingChunk", also in uses of ServerConfigurationManager.getViewDistance()
    //It returns how many blocks are visible.
    DSE_ChunkUpdateRangeSquared = Math.pow(PlayerManager.getFurthestViewableBlock(view_distance) + 16*2, 2);
    Core.unloadBus(this);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:24,代码来源:Hammer.java

示例3: 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

示例4: createWorld

import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@Override
public World createWorld(WorldCreator creator) {
    Validate.notNull(creator, "Creator may not be null");

    String name = creator.name();
    ChunkGenerator generator = creator.generator();
    File folder = new File(getWorldContainer(), name);
    World world = getWorld(name);
    net.minecraft.world.WorldType type = net.minecraft.world.WorldType.parseWorldType(creator.type().getName());
    boolean generateStructures = creator.generateStructures();

    if ((folder.exists()) && (!folder.isDirectory())) {
        throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
    }

    if (world != null) {
        return world;
    }

    boolean hardcore = false;
    WorldSettings worldSettings = new WorldSettings(creator.seed(), net.minecraft.world.WorldSettings.GameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
    net.minecraft.world.WorldServer worldserver = DimensionManager.initDimension(creator, worldSettings);

    pluginManager.callEvent(new WorldInitEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = true;
    System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Dimension: " + worldserver.provider.dimensionId + ", Seed: " + worldserver.getSeed() + ")"); // Cauldron - log dimension

    if (worldserver.getWorld().getKeepSpawnInMemory()) {
        short short1 = 196;
        long i = System.currentTimeMillis();
        for (int j = -short1; j <= short1; j += 16) {
            for (int k = -short1; k <= short1; k += 16) {
                long l = System.currentTimeMillis();

                if (l < i) {
                    i = l;
                }

                if (l > i + 1000L) {
                    int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
                    int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

                    System.out.println("Preparing spawn area for " + worldserver.getWorld().getName() + ", " + (j1 * 100 / i1) + "%");
                    i = l;
                }

                net.minecraft.util.ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
                worldserver.theChunkProviderServer.loadChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);
            }
        }
    }
    pluginManager.callEvent(new WorldLoadEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = false;
    return worldserver.getWorld();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:56,代码来源:CraftServer.java


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