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

Java World类代码示例

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

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



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

示例1: callBlockMultiPlaceEvent

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Block place methods
 */
public static BlockMultiPlaceEvent callBlockMultiPlaceEvent(World world, EntityHuman who, List<BlockState> blockStates, int clickedX, int clickedY, int clickedZ) {
    CraftWorld craftWorld = world.getWorld();
    CraftServer craftServer = world.getServer();
    Player player = (who == null) ? null : (Player) who.getBukkitEntity();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);

    boolean canBuild = true;
    for (int i = 0; i < blockStates.size(); i++) {
        if (!canBuild(craftWorld, player, blockStates.get(i).getX(), blockStates.get(i).getZ())) {
            canBuild = false;
            break;
        }
    }

    BlockMultiPlaceEvent event = new BlockMultiPlaceEvent(blockStates, blockClicked, player.getItemInHand(), player, canBuild);
    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:CraftEventFactory.java


示例2: callPlayerDeathEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List<org.bukkit.inventory.ItemStack> drops, String deathMessage, boolean keepInventory) {
    CraftPlayer entity = victim.getBukkitEntity();
    PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
    event.setKeepInventory(keepInventory);
    org.bukkit.World world = entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.keepLevel = event.getKeepLevel();
    victim.newLevel = event.getNewLevel();
    victim.newTotalExp = event.getNewTotalExp();
    victim.expToDrop = event.getDroppedExp();
    victim.newExp = event.getNewExp();

    if (event.getKeepInventory()) {
        return event;
    }

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:26,代码来源:CraftEventFactory.java


示例3: callBlockIgniteEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, int igniterX, int igniterY, int igniterZ) {
    org.bukkit.World bukkitWorld = world.getWorld();
    Block igniter = bukkitWorld.getBlockAt(igniterX, igniterY, igniterZ);
    IgniteCause cause;
    switch (igniter.getType()) {
        case LAVA:
        case STATIONARY_LAVA:
            cause = IgniteCause.LAVA;
            break;
        case DISPENSER:
            cause = IgniteCause.FLINT_AND_STEEL;
            break;
        case FIRE: // Fire or any other unknown block counts as SPREAD.
        default:
            cause = IgniteCause.SPREAD;
    }

    BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, igniter);
    world.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:22,代码来源:CraftEventFactory.java


示例4: callBlockPlaceEvent

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Block place methods
 */
public static BlockPlaceEvent callBlockPlaceEvent(World world, EntityHuman who, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) {
    CraftWorld craftWorld = world.getWorld();
    CraftServer craftServer = world.getServer();

    Player player = (who == null) ? null : (Player) who.getBukkitEntity();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    Block placedBlock = replacedBlockState.getBlock();

    boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ());

    BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, player.getItemInHand(), player, canBuild);
    craftServer.getPluginManager().callEvent(event);

    return event;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:20,代码来源:CraftEventFactory.java


示例5: callEntityDeathEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
    CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
    EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
    org.bukkit.World world = entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.expToDrop = event.getDroppedExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:17,代码来源:CraftEventFactory.java


示例6: callPlayerDeathEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List<org.bukkit.inventory.ItemStack> drops, String deathMessage) {
    CraftPlayer entity = victim.getBukkitEntity();
    PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
    org.bukkit.World world = entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.keepLevel = event.getKeepLevel();
    victim.newLevel = event.getNewLevel();
    victim.newTotalExp = event.getNewTotalExp();
    victim.expToDrop = event.getDroppedExp();
    victim.newExp = event.getNewExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:21,代码来源:CraftEventFactory.java


示例7: getPeripheral

import net.minecraft.server.World; //导入依赖的package包/类
public static IPeripheral getPeripheral(World world, int x, int y, int z) {
    if (y >= 0 && y < world.getHeight()) {
        TileEntity tileEntity = world.getTileEntity(x, y, z);
        if (tileEntity == null) {
            return null;
        } else if (tileEntity instanceof TileEntityHowlerAlarm) {
            return new HowlerAlarmPeripheral(
                    (TileEntityHowlerAlarm) tileEntity);
        } else if (tileEntity instanceof TileEntityNuclearReactor) {
            return new IC2NuclearReactorPeripheral(
                    (TileEntityNuclearReactor) tileEntity);
        } else if (tileEntity instanceof IEnergyConductor) {
            return new IC2WirePeripheral(
                    (IEnergyConductor) tileEntity);
        } else if (tileEntity instanceof TileEntityElectricBlock) {
            return new IC2BatteryPeripiheral(
                    (TileEntityElectricBlock) tileEntity);
        } else {
            return null;
        }
    }

    return null;
}
 
开发者ID:SKCraft,项目名称:CCBolts,代码行数:25,代码来源:CCHook.java


示例8: QueuedChunk

import net.minecraft.server.World; //导入依赖的package包/类
public QueuedChunk(int x, int z, ChunkRegionLoader loader, World world, ChunkProviderServer provider) {
    this.x = x;
    this.z = z;
    this.loader = loader;
    this.world = world;
    this.provider = provider;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:8,代码来源:QueuedChunk.java


示例9: handleBlockGrowEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static void handleBlockGrowEvent(World world, int x, int y, int z, net.minecraft.server.Block type, int data) {
    Block block = world.getWorld().getBlockAt(x, y, z);
    CraftBlockState state = (CraftBlockState) block.getState();
    state.setTypeId(net.minecraft.server.Block.getId(type));
    state.setRawData((byte) data);

    BlockGrowEvent event = new BlockGrowEvent(block, state);
    Bukkit.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
        state.update(true);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:14,代码来源:CraftEventFactory.java


示例10: setRabbitType

import net.minecraft.server.World; //导入依赖的package包/类
@Override
public void setRabbitType(Type type) {
    EntityRabbit entity = getHandle();
    if (getRabbitType() == Type.THE_KILLER_BUNNY) {
        // Reset goals and target finders.
        World world = ((CraftWorld) this.getWorld()).getHandle();
        entity.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
        entity.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
        entity.initializePathFinderGoals();
    }

    entity.setRabbitType(CraftMagicMapping.toMagic(type)); 
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:14,代码来源:CraftRabbit.java


示例11: handleBlockGrowEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static void handleBlockGrowEvent(World world, int x, int y, int z, int type, int data) {
    Block block = world.getWorld().getBlockAt(x, y, z);
    CraftBlockState state = (CraftBlockState) block.getState();
    state.setTypeId(type);
    state.setRawData((byte) data);

    BlockGrowEvent event = new BlockGrowEvent(block, state);
    Bukkit.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
        state.update(true);
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:14,代码来源:CraftEventFactory.java


示例12: callBlockTickEvent

import net.minecraft.server.World; //导入依赖的package包/类
public static BlockTickEvent callBlockTickEvent(World world, int x, int y, int z, Random random) {
    org.bukkit.World bukkitWorld = world.getWorld();
    final Block bukkitBlock = bukkitWorld.getBlockAt(x, y, z);
    final BlockTickEvent event = new BlockTickEvent(bukkitBlock, random);
    world.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:8,代码来源:CraftEventFactory.java


示例13: activateEntities

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );

    for ( Entity player : new ArrayList<Entity>( world.players ) )
    {

        player.activatedTick = MinecraftServer.currentTick;
        growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
        growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
        growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
        growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor( maxBB.a / 16.0D );
        int j = MathHelper.floor( maxBB.d / 16.0D );
        int k = MathHelper.floor( maxBB.c / 16.0D );
        int l = MathHelper.floor( maxBB.f / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkAt( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:45,代码来源:ActivationRange.java


示例14: updateNearbyBlocks

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Starts the timings handler, then updates all blocks within the set radius
 * of the given coordinate, revealing them if they are hidden ores.
 */
public void updateNearbyBlocks(World world, int x, int y, int z)
{
    if ( world.spigotConfig.antiXray )
    {
        update.startTiming();
        updateNearbyBlocks( world, x, y, z, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
        update.stopTiming();
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:14,代码来源:AntiXray.java


示例15: obfuscateSync

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Starts the timings handler, and then removes all non exposed ores from
 * the chunk buffer.
 */
public void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world)
{
    if ( world.spigotConfig.antiXray )
    {
        obfuscate.startTiming();
        obfuscate( chunkX, chunkY, bitmask, buffer, world );
        obfuscate.stopTiming();
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:14,代码来源:AntiXray.java


示例16: isLoaded

import net.minecraft.server.World; //导入依赖的package包/类
private static boolean isLoaded(World world, int x, int y, int z, int radius)
{
    return world.isLoaded( x, y, z )
            || ( radius > 0
            && ( isLoaded( world, x + 1, y, z, radius - 1 )
            || isLoaded( world, x - 1, y, z, radius - 1 )
            || isLoaded( world, x, y + 1, z, radius - 1 )
            || isLoaded( world, x, y - 1, z, radius - 1 )
            || isLoaded( world, x, y, z + 1, radius - 1 )
            || isLoaded( world, x, y, z - 1, radius - 1 ) ) );
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:12,代码来源:AntiXray.java


示例17: hasTransparentBlockAdjacent

import net.minecraft.server.World; //导入依赖的package包/类
private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius)
{
    return !Block.l( world.getTypeId( x, y, z ) ) /* isSolidBlock */
            || ( radius > 0
            && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 )
            || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )
            || hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 )
            || hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 )
            || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 )
            || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) );
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:12,代码来源:AntiXray.java


示例18: activateEntities

import net.minecraft.server.World; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );

    for ( Entity player : (List<Entity>) world.players )
    {

        player.activatedTick = MinecraftServer.currentTick;
        growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
        growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
        growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
        growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor( maxBB.a / 16.0D );
        int j = MathHelper.floor( maxBB.d / 16.0D );
        int k = MathHelper.floor( maxBB.c / 16.0D );
        int l = MathHelper.floor( maxBB.f / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkAt( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:45,代码来源:ActivationRange.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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