Java 类net.minecraft.server.WorldServer 实例源码

项目:CraftBukkit    文件:CraftTravelAgent.java   
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;
}
项目:Craftbukkit    文件:CraftTravelAgent.java   
@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;
}
项目:Almura-Server    文件:CraftTravelAgent.java   
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;
}
项目:Tweakkit-Server    文件:CraftTravelAgent.java   
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;
}
项目:Craft-city    文件:CraftTravelAgent.java   
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;
}
项目:CraftBukkit    文件:CraftPainting.java   
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;
}
项目:CraftBukkit    文件:CraftItemFrame.java   
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;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
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;
}
项目:CraftBukkit    文件:CraftChunk.java   
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;
}
项目:Craftbukkit    文件:CraftPainting.java   
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;
}
项目:Craftbukkit    文件:CraftItemFrame.java   
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;
}
项目:Almura-Server    文件:CraftPainting.java   
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;
}
项目:Almura-Server    文件:CraftEventFactory.java   
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;
}
项目:Almura-Server    文件:CraftChunk.java   
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;
}
项目:Tweakkit-Server    文件:CraftPainting.java   
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;
}
项目:Tweakkit-Server    文件:CraftItemFrame.java   
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;
}
项目:Tweakkit-Server    文件:CraftEventFactory.java   
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;
}
项目:Tweakkit-Server    文件:CraftChunk.java   
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;
}
项目:SpigotSource    文件:CraftPainting.java   
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;
}
项目:SpigotSource    文件:CraftItemFrame.java   
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;
}
项目:SpigotSource    文件:CraftTravelAgent.java   
@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;
}
项目:Craft-city    文件:CraftPainting.java   
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;
}
项目:Craft-city    文件:CraftEventFactory.java   
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;
}
项目:Craft-city    文件:CraftChunk.java   
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;
}
项目:ProjectAres    文件:NMSHacks.java   
private static EntityTrackerEntry getTrackerEntry(net.minecraft.server.Entity nms) {
    return ((WorldServer) nms.getWorld()).getTracker().trackedEntities.get(nms.getId());
}
项目:ProjectAres    文件:NMSHacks.java   
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);
}
项目:ProjectAres    文件:NMSHacks.java   
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);
}
项目:DiffUtils    文件:CraftServer_1710.java   
@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;
}
项目:CraftBukkit    文件:CustomChunkGenerator.java   
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
    this.world = (WorldServer) world;
    this.generator = generator;

    this.random = new Random(seed);
}
项目:CraftBukkit    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:CraftBukkit    文件:CraftServer.java   
@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;
}
项目:Craftbukkit    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:Almura-Server    文件:CustomChunkGenerator.java   
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
    this.world = (WorldServer) world;
    this.generator = generator;

    this.random = new Random(seed);
}
项目:Almura-Server    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:Tweakkit-Server    文件:CustomChunkGenerator.java   
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
    this.world = (WorldServer) world;
    this.generator = generator;

    this.random = new Random(seed);
}
项目:Tweakkit-Server    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:SpigotSource    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:Craft-city    文件:CustomChunkGenerator.java   
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
    this.world = (WorldServer) world;
    this.generator = generator;

    this.random = new Random(seed);
}
项目:Craft-city    文件:CraftTravelAgent.java   
public CraftTravelAgent(WorldServer worldserver) {
    super(worldserver);
    if (DEFAULT == null && worldserver.dimension == 0) {
        DEFAULT = this;
    }
}
项目:Craft-city    文件:CraftServer.java   
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;
}