當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.getParts方法代碼示例

本文整理匯總了Java中net.minecraft.entity.Entity.getParts方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.getParts方法的具體用法?Java Entity.getParts怎麽用?Java Entity.getParts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.Entity的用法示例。


在下文中一共展示了Entity.getParts方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEntityAdded

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
protected void onEntityAdded(Entity entityIn)
{
    super.onEntityAdded(entityIn);
    this.entitiesById.addKey(entityIn.getEntityId(), entityIn);
    this.entitiesByUuid.put(entityIn.getUniqueID(), entityIn);
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (int i = 0; i < aentity.length; ++i)
        {
            this.entitiesById.addKey(aentity[i].getEntityId(), aentity[i]);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:WorldServer.java

示例2: onEntityRemoved

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
protected void onEntityRemoved(Entity entityIn)
{
    super.onEntityRemoved(entityIn);
    this.entitiesById.removeObject(entityIn.getEntityId());
    this.entitiesByUuid.remove(entityIn.getUniqueID());
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (int i = 0; i < aentity.length; ++i)
        {
            this.entitiesById.removeObject(aentity[i].getEntityId());
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:WorldServer.java

示例3: getEntitiesWithinAABBForEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity.
 */
public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List<Entity> listToFill, Predicate <? super Entity > p_177414_4_)
{
    int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D);
    int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D);
    i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        if (!this.entityLists[k].isEmpty())
        {
            for (Entity entity : this.entityLists[k])
            {
                if (entity.getEntityBoundingBox().intersectsWith(aabb) && entity != entityIn)
                {
                    if (p_177414_4_ == null || p_177414_4_.apply(entity))
                    {
                        listToFill.add(entity);
                    }

                    Entity[] aentity = entity.getParts();

                    if (aentity != null)
                    {
                        for (int l = 0; l < aentity.length; ++l)
                        {
                            entity = aentity[l];

                            if (entity != entityIn && entity.getEntityBoundingBox().intersectsWith(aabb) && (p_177414_4_ == null || p_177414_4_.apply(entity)))
                            {
                                listToFill.add(entity);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:43,代碼來源:Chunk.java

示例4: onEntityAdded

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
protected void onEntityAdded(Entity entityIn)
{
    super.onEntityAdded(entityIn);
    this.entitiesById.addKey(entityIn.getEntityId(), entityIn);
    this.entitiesByUuid.put(entityIn.getUniqueID(), entityIn);
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            this.entitiesById.addKey(entity.getEntityId(), entity);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:WorldServer.java

示例5: onEntityRemoved

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
protected void onEntityRemoved(Entity entityIn)
{
    super.onEntityRemoved(entityIn);
    this.entitiesById.removeObject(entityIn.getEntityId());
    this.entitiesByUuid.remove(entityIn.getUniqueID());
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            this.entitiesById.removeObject(entity.getEntityId());
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:WorldServer.java

示例6: getEntitiesWithinAABBForEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity.
 */
public void getEntitiesWithinAABBForEntity(@Nullable Entity entityIn, AxisAlignedBB aabb, List<Entity> listToFill, Predicate <? super Entity > p_177414_4_)
{
    int i = MathHelper.floor((aabb.minY - 2.0D) / 16.0D);
    int j = MathHelper.floor((aabb.maxY + 2.0D) / 16.0D);
    i = MathHelper.clamp(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        if (!this.entityLists[k].isEmpty())
        {
            for (Entity entity : this.entityLists[k])
            {
                if (entity.getEntityBoundingBox().intersectsWith(aabb) && entity != entityIn)
                {
                    if (p_177414_4_ == null || p_177414_4_.apply(entity))
                    {
                        listToFill.add(entity);
                    }

                    Entity[] aentity = entity.getParts();

                    if (aentity != null)
                    {
                        for (Entity entity1 : aentity)
                        {
                            if (entity1 != entityIn && entity1.getEntityBoundingBox().intersectsWith(aabb) && (p_177414_4_ == null || p_177414_4_.apply(entity1)))
                            {
                                listToFill.add(entity1);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:41,代碼來源:Chunk.java

示例7: onEntityAdded

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void onEntityAdded(Entity entityIn)
{
    super.onEntityAdded(entityIn);
    this.entitiesById.addKey(entityIn.getEntityId(), entityIn);
    this.entitiesByUuid.put(entityIn.getUniqueID(), entityIn);
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            this.entitiesById.addKey(entity.getEntityId(), entity);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:WorldServer.java

示例8: onEntityRemoved

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void onEntityRemoved(Entity entityIn)
{
    super.onEntityRemoved(entityIn);
    this.entitiesById.removeObject(entityIn.getEntityId());
    this.entitiesByUuid.remove(entityIn.getUniqueID());
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            this.entitiesById.removeObject(entity.getEntityId());
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:WorldServer.java

示例9: getEntitiesWithinAABBForEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity.
 */
public void getEntitiesWithinAABBForEntity(@Nullable Entity entityIn, AxisAlignedBB aabb, List<Entity> listToFill, Predicate <? super Entity > p_177414_4_)
{
    int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
    i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        if (!this.entityLists[k].isEmpty())
        {
            for (Entity entity : this.entityLists[k])
            {
                if (entity.getEntityBoundingBox().intersectsWith(aabb) && entity != entityIn)
                {
                    if (p_177414_4_ == null || p_177414_4_.apply(entity))
                    {
                        listToFill.add(entity);
                    }

                    Entity[] aentity = entity.getParts();

                    if (aentity != null)
                    {
                        for (Entity entity1 : aentity)
                        {
                            if (entity1 != entityIn && entity1.getEntityBoundingBox().intersectsWith(aabb) && (p_177414_4_ == null || p_177414_4_.apply(entity1)))
                            {
                                listToFill.add(entity1);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:41,代碼來源:Chunk.java

示例10: renderDebugBoundingBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Renders the bounding box around an entity when F3+B is pressed
 */
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    float f = entityIn.width / 2.0F;
    AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
    RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            double d0 = (entity.posX - entity.prevPosX) * (double)partialTicks;
            double d1 = (entity.posY - entity.prevPosY) * (double)partialTicks;
            double d2 = (entity.posZ - entity.prevPosZ) * (double)partialTicks;
            AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();
            RenderGlobal.drawBoundingBox(axisalignedbb1.minX - this.renderPosX + d0, axisalignedbb1.minY - this.renderPosY + d1, axisalignedbb1.minZ - this.renderPosZ + d2, axisalignedbb1.maxX - this.renderPosX + d0, axisalignedbb1.maxY - this.renderPosY + d1, axisalignedbb1.maxZ - this.renderPosZ + d2, 0.25F, 1.0F, 0.0F, 1.0F);
        }
    }

    if (entityIn instanceof EntityLivingBase)
    {
        float f1 = 0.01F;
        RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    Vec3d vec3d = entityIn.getLook(partialTicks);
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
    vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:47,代碼來源:RenderManager.java

示例11: spawnEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void spawnEntity(FMLMessage.EntitySpawnMessage spawnMsg)
{
    ModContainer mc = Loader.instance().getIndexedModList().get(spawnMsg.modId);
    EntityRegistration er = EntityRegistry.instance().lookupModSpawn(mc, spawnMsg.modEntityTypeId);
    if (er == null)
    {
        throw new RuntimeException( "Could not spawn mod entity ModID: " + spawnMsg.modId + " EntityID: " + spawnMsg.modEntityTypeId +
                " at ( " + spawnMsg.rawX + "," + spawnMsg.rawY + ", " + spawnMsg.rawZ + ") Please contact mod author or server admin.");
    }
    WorldClient wc = FMLClientHandler.instance().getWorldClient();
    Class<? extends Entity> cls = er.getEntityClass();
    try
    {
        Entity entity;
        if (er.hasCustomSpawning())
        {
            entity = er.doCustomSpawning(spawnMsg);
        } else
        {
            entity = cls.getConstructor(World.class).newInstance(wc);

            int offset = spawnMsg.entityId - entity.getEntityId();
            entity.setEntityId(spawnMsg.entityId);
            entity.setUniqueId(spawnMsg.entityUUID);
            entity.setLocationAndAngles(spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ, spawnMsg.scaledYaw, spawnMsg.scaledPitch);
            if (entity instanceof EntityLiving)
            {
                ((EntityLiving) entity).rotationYawHead = spawnMsg.scaledHeadYaw;
            }

            Entity parts[] = entity.getParts();
            if (parts != null)
            {
                for (int j = 0; j < parts.length; j++)
                {
                    parts[j].setEntityId(parts[j].getEntityId() + offset);
                }
            }
        }

        EntityTracker.updateServerPosition(entity, spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ);

        EntityPlayerSP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity();
        if (entity instanceof IThrowableEntity)
        {
            Entity thrower = clientPlayer.getEntityId() == spawnMsg.throwerId ? clientPlayer : wc.getEntityByID(spawnMsg.throwerId);
            ((IThrowableEntity) entity).setThrower(thrower);
        }

        if (spawnMsg.dataWatcherList != null)
        {
            entity.getDataManager().setEntryValues(spawnMsg.dataWatcherList);
        }

        if (spawnMsg.throwerId > 0)
        {
            entity.setVelocity(spawnMsg.speedScaledX, spawnMsg.speedScaledY, spawnMsg.speedScaledZ);
        }

        if (entity instanceof IEntityAdditionalSpawnData)
        {
            ((IEntityAdditionalSpawnData) entity).readSpawnData(spawnMsg.dataStream);
        }
        wc.addEntityToWorld(spawnMsg.entityId, entity);
    } catch (Exception e)
    {
        FMLLog.log(Level.ERROR, e, "A severe problem occurred during the spawning of an entity at ( " + spawnMsg.rawX + "," + spawnMsg.rawY + ", " + spawnMsg.rawZ +")");
        throw Throwables.propagate(e);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:71,代碼來源:EntitySpawnHandler.java


注:本文中的net.minecraft.entity.Entity.getParts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。