当前位置: 首页>>代码示例>>Java>>正文


Java MinecraftServer.worldServerForDimension方法代码示例

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


在下文中一共展示了MinecraftServer.worldServerForDimension方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (args.length <= 0) {
        ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.RED + "Use 'all', 'passive', 'hostile' or name of the mob followed by optional dimension id"));
        InControl.logger.error("Use 'all', 'passive', 'hostile', 'entity' or name of the mob followed by optional dimension id");
        return;
    }
    int dimension = (sender instanceof EntityPlayer) ? sender.getEntityWorld().provider.getDimension() : 0;
    if (args.length > 1) {
        dimension = Integer.parseInt(args[1]);
    }
    String arg0 = args[0].toLowerCase();
    boolean all = "all".equals(arg0);
    boolean passive = "passive".equals(arg0);
    boolean hostile = "hostile".equals(arg0);
    boolean entity = "entity".equals(arg0);

    WorldServer worldServer = server.worldServerForDimension(dimension);
    List<Entity> entities = worldServer.getEntities(Entity.class, input -> {
        if (all) {
            return !(input instanceof EntityPlayer);
        } else if (passive) {
            return input instanceof IAnimals && !(input instanceof IMob);
        } else if (hostile) {
            return input instanceof IMob;
        } else if (entity) {
            return !(input instanceof IAnimals) && !(input instanceof EntityPlayer);
        } else {
            String id = EntityTools.findEntityIdByClass(input.getClass());
            return arg0.equals(id);
        }
    });
    for (Entity e : entities) {
        worldServer.removeEntity(e);
    }
    ChatTools.addChatMessage(sender, new TextComponentString(TextFormatting.YELLOW + "Removed " + entities.size() + " entities!"));
}
 
开发者ID:McJty,项目名称:InControl,代码行数:38,代码来源:CmdKillMobs.java

示例2: getByIdentifier

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public TileEntity getByIdentifier(MinecraftServer server) {
    World world = server.worldServerForDimension(dimId);
    if (world == null) return null;
    return world.getTileEntity(pos);
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:7,代码来源:Identifier.java

示例3: isLoaded

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
@Override
public boolean isLoaded(MinecraftServer server) {
    World world = server.worldServerForDimension(dimId);
    if (world == null) return false;
    return world.getTileEntity(pos) != null;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:7,代码来源:Identifier.java

示例4: travelToDimension

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
 * Teleports the entity to another dimension. Params: Dimension number to teleport to
 */
public void travelToDimension(int dimensionId)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        this.worldObj.theProfiler.startSection("changeDimension");
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        int i = this.dimension;
        WorldServer worldserver = minecraftserver.worldServerForDimension(i);
        WorldServer worldserver1 = minecraftserver.worldServerForDimension(dimensionId);
        this.dimension = dimensionId;

        if (i == 1 && dimensionId == 1)
        {
            worldserver1 = minecraftserver.worldServerForDimension(0);
            this.dimension = 0;
        }

        this.worldObj.removeEntity(this);
        this.isDead = false;
        this.worldObj.theProfiler.startSection("reposition");
        minecraftserver.getConfigurationManager().transferEntityToWorld(this, i, worldserver, worldserver1);
        this.worldObj.theProfiler.endStartSection("reloading");
        Entity entity = EntityList.createEntityByName(EntityList.getEntityString(this), worldserver1);

        if (entity != null)
        {
            entity.copyDataFromOld(this);

            if (i == 1 && dimensionId == 1)
            {
                BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(worldserver1.getSpawnPoint());
                entity.moveToBlockPosAndAngles(blockpos, entity.rotationYaw, entity.rotationPitch);
            }

            worldserver1.spawnEntityInWorld(entity);
        }

        this.isDead = true;
        this.worldObj.theProfiler.endSection();
        worldserver.resetUpdateEntityTick();
        worldserver1.resetUpdateEntityTick();
        this.worldObj.theProfiler.endSection();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:48,代码来源:Entity.java

示例5: execute

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    World world = (World)(sender instanceof EntityPlayer ? ((EntityPlayer)sender).world : server.worldServerForDimension(0));
    sender.addChatMessage(new TextComponentTranslation("commands.seed.success", new Object[] {Long.valueOf(world.getSeed())}));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:CommandShowSeed.java

示例6: execute

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    World world = (World)(sender instanceof EntityPlayer ? ((EntityPlayer)sender).worldObj : server.worldServerForDimension(0));
    sender.addChatMessage(new TextComponentTranslation("commands.seed.success", new Object[] {Long.valueOf(world.getSeed())}));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:CommandShowSeed.java


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