• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WorldServer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.server.WorldServer的典型用法代码示例。如果您正苦于以下问题:Java WorldServer类的具体用法?Java WorldServer怎么用?Java WorldServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WorldServer类属于net.minecraft.server包,在下文中一共展示了WorldServer类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findOrCreate

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public Location findOrCreate(Location target) {
    WorldServer worldServer = ((CraftWorld) target.getWorld()).getHandle();
    boolean before = worldServer.chunkProviderServer.forceChunkLoad;
    worldServer.chunkProviderServer.forceChunkLoad = true;

    Location found = this.findPortal(target);
    if (found == null) {
        if (this.getCanCreatePortal() && this.createPortal(target)) {
            found = this.findPortal(target);
        } else {
            found = target; // fallback to original if unable to find or create
        }
    }

    worldServer.chunkProviderServer.forceChunkLoad = before;
    return found;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:18,代码来源:CraftTravelAgent.java


示例2: findOrCreate

import net.minecraft.server.WorldServer; //导入依赖的package包/类
@Override
public Location findOrCreate(Location target) {
    WorldServer worldServer = ((CraftWorld) target.getWorld()).getHandle();
    boolean before = worldServer.chunkProviderServer.forceChunkLoad;
    worldServer.chunkProviderServer.forceChunkLoad = true;

    Location found = this.findPortal(target);
    if (found == null) {
        if (this.getCanCreatePortal() && this.createPortal(target)) {
            found = this.findPortal(target);
        } else {
            found = target; // fallback to original if unable to find or create
        }
    }

    worldServer.chunkProviderServer.forceChunkLoad = before;
    return found;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:19,代码来源:CraftTravelAgent.java


示例3: playEffect

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public static void playEffect(World bukkitWorld, Vector pos, int effectId, int data) {
    WorldServer world = ((CraftWorld) bukkitWorld).getHandle();
    world.triggerEffect(effectId, new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), data);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:NMSHacks.java


示例4: update

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private void update() {
    WorldServer world = ((CraftWorld) getWorld()).getHandle();
    EntityPainting painting = new EntityPainting(world);
    painting.x = getHandle().x;
    painting.y = getHandle().y;
    painting.z = getHandle().z;
    painting.art = getHandle().art;
    painting.setDirection(getHandle().direction);
    getHandle().die();
    getHandle().velocityChanged = true; // because this occurs when the painting is broken, so it might be important
    world.addEntity(painting);
    this.entity = painting;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:14,代码来源:CraftPainting.java


示例5: setFacingDirection

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public boolean setFacingDirection(BlockFace face, boolean force) {
    if (!super.setFacingDirection(face, force)) {
        return false;
    }

    WorldServer world = ((CraftWorld) this.getWorld()).getHandle();
    world.getTracker().untrackEntity(this.getHandle());
    world.getTracker().track(this.getHandle());
    return true;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:11,代码来源:CraftItemFrame.java


示例6: canBuild

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
    WorldServer worldServer = world.getHandle();
    int spawnSize = Bukkit.getServer().getSpawnRadius();

    if (world.getHandle().dimension != 0) return true;
    if (spawnSize <= 0) return true;
    if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
    if (player.isOp()) return true;

    ChunkCoordinates chunkcoordinates = worldServer.getSpawn();

    int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
    return distanceFromSpawn > spawnSize;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:CraftEventFactory.java


示例7: CraftChunk

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public CraftChunk(net.minecraft.server.Chunk chunk) {
    if (!(chunk instanceof EmptyChunk)) {
        this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
    }

    worldServer = (WorldServer) getHandle().world;
    x = getHandle().locX;
    z = getHandle().locZ;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:10,代码来源:CraftChunk.java


示例8: update

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private void update() {
    WorldServer world = ((CraftWorld) getWorld()).getHandle();
    EntityPainting painting = new EntityPainting(world);
    painting.blockPosition = getHandle().blockPosition;
    painting.art = getHandle().art;
    painting.setDirection(getHandle().direction);
    getHandle().die();
    getHandle().velocityChanged = true; // because this occurs when the painting is broken, so it might be important
    world.addEntity(painting);
    this.entity = painting;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:12,代码来源:CraftPainting.java


示例9: update

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private void update() {
    EntityItemFrame old = this.getHandle();

    WorldServer world = ((CraftWorld) getWorld()).getHandle();
    BlockPosition position = old.getBlockPosition();
    EnumDirection direction = old.getDirection();
    ItemStack item = old.getItem() != null ? old.getItem().cloneItemStack() : null;

    old.die();

    EntityItemFrame frame = new EntityItemFrame(world,position,direction);
    frame.setItem(item);
    world.addEntity(frame);
    this.entity = frame;
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:16,代码来源:CraftItemFrame.java


示例10: CraftChunk

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public CraftChunk(net.minecraft.server.Chunk chunk) {
    if (!(chunk instanceof EmptyChunk)) {
        this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
    }

    worldServer = (WorldServer) getHandle().world;
    x = getHandle().x;
    z = getHandle().z;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:10,代码来源:CraftChunk.java


示例11: findOrCreate

import net.minecraft.server.WorldServer; //导入依赖的package包/类
@Override
public Location findOrCreate(Location target) {
    WorldServer worldServer = ((CraftWorld) target.getWorld()).getHandle();

    Location found = this.findPortal(target);
    if (found == null) {
        if (this.getCanCreatePortal() && this.createPortal(target)) {
            found = this.findPortal(target);
        } else {
            found = target; // fallback to original if unable to find or create
        }
    }

    return found;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:16,代码来源:CraftTravelAgent.java


示例12: canBuild

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
    WorldServer worldServer = world.getHandle();
    int spawnSize = Bukkit.getServer().getSpawnRadius();

    if (world.getHandle().dimension != 0) return true;
    if (spawnSize <= 0) return true;
    if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
    if (player.isOp()) return true;

    ChunkCoordinates chunkcoordinates = worldServer.getSpawn();

    int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z));
    return distanceFromSpawn >= spawnSize;
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:15,代码来源:CraftEventFactory.java


示例13: getTrackerEntry

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private static EntityTrackerEntry getTrackerEntry(net.minecraft.server.Entity nms) {
    return ((WorldServer) nms.getWorld()).getTracker().trackedEntities.get(nms.getId());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java


示例14: playCustomSound

import net.minecraft.server.WorldServer; //导入依赖的package包/类
private static void playCustomSound(World bukkitWorld, Location location, SoundEffect sound, SoundCategory category, Float volume, Float pitch) {
    WorldServer world = ((CraftWorld) bukkitWorld).getHandle();
    world.playSoundEffect(null, location.getX(), location.getY(), location.getZ(), sound, category, volume, pitch);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:NMSHacks.java


示例15: unloadWorld

import net.minecraft.server.WorldServer; //导入依赖的package包/类
@Override
public boolean unloadWorld(World world, boolean save) {
    if (world == null) {
        return false;
    }

    WorldServer handle = ((CraftWorld) world).getHandle();

    if (!(console.worlds.contains(handle))) {
        return false;
    }

    if (!(handle.dimension > 1)) {
        return false;
    }

    if (handle.players.size() > 0) {
        return false;
    }

    WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
    pluginManager.callEvent(e);

    if (e.isCancelled()) {
        return false;
    }

    if (save) {
        try {
            handle.save(true, null);
            handle.saveLevel();
            WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
            getPluginManager().callEvent(event);
        } catch (ExceptionWorldConflict ex) {
            getLogger().log(Level.SEVERE, null, ex);
        }
    }

    worlds.remove(world.getName().toLowerCase());
    console.worlds.remove(console.worlds.indexOf(handle));

    return true;
}
 
开发者ID:Techcable,项目名称:DiffUtils,代码行数:44,代码来源:CraftServer_1710.java


示例16: CustomChunkGenerator

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
    this.world = (WorldServer) world;
    this.generator = generator;

    this.random = new Random(seed);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:CustomChunkGenerator.java


示例17: CraftTravelAgent

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:CraftTravelAgent.java


示例18: unloadWorld

import net.minecraft.server.WorldServer; //导入依赖的package包/类
public boolean unloadWorld(World world, boolean save) {
    if (world == null) {
        return false;
    }

    WorldServer handle = ((CraftWorld) world).getHandle();

    if (!(console.worlds.contains(handle))) {
        return false;
    }

    if (!(handle.dimension > 1)) {
        return false;
    }

    if (handle.players.size() > 0) {
        return false;
    }

    WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
    pluginManager.callEvent(e);

    if (e.isCancelled()) {
        return false;
    }

    if (save) {
        try {
            handle.save(true, null);
            handle.saveLevel();
            WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
            getPluginManager().callEvent(event);
        } catch (ExceptionWorldConflict ex) {
            getLogger().log(Level.SEVERE, null, ex);
        }
    }

    worlds.remove(world.getName().toLowerCase());
    console.worlds.remove(console.worlds.indexOf(handle));

    return true;
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:43,代码来源:CraftServer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationBasedProfileBuilder类代码示例发布时间:2022-05-22
下一篇:
Java Dom4jXPath类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap