本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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();
}