本文整理汇总了Java中net.canarymod.api.world.DimensionType类的典型用法代码示例。如果您正苦于以下问题:Java DimensionType类的具体用法?Java DimensionType怎么用?Java DimensionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DimensionType类属于net.canarymod.api.world包,在下文中一共展示了DimensionType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CanaryModWorld
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
public CanaryModWorld(String name, int height, int sealevel, DimensionType env) {
super(name, height, sealevel);
world = null;
nmsWorld = null;
this.env = env;
skylight = (env == DimensionType.NORMAL);
//new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
// Generate non-default environment lighting table
if (env == DimensionType.NETHER) {
float f = 0.1F;
for (int i = 0; i <= 15; ++i) {
float f1 = 1.0F - (float)i / 15.0F;
this.setBrightnessTableEntry(i, (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f);
}
}
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:17,代码来源:CanaryModWorld.java
示例2: getWorld
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Override
public World getWorld(String world, DimensionType type, boolean autoload) {
if (world == null || world.isEmpty()) {
// assume that the world is the default world
world = Configuration.getServerConfig().getDefaultWorldName();
}
final String worldId = world + "_" + type.getName();
if (this.worldIsLoaded(worldId)) {
return this.loadedWorlds.get(worldId);
} else {
if (this.worldExists(worldId) && autoload) {
log.debug("World exists but is not loaded. Loading ...");
return this.loadWorld(world, type);
} else {
if (autoload) {
log.debug("World does not exist, we can autoload, will load!");
this.createWorld(world, type);
return this.loadedWorlds.get(worldId);
} else {
throw new UnknownWorldException("Tried to get a none existent world: " + world + " (" + type.toString() +
") either use autoload or have it pre-created!");
}
}
}
}
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:27,代码来源:NeptuneWorldManager.java
示例3: update
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Command(aliases = {
"update", "u"
}, parent = "r2w", helpLookup = "r2w update", description = "Update the template", permissions = {
"r2w.command.update"
}, toolTip = "/r2w update <world_name> <world_dimension> x1 y1 z1 x2 y2 z2", min = 9, max = 9)
public void update(final MessageReceiver caller, final String[] parameters)
throws InterruptedException, ExecutionException {
final int x1 = Integer.parseInt(parameters[3]);
final int y1 = Integer.parseInt(parameters[4]);
final int z1 = Integer.parseInt(parameters[5]);
final int x2 = Integer.parseInt(parameters[6]);
final int y2 = Integer.parseInt(parameters[7]);
final int z2 = Integer.parseInt(parameters[8]);
final Future<Boolean> future = templateManager.update(parameters[1],
DimensionType.fromName(parameters[2]), x1, y1, z1, x2, y2, z2);
if (future.get()) {
sendMessage(caller, "Completed updating template");
} else {
sendMessage(caller, "Failed updating template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:22,代码来源:ReturnCommand.java
示例4: getTemplateBlock
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Test
public void getTemplateBlock() throws Exception {
final Future<Boolean> future = templateManager.createTemplate("default", DimensionType.NORMAL);
if (future.get()) {
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -261, 69, 229));
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -260, 69, 229));
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -259, 69, 229));
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -258, 69, 229));
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -260, 69, 230));
assertEquals(BlockType.DiamondBlock,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -260, 69, 228));
assertEquals(BlockType.Grass,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -260, 69, 227));
} else {
fail("Failed to create the template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:23,代码来源:TemplateManagerTest.java
示例5: update
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Ignore
@Test
public void update() throws Exception {
final Future<Boolean> futureCreate = templateManager.createTemplate("default",
DimensionType.NORMAL);
if (futureCreate.get()) {
assertNotEquals(BlockType.Grass,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -1, 62, -1));
final Future<Boolean> futureUpdate = templateManager.update("default", DimensionType.NORMAL,
-1, 62, -1, 1, 63, 1);
if (futureUpdate.get()) {
assertEquals(BlockType.Grass,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -1, 62, -1));
} else {
fail("Failed to update the template");
}
} else {
fail("Failed to update the template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:21,代码来源:TemplateManagerTest.java
示例6: updateOutsideOfTemplate
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Ignore
@Test
public void updateOutsideOfTemplate() throws Exception {
final Future<Boolean> futureCreate = templateManager.createTemplate("default",
DimensionType.NORMAL);
if (futureCreate.get()) {
assertNull(templateManager
.getTemplateBlock("default", DimensionType.NORMAL, -1000, 62, -1000));
final Future<Boolean> futureUpdate = templateManager.update("default", DimensionType.NORMAL,
-1000, 62, -1000, -999, 63, -999);
if (futureUpdate.get()) {
assertEquals(BlockType.Grass,
templateManager.getTemplateBlock("default", DimensionType.NORMAL, -1000, 62, -1000));
assertNull(templateManager.getTemplateBlock("default", DimensionType.NORMAL, -1000, 61,
-1000));
} else {
fail("Failed to update the template");
}
} else {
fail("Failed to update the template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:23,代码来源:TemplateManagerTest.java
示例7: setWorldLoaded
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
/**
* Set world online
* @param w - loaded world
*/
public void setWorldLoaded(World w) {
world = w;
if (world instanceof net.canarymod.api.world.CanaryWorld) {
nmsWorld = ((net.canarymod.api.world.CanaryWorld)w).getHandle();
}
env = world.getType();
skylight = (env == DimensionType.NORMAL);
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:13,代码来源:CanaryModWorld.java
示例8: testGetZownByLocation
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Test
public void testGetZownByLocation() throws Exception {
expect(worldMock.getName()).andReturn("foo");
expect(worldMock.getType()).andReturn(DimensionType.NORMAL);
expect(worldMock.getFqName()).andReturn("foo_normal").anyTimes();
expect(dataManagerMock.saveZown(eq(worldMock), isA(Tree.class))).andReturn(true).anyTimes();
replayAll();
final ZownManager zownManager = new ZownManager(dataManagerMock, templateManagerMock);
final Location location = new Location(worldMock, 5, 5, 5, 0, 0);
final Tree<? extends IZown> rootZown = zownManager.getZown(worldMock);
assertEquals(rootZown, zownManager.getZown(location));
final Tree<? extends IZown> zown1 = zownManager.createZown(worldMock, "zown1", template,
new Point(0, 0, 0), new Point(10, 10, 10));
assertNotEquals(rootZown, zown1);
assertEquals(zown1, zownManager.getZown(location));
final Tree<? extends IZown> zown2 = zownManager.createZown(worldMock, "zown2", template,
new Point(0, 0, 0), new Point(5, 5, 5));
assertNotEquals(zown1, zown2);
assertEquals(zown2, zownManager.getZown(location));
final Tree<? extends IZown> zown3 = zownManager.createZown(worldMock, "zown3", template,
new Point(0, 0, 0), new Point(2, 2, 2));
assertNotEquals(zown2, zown3);
assertNotEquals(zown3, zownManager.getZown(location));
verifyAll();
}
开发者ID:toddharrison,项目名称:Zown,代码行数:33,代码来源:ZownManagerTest.java
示例9: createWorld
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Override
public boolean createWorld(String name, long seed, DimensionType dimensionType, WorldType worldType) {
WorldConfiguration worldConfiguration = WorldConfiguration.create(name, dimensionType);
if (worldConfiguration == null) {
log.debug("World configuration already exists for " + name + "_" + dimensionType.getName());
worldConfiguration = Configuration.getWorldConfig(name + "_" + dimensionType.getName());
} else {
log.debug("Updating world configuration for " + name + "_" + dimensionType.getName());
worldConfiguration.getFile().setLong("world-seed", seed);
worldConfiguration.getFile().setString("world-type", worldType.toString());
}
return this.createWorld(worldConfiguration);
}
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:16,代码来源:NeptuneWorldManager.java
示例10: getLoadedWorldsNamesOfDimension
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Override
public String[] getLoadedWorldsNamesOfDimension(DimensionType dimensionType) {
final List<String> loadedWorlds = this.loadedWorlds.values().stream()
.filter(w -> w.getType() == dimensionType)
.map(World::getFqName)
.collect(Collectors.toList());
return loadedWorlds.toArray(new String[loadedWorlds.size()]);
}
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:9,代码来源:NeptuneWorldManager.java
示例11: getChunkLoader
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
/**
* @author jamierocks - 30th October 2016
* @reason Use the Canary directory structure
*/
@Overwrite
public IChunkLoader getChunkLoader(WorldProvider provider) {
if (provider instanceof WorldProviderHell) {
return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NETHER.getName()));
} else if (provider instanceof WorldProviderEnd) {
return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.END.getName()));
} else {
return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NORMAL.getName()));
}
}
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:15,代码来源:MixinAnvilSaveHandler.java
示例12: createTemplate
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Command(aliases = {
"create"
}, parent = "r2w", helpLookup = "r2w create", description = "Create world template", permissions = {
"r2w.command.create"
}, toolTip = "/r2w create <world_name> <world_dimension>", min = 3, max = 3)
public void createTemplate(final MessageReceiver caller, final String[] parameters)
throws IOException, InterruptedException, ExecutionException {
final Future<Boolean> future = templateManager.createTemplate(parameters[1],
DimensionType.fromName(parameters[2]));
if (future.get()) {
sendMessage(caller, "Completed creating template");
} else {
sendMessage(caller, "Failed creating template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:16,代码来源:ReturnCommand.java
示例13: removeTemplate
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Command(aliases = {
"remove"
}, parent = "r2w", helpLookup = "r2w remove", description = "Remove world template", permissions = {
"r2w.command.remove"
}, toolTip = "/r2w remove <world_name> <world_dimension>", min = 3, max = 3)
public void removeTemplate(final MessageReceiver caller, final String[] parameters)
throws IOException, InterruptedException, ExecutionException {
final Future<Boolean> future = templateManager.removeTemplate(parameters[1],
DimensionType.fromName(parameters[2]));
if (future.get()) {
sendMessage(caller, "Completed removing template");
} else {
sendMessage(caller, "Failed removing template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:16,代码来源:ReturnCommand.java
示例14: removeTemplate
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
public Future<Boolean> removeTemplate(final String name, final DimensionType type) {
return TaskManager.submitTask(new Callable<Boolean>() {
@Override
public Boolean call() throws IOException {
boolean success = true;
final File templateDir = getTemplateDir(name, type);
if (templateDir.exists() && templateDir.canWrite()) {
success = FileUtils.deleteQuietly(templateDir);
}
log.info("Removed template " + name + "_" + type.getName() + ": " + success);
return success;
}
});
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:15,代码来源:TemplateManager.java
示例15: loadRegionFile
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
private RegionFile loadRegionFile(final String name, final DimensionType type, final int regionX,
final int regionZ) throws IOException {
RegionFile region = null;
final String resourceName = "r." + regionX + "." + regionZ + ".mca";
final File templateDir = getTemplateDir(name, type);
final File regionDir = new File(templateDir, "region");
final File regionFile = new File(regionDir, resourceName);
if (regionFile.exists()) {
region = new RegionFile(regionFile);
}
return region;
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:13,代码来源:TemplateManager.java
示例16: newRegionFile
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
private RegionFile newRegionFile(final String name, final DimensionType type, final int regionX,
final int regionZ) throws IOException {
final String resourceName = "r." + regionX + "." + regionZ + ".mca";
final File templateDir = getTemplateDir(name, type);
final File regionDir = new File(templateDir, "region");
final File regionFile = new File(regionDir, resourceName);
return new RegionFile(regionFile);
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:9,代码来源:TemplateManager.java
示例17: restore
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Test
public void restore() throws Exception {
final Future<Boolean> futureCreate = templateManager.createTemplate("default",
DimensionType.NORMAL);
if (futureCreate.get()) {
final Future<Boolean> futureRestore = templateManager.restore("default",
DimensionType.NORMAL, -1, 62, -1, 1, 63, 1);
if (!futureRestore.get()) {
fail("Failed to restore the template");
}
} else {
fail("Failed to create the template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:15,代码来源:TemplateManagerTest.java
示例18: restoreHigherThanSnapshot
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Test
public void restoreHigherThanSnapshot() throws Exception {
final Future<Boolean> futureCreate = templateManager.createTemplate("default",
DimensionType.NORMAL);
if (futureCreate.get()) {
final Future<Boolean> futureRestore = templateManager.restore("default",
DimensionType.NORMAL, -1, 200, -1, 1, 201, 1);
if (!futureRestore.get()) {
fail("Failed to restore the template");
}
} else {
fail("Failed to create the template");
}
}
开发者ID:toddharrison,项目名称:ReturnToWild,代码行数:15,代码来源:TemplateManagerTest.java
示例19: isNether
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
@Override
public boolean isNether() {
return env == DimensionType.NETHER;
}
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:5,代码来源:CanaryModWorld.java
示例20: of
import net.canarymod.api.world.DimensionType; //导入依赖的package包/类
public static DimensionType of(World.Environment difficulty) {
return EnvironmentConverter.map.get(difficulty);
}
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:EnvironmentConverter.java
注:本文中的net.canarymod.api.world.DimensionType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论