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


Java Entity.isPassenger方法代码示例

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


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

示例1: tickPlayers

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
protected void tickPlayers()
{
    super.tickPlayers();
    this.theProfiler.endStartSection("players");

    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        Entity entity = (Entity)this.playerEntities.get(i);
        Entity entity1 = entity.getRidingEntity();

        if (entity1 != null)
        {
            if (!entity1.isDead && entity1.isPassenger(entity))
            {
                continue;
            }

            entity.dismountRidingEntity();
        }

        this.theProfiler.startSection("tick");

        if (!entity.isDead)
        {
            try
            {
                this.updateEntity(entity);
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
                CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
                entity.addEntityCrashInfo(crashreportcategory);
                throw new ReportedException(crashreport);
            }
        }

        this.theProfiler.endSection();
        this.theProfiler.startSection("remove");

        if (entity.isDead)
        {
            int j = entity.chunkCoordX;
            int k = entity.chunkCoordZ;

            if (entity.addedToChunk && this.isChunkLoaded(j, k, true))
            {
                this.getChunkFromChunkCoords(j, k).removeEntity(entity);
            }

            this.loadedEntityList.remove(entity);
            this.onEntityRemoved(entity);
        }

        this.theProfiler.endSection();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:58,代码来源:WorldServer.java

示例2: removeAllEntities

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * also releases skins.
 */
public void removeAllEntities()
{
    this.loadedEntityList.removeAll(this.unloadedEntityList);

    for (int i = 0; i < this.unloadedEntityList.size(); ++i)
    {
        Entity entity = (Entity)this.unloadedEntityList.get(i);
        int j = entity.chunkCoordX;
        int k = entity.chunkCoordZ;

        if (entity.addedToChunk && this.isChunkLoaded(j, k, true))
        {
            this.getChunkFromChunkCoords(j, k).removeEntity(entity);
        }
    }

    for (int i1 = 0; i1 < this.unloadedEntityList.size(); ++i1)
    {
        this.onEntityRemoved((Entity)this.unloadedEntityList.get(i1));
    }

    this.unloadedEntityList.clear();

    for (int j1 = 0; j1 < this.loadedEntityList.size(); ++j1)
    {
        Entity entity1 = (Entity)this.loadedEntityList.get(j1);
        Entity entity2 = entity1.getRidingEntity();

        if (entity2 != null)
        {
            if (!entity2.isDead && entity2.isPassenger(entity1))
            {
                continue;
            }

            entity1.dismountRidingEntity();
        }

        if (entity1.isDead)
        {
            int k1 = entity1.chunkCoordX;
            int l = entity1.chunkCoordZ;

            if (entity1.addedToChunk && this.isChunkLoaded(k1, l, true))
            {
                this.getChunkFromChunkCoords(k1, l).removeEntity(entity1);
            }

            this.loadedEntityList.remove(j1--);
            this.onEntityRemoved(entity1);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:57,代码来源:WorldClient.java


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