Java 类net.minecraft.entity.Entity 实例源码

项目:DecompiledMinecraft    文件:World.java   
/**
 * Schedule the entity for removal during the next tick. Marks the entity dead in anticipation.
 */
public void removeEntity(Entity entityIn)
{
    if (entityIn.riddenByEntity != null)
    {
        entityIn.riddenByEntity.mountEntity((Entity)null);
    }

    if (entityIn.ridingEntity != null)
    {
        entityIn.mountEntity((Entity)null);
    }

    entityIn.setDead();

    if (entityIn instanceof EntityPlayer)
    {
        this.playerEntities.remove(entityIn);
        this.updateAllPlayersSleepingFlag();
        this.onEntityRemoved(entityIn);
    }
}
项目:CustomWorldGen    文件:ModelSnowMan.java   
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
    super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
    this.head.rotateAngleY = netHeadYaw * 0.017453292F;
    this.head.rotateAngleX = headPitch * 0.017453292F;
    this.body.rotateAngleY = netHeadYaw * 0.017453292F * 0.25F;
    float f = MathHelper.sin(this.body.rotateAngleY);
    float f1 = MathHelper.cos(this.body.rotateAngleY);
    this.rightHand.rotateAngleZ = 1.0F;
    this.leftHand.rotateAngleZ = -1.0F;
    this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY;
    this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY;
    this.rightHand.rotationPointX = f1 * 5.0F;
    this.rightHand.rotationPointZ = -f * 5.0F;
    this.leftHand.rotationPointX = -f1 * 5.0F;
    this.leftHand.rotationPointZ = f * 5.0F;
}
项目:BaseClient    文件:EntityArmorStand.java   
protected void collideWithNearbyEntities()
{
    List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox());

    if (list != null && !list.isEmpty())
    {
        for (int i = 0; i < list.size(); ++i)
        {
            Entity entity = (Entity)list.get(i);

            if (entity instanceof EntityMinecart && ((EntityMinecart)entity).getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.getDistanceSqToEntity(entity) <= 0.2D)
            {
                entity.applyEntityCollision(this);
            }
        }
    }
}
项目:CustomWorldGen    文件:RenderGlobal.java   
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
{
    float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
    float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
    {
        f += 180.0F;
    }

    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    return new Vector3f(f3 * f4, f5, f2 * f4);
}
项目:DecompiledMinecraft    文件:EnchantmentThorns.java   
/**
 * Whenever an entity that has this enchantment on one of its associated items is damaged this method will be
 * called.
 */
public void onUserHurt(EntityLivingBase user, Entity attacker, int level)
{
    Random random = user.getRNG();
    ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantment.thorns, user);

    if (func_92094_a(level, random))
    {
        if (attacker != null)
        {
            attacker.attackEntityFrom(DamageSource.causeThornsDamage(user), (float)func_92095_b(level, random));
            attacker.playSound("damage.thorns", 0.5F, 1.0F);
        }

        if (itemstack != null)
        {
            itemstack.damageItem(3, user);
        }
    }
    else if (itemstack != null)
    {
        itemstack.damageItem(1, user);
    }
}
项目:Backmemed    文件:CommandBase.java   
protected static NBTTagCompound entityToNBT(Entity theEntity)
{
    NBTTagCompound nbttagcompound = theEntity.writeToNBT(new NBTTagCompound());

    if (theEntity instanceof EntityPlayer)
    {
        ItemStack itemstack = ((EntityPlayer)theEntity).inventory.getCurrentItem();

        if (!itemstack.func_190926_b())
        {
            nbttagcompound.setTag("SelectedItem", itemstack.writeToNBT(new NBTTagCompound()));
        }
    }

    return nbttagcompound;
}
项目:CustomWorldGen    文件:ParticleItemPickup.java   
/**
 * Renders the particle
 */
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
    float f = ((float)this.age + partialTicks) / (float)this.maxAge;
    f = f * f;
    double d0 = this.item.posX;
    double d1 = this.item.posY;
    double d2 = this.item.posZ;
    double d3 = this.target.lastTickPosX + (this.target.posX - this.target.lastTickPosX) * (double)partialTicks;
    double d4 = this.target.lastTickPosY + (this.target.posY - this.target.lastTickPosY) * (double)partialTicks + (double)this.yOffset;
    double d5 = this.target.lastTickPosZ + (this.target.posZ - this.target.lastTickPosZ) * (double)partialTicks;
    double d6 = d0 + (d3 - d0) * (double)f;
    double d7 = d1 + (d4 - d1) * (double)f;
    double d8 = d2 + (d5 - d2) * (double)f;
    int i = this.getBrightnessForRender(partialTicks);
    int j = i % 65536;
    int k = i / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    d6 = d6 - interpPosX;
    d7 = d7 - interpPosY;
    d8 = d8 - interpPosZ;
    GlStateManager.enableLighting();
    this.renderManager.doRenderEntity(this.item, d6, d7, d8, this.item.rotationYaw, partialTicks, false);
}
项目:BaseClient    文件:World.java   
/**
 * spwans an entity and loads surrounding chunks
 */
public void joinEntityInSurroundings(Entity entityIn)
{
    int i = MathHelper.floor_double(entityIn.posX / 16.0D);
    int j = MathHelper.floor_double(entityIn.posZ / 16.0D);
    int k = 2;

    for (int l = i - k; l <= i + k; ++l)
    {
        for (int i1 = j - k; i1 <= j + k; ++i1)
        {
            this.getChunkFromChunkCoords(l, i1);
        }
    }

    if (!this.loadedEntityList.contains(entityIn))
    {
        this.loadedEntityList.add(entityIn);
    }
}
项目:ClientAPI    文件:MixinBlock.java   
/**
 * @reason the overwritten method is only one line, we need to overwrite to mutate the AABB and pass params into the event constructor
 * @author Brady
 */
@Overwrite
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
    Block block = (Block) (Object) (this);
    AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(state, worldIn, pos);

    BoundingBoxEvent event = new BoundingBoxEvent(block, pos, axisalignedbb, collidingBoxes, entityIn);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        return;

    axisalignedbb = event.getBoundingBox();

    addCollisionBoxToList(pos, entityBox, collidingBoxes, axisalignedbb);
}
项目:minecraft-quiverbow    文件:Model_AA.java   
public void setRotationAngles(float x, float y, float z, float yaw, float pitch, float tick, Entity entity)
{
    super.setRotationAngles(x, y, z, yaw, pitch, tick, entity);

    // Looking at things
    this.head.rotateAngleY = yaw / (180F / (float) Math.PI);
    this.head.rotateAngleX = pitch / (180F / (float) Math.PI);

    // Leg movement when wandering around?
    this.legC1.rotateAngleX = MathHelper.cos(x * 0.6662F) * 1.4F * y;
    this.legC1.rotateAngleY = 0.0F;

    this.legC2.rotateAngleX = MathHelper.cos(x * 0.6662F + (float)Math.PI) * 1.4F * y;
    this.legC2.rotateAngleY = 0.0F;

    this.legC3.rotateAngleX = MathHelper.cos(x * 0.6662F) * 1.4F * y;
    this.legC3.rotateAngleY = 0.0F;

    this.legC4.rotateAngleX = MathHelper.cos(x * 0.6662F + (float)Math.PI) * 1.4F * y;
    this.legC4.rotateAngleY = 0.0F;
}
项目:DecompiledMinecraft    文件:WorldServer.java   
/**
 * returns a new explosion. Does initiation (at time of writing Explosion is not finished)
 */
public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking)
{
    Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking);
    explosion.doExplosionA();
    explosion.doExplosionB(false);

    if (!isSmoking)
    {
        explosion.func_180342_d();
    }

    for (EntityPlayer entityplayer : this.playerEntities)
    {
        if (entityplayer.getDistanceSq(x, y, z) < 4096.0D)
        {
            ((EntityPlayerMP)entityplayer).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3)explosion.getPlayerKnockbackMap().get(entityplayer)));
        }
    }

    return explosion;
}
项目:DecompiledMinecraft    文件:ModelZombieVillager.java   
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
    float f = MathHelper.sin(this.swingProgress * (float)Math.PI);
    float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
    this.bipedRightArm.rotateAngleZ = 0.0F;
    this.bipedLeftArm.rotateAngleZ = 0.0F;
    this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
    this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
    this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
    this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
    this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
    this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
    this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
    this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
    this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
    this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
}
项目:Infernum    文件:EntityFireBreath.java   
protected void onImpact(RayTraceResult result) {
    if (!this.world.isRemote && this.world instanceof WorldServer) {
        if (result.typeOfHit == RayTraceResult.Type.ENTITY && result.entityHit != null
                && !result.entityHit.equals(this.caster)) {
            Entity entity = result.entityHit;
            if (!entity.isImmuneToFire()) {
                entity.setFire(7);
            }
        } else if (result.typeOfHit == RayTraceResult.Type.BLOCK && result.getBlockPos() != null
                && result.sideHit != null) {
            BlockPos offsetPos = result.getBlockPos().offset(result.sideHit);
            if (this.world.getBlockState(offsetPos).getMaterial() != Material.WATER
                    && (this.world.isAirBlock(offsetPos)
                            || this.world.getBlockState(offsetPos).getBlock().isReplaceable(this.world, offsetPos))
                    && Blocks.FIRE.canPlaceBlockAt(this.world, offsetPos)) {
                this.world.setBlockState(offsetPos, Blocks.FIRE.getDefaultState(), 11);
            }
        }
    }
}
项目:MeeCreeps    文件:WorkerHelper.java   
@Override
public boolean navigateTo(Entity dest, Consumer<BlockPos> job, double maxDist) {
    if (dest == null || dest.isDead) {
        return false;
    }
    double d = getSquareDist(entity, dest);
    if (d > maxDist * maxDist) {
        return false;
    } else if (d < DISTANCE_TOLERANCE) {
        job.accept(dest.getPosition());
    } else if (!entity.getNavigator().tryMoveToEntityLiving(dest, 2.0)) {
        // We need to teleport
        entity.setPositionAndUpdate(dest.posX, dest.posY, dest.posZ);
        job.accept(dest.getPosition());
    } else {
        this.movingToPos = null;
        this.movingToEntity = dest;
        pathTries = 1;
        this.job = job;
    }
    return true;
}
项目:Proyecto-DASI    文件:AbsoluteMovementCommandsImplementation.java   
@Override
public IMessage onMessage(final TeleportMessage message, final MessageContext ctx)
{
    // Don't act here - if we cause chunk loading on this thread (netty) then chunks will get
    // lost from the server.
    IThreadListener mainThread = null;
    if (ctx.side == Side.CLIENT)
        mainThread = Minecraft.getMinecraft();
    else
        mainThread = MinecraftServer.getServer();
    mainThread.addScheduledTask(new Runnable()
    {
        @Override
        public void run()
        {
            EnumSet<S08PacketPlayerPosLook.EnumFlags> enumset = EnumSet.noneOf(S08PacketPlayerPosLook.EnumFlags.class);
            if (!message.setX)
                enumset.add(S08PacketPlayerPosLook.EnumFlags.X);
            if (!message.setY)
                enumset.add(S08PacketPlayerPosLook.EnumFlags.Y);
            if (!message.setZ)
                enumset.add(S08PacketPlayerPosLook.EnumFlags.Z);
            if (!message.setYaw)
                enumset.add(S08PacketPlayerPosLook.EnumFlags.Y_ROT);
            if (!message.setPitch)
                enumset.add(S08PacketPlayerPosLook.EnumFlags.X_ROT);

            EntityPlayerMP player = ctx.getServerHandler().playerEntity;
            player.mountEntity((Entity) null);
            player.playerNetServerHandler.setPlayerLocation(message.x, message.y, message.z, message.yaw, message.pitch, enumset);
            player.setRotationYawHead(message.yaw);
        }
    });
    return null;
}
项目:BaseClient    文件:EnchantmentHelper.java   
public static void applyArthropodEnchantments(EntityLivingBase p_151385_0_, Entity p_151385_1_)
{
    ENCHANTMENT_ITERATOR_DAMAGE.user = p_151385_0_;
    ENCHANTMENT_ITERATOR_DAMAGE.target = p_151385_1_;

    if (p_151385_0_ != null)
    {
        applyEnchantmentModifierArray(ENCHANTMENT_ITERATOR_DAMAGE, p_151385_0_.getInventory());
    }

    if (p_151385_0_ instanceof EntityPlayer)
    {
        applyEnchantmentModifier(ENCHANTMENT_ITERATOR_DAMAGE, p_151385_0_.getHeldItem());
    }
}
项目:DecompiledMinecraft    文件:EntityRenderer.java   
/**
 * Changes the field of view of the player depending on if they are underwater or not
 */
private float getFOVModifier(float partialTicks, boolean p_78481_2_)
{
    if (this.debugView)
    {
        return 90.0F;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        float f = 70.0F;

        if (p_78481_2_)
        {
            f = this.mc.gameSettings.fovSetting;
            f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks);
        }

        if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F)
        {
            float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks;
            f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
        }

        Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);

        if (block.getMaterial() == Material.water)
        {
            f = f * 60.0F / 70.0F;
        }

        return f;
    }
}
项目:harshencastle    文件:HarshenTemplate.java   
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.x));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.y));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.z));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.x, vec3d1.y, vec3d1.z, f, entity.rotationPitch);
                worldIn.spawnEntity(entity);
            }
        }
    }
}
项目:Backmemed    文件:ModelGhast.java   
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
    for (int i = 0; i < this.tentacles.length; ++i)
    {
        this.tentacles[i].rotateAngleX = 0.2F * MathHelper.sin(ageInTicks * 0.3F + (float)i) + 0.4F;
    }
}
项目:CustomWorldGen    文件:Teleporter.java   
public void placeInPortal(Entity entityIn, float rotationYaw)
{
    if (this.worldServerInstance.provider.getDimensionType().getId() != 1)
    {
        if (!this.placeInExistingPortal(entityIn, rotationYaw))
        {
            this.makePortal(entityIn);
            this.placeInExistingPortal(entityIn, rotationYaw);
        }
    }
    else
    {
        int i = MathHelper.floor_double(entityIn.posX);
        int j = MathHelper.floor_double(entityIn.posY) - 1;
        int k = MathHelper.floor_double(entityIn.posZ);
        int l = 1;
        int i1 = 0;

        for (int j1 = -2; j1 <= 2; ++j1)
        {
            for (int k1 = -2; k1 <= 2; ++k1)
            {
                for (int l1 = -1; l1 < 3; ++l1)
                {
                    int i2 = i + k1 * 1 + j1 * 0;
                    int j2 = j + l1;
                    int k2 = k + k1 * 0 - j1 * 1;
                    boolean flag = l1 < 0;
                    this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.OBSIDIAN.getDefaultState() : Blocks.AIR.getDefaultState());
                }
            }
        }

        entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
        entityIn.motionX = 0.0D;
        entityIn.motionY = 0.0D;
        entityIn.motionZ = 0.0D;
    }
}
项目:CraftingParadiseMod    文件:EntityHandler.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void onEntityConstruction(EntityEvent.EntityConstructing event)
{
    Entity entity = event.getEntity();
    if(entity instanceof EntityPlayer)
    {
        if(entity.world != null)
        {
            if(event.getEntity().world.isRemote)
            {
                CraftingParadise.proxy.registerCustomSky();
            }
        }
    }
}
项目:BaseClient    文件:EntityPlayer.java   
private Collection<ScoreObjective> func_175137_e(Entity p_175137_1_)
{
    ScorePlayerTeam scoreplayerteam = this.getWorldScoreboard().getPlayersTeam(this.getName());

    if (scoreplayerteam != null)
    {
        int i = scoreplayerteam.getChatFormat().getColorIndex();

        if (i >= 0 && i < IScoreObjectiveCriteria.field_178793_i.length)
        {
            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178793_i[i]))
            {
                Score score = this.getWorldScoreboard().getValueFromObjective(p_175137_1_.getName(), scoreobjective);
                score.func_96648_a();
            }
        }
    }

    ScorePlayerTeam scoreplayerteam1 = this.getWorldScoreboard().getPlayersTeam(p_175137_1_.getName());

    if (scoreplayerteam1 != null)
    {
        int j = scoreplayerteam1.getChatFormat().getColorIndex();

        if (j >= 0 && j < IScoreObjectiveCriteria.field_178792_h.length)
        {
            return this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178792_h[j]);
        }
    }

    return Lists.<ScoreObjective>newArrayList();
}
项目:BaseClient    文件:CommandTestFor.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 1)
    {
        throw new WrongUsageException("commands.testfor.usage", new Object[0]);
    }
    else
    {
        Entity entity = func_175768_b(sender, args[0]);
        NBTTagCompound nbttagcompound = null;

        if (args.length >= 2)
        {
            try
            {
                nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 1));
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.testfor.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        if (nbttagcompound != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
            entity.writeToNBT(nbttagcompound1);

            if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true))
            {
                throw new CommandException("commands.testfor.failure", new Object[] {entity.getName()});
            }
        }

        notifyOperators(sender, this, "commands.testfor.success", new Object[] {entity.getName()});
    }
}
项目:interactionwheel    文件:RenderHelper.java   
public static boolean renderObject(Minecraft mc, int x, int y, Object itm, boolean highlight) {
    if (itm instanceof Entity) {
        renderEntity((Entity) itm, x, y, 10);
        return true;
    }
    RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
    return renderObject(mc, itemRender, x, y, itm, highlight, 200);
}
项目:BaseClient    文件:BlockTripWire.java   
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!worldIn.isRemote)
    {
        if (!((Boolean)state.getValue(POWERED)).booleanValue())
        {
            this.updateState(worldIn, pos);
        }
    }
}
项目:Mods    文件:TF2Message.java   
public CapabilityMessage(Entity entity,boolean sendAll) {
    WeaponsCapability cap = entity.getCapability(TF2weapons.WEAPONS_CAP, null);
    this.entityID = entity.getEntityId();
    this.healTarget = cap.getHealTarget();
    //this.critTime = cap.critTime;
    //this.heads = cap.collectedHeads;
    if(sendAll) {
        this.entries=cap.dataManager.getAll();
    }
    else {
        this.entries=cap.dataManager.getDirty();
    }
    // new Exception().printStackTrace();
}
项目:RunicArcana    文件:AirStrikeFX.java   
@Override
public void renderParticle(VertexBuffer vertexBuffer, Entity entity, float partialTick,
                           float edgeLRdirectionX, float edgeUDdirectionY, float edgeLRdirectionZ,
                           float edgeUDdirectionX, float edgeUDdirectionZ)
{
    double minU = this.particleTexture.getMinU();
    double maxU = this.particleTexture.getMaxU();
    double minV = this.particleTexture.getMinV();
    double maxV = this.particleTexture.getMaxV();

    double scale = 0.1F * this.particleScale;  // vanilla scaling factor
    final double scaleLR = scale;
    final double scaleUD = scale;
    double x = this.prevPosX + (this.posX - this.prevPosX) * partialTick - interpPosX;
    double y = this.prevPosY + (this.posY - this.prevPosY) * partialTick - interpPosY;
    double z = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTick - interpPosZ;

    int combinedBrightness = this.getBrightnessForRender(partialTick);
    int skyLightTimes16 = combinedBrightness >> 16 & 65535;
    int blockLightTimes16 = combinedBrightness & 65535;

    vertexBuffer.pos(x - edgeLRdirectionX * scaleLR - edgeUDdirectionX * scaleUD, y - edgeUDdirectionY * scaleUD, z - edgeLRdirectionZ * scaleLR - edgeUDdirectionZ * scaleUD).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(skyLightTimes16, blockLightTimes16).endVertex();
    vertexBuffer.pos(x - edgeLRdirectionX * scaleLR + edgeUDdirectionX * scaleUD, y + edgeUDdirectionY * scaleUD, z - edgeLRdirectionZ * scaleLR + edgeUDdirectionZ * scaleUD).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(skyLightTimes16, blockLightTimes16).endVertex();
    vertexBuffer.pos(x + edgeLRdirectionX * scaleLR + edgeUDdirectionX * scaleUD, y + edgeUDdirectionY * scaleUD, z + edgeLRdirectionZ * scaleLR + edgeUDdirectionZ * scaleUD).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(skyLightTimes16, blockLightTimes16).endVertex();
    vertexBuffer.pos(x + edgeLRdirectionX * scaleLR - edgeUDdirectionX * scaleUD, y - edgeUDdirectionY * scaleUD, z + edgeLRdirectionZ * scaleLR - edgeUDdirectionZ * scaleUD).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(skyLightTimes16, blockLightTimes16).endVertex();

}
项目:DecompiledMinecraft    文件:WorldServer.java   
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]);
        }
    }
}
项目:Backmemed    文件:Chunk.java   
/**
 * Called when this Chunk is unloaded by the ChunkProvider
 */
public void onChunkUnload()
{
    this.isChunkLoaded = false;

    for (TileEntity tileentity : this.chunkTileEntityMap.values())
    {
        this.worldObj.markTileEntityForRemoval(tileentity);
    }

    for (ClassInheritanceMultiMap<Entity> classinheritancemultimap : this.entityLists)
    {
        this.worldObj.unloadEntities(classinheritancemultimap);
    }
}
项目:CustomWorldGen    文件:FMLMessage.java   
@Override
void toBytes(ByteBuf buf)
{
    super.toBytes(buf);
    ByteBufUtils.writeUTF8String(buf, modId);
    buf.writeInt(modEntityTypeId);
    buf.writeLong(entity.getUniqueID().getMostSignificantBits());
    buf.writeLong(entity.getUniqueID().getLeastSignificantBits());
    // posX, posY, posZ
    buf.writeDouble(entity.posX);
    buf.writeDouble(entity.posY);
    buf.writeDouble(entity.posZ);
    // yaw, pitch
    buf.writeByte((byte)(entity.rotationYaw * 256.0F / 360.0F));
    buf.writeByte((byte) (entity.rotationPitch * 256.0F / 360.0F));
    // head yaw
    if (entity instanceof EntityLivingBase)
    {
        buf.writeByte((byte) (((EntityLivingBase)entity).rotationYawHead * 256.0F / 360.0F));
    }
    else
    {
        buf.writeByte(0);
    }
    ByteBuf tmpBuf = Unpooled.buffer();
    PacketBuffer pb = new PacketBuffer(tmpBuf);
    try
    {
        entity.getDataManager().writeEntries(pb);
    } catch (IOException e)
    {
        FMLLog.log(Level.FATAL,e,"Encountered fatal exception trying to send entity spawn data watchers");
        throw Throwables.propagate(e);
    }
    buf.writeBytes(tmpBuf);

    if (entity instanceof IThrowableEntity)
    {
        Entity owner = ((IThrowableEntity)entity).getThrower();
        buf.writeInt(owner == null ? entity.getEntityId() : owner.getEntityId());
        double maxVel = 3.9D;
        double mX = entity.motionX;
        double mY = entity.motionY;
        double mZ = entity.motionZ;
        if (mX < -maxVel) mX = -maxVel;
        if (mY < -maxVel) mY = -maxVel;
        if (mZ < -maxVel) mZ = -maxVel;
        if (mX >  maxVel) mX =  maxVel;
        if (mY >  maxVel) mY =  maxVel;
        if (mZ >  maxVel) mZ =  maxVel;
        buf.writeInt((int)(mX * 8000D));
        buf.writeInt((int)(mY * 8000D));
        buf.writeInt((int)(mZ * 8000D));
    }
    else
    {
        buf.writeInt(0);
    }
    if (entity instanceof IEntityAdditionalSpawnData)
    {
        tmpBuf = Unpooled.buffer();
        ((IEntityAdditionalSpawnData)entity).writeSpawnData(tmpBuf);
        buf.writeBytes(tmpBuf);
    }
}
项目:CustomWorldGen    文件:ParticleLava.java   
/**
 * Renders the particle
 */
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
    float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
    this.particleScale = this.lavaParticleScale * (1.0F - f * f);
    super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
项目:pnc-repressurized    文件:PneumaticCraftUtils.java   
private static boolean isEntityValidForName(String filter, Entity entity) throws IllegalArgumentException {
    if (filter.equals("")) {
        return true;
    } else if (filter.startsWith("@")) {//entity type selection
        filter = filter.substring(1); //cut off the '@'.
        Class typeClass = null;
        if (filter.equals("mob")) {
            typeClass = EntityMob.class;
        } else if (filter.equals("animal")) {
            typeClass = EntityAnimal.class;
        } else if (filter.equals("living")) {
            typeClass = EntityLivingBase.class;
        } else if (filter.equals("player")) {
            typeClass = EntityPlayer.class;
        } else if (filter.equals("item")) {
            typeClass = EntityItem.class;
        } else if (filter.equals("minecart")) {
            typeClass = EntityMinecart.class;
        } else if (filter.equals("drone")) {
            typeClass = EntityDrone.class;
        }
        if (typeClass != null) {
            return typeClass.isAssignableFrom(entity.getClass());
        } else {
            throw new IllegalArgumentException(filter + " is not a valid entity type.");
        }
    } else {
        try {
            String regex = filter.toLowerCase().replaceAll(".", "[$0]").replace("[*]", ".*");//Wildcard regex
            return entity.getName().toLowerCase().matches(regex);//TODO when player, check if entity is tamed by the player (see EntityAIAvoidEntity for example)
        } catch (PatternSyntaxException e) {
            return entity.getName().toLowerCase().equals(filter.toLowerCase());
        }
    }
}
项目:DecompiledMinecraft    文件:ModelSnowMan.java   
/**
 * Sets the models various rotation angles then renders the model.
 */
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
{
    this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
    this.body.render(scale);
    this.bottomBody.render(scale);
    this.head.render(scale);
    this.rightHand.render(scale);
    this.leftHand.render(scale);
}
项目:CustomWorldGen    文件:EntityThrowable.java   
@Nullable
public EntityLivingBase getThrower()
{
    if (this.thrower == null && this.throwerName != null && !this.throwerName.isEmpty())
    {
        this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);

        if (this.thrower == null && this.worldObj instanceof WorldServer)
        {
            try
            {
                Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName));

                if (entity instanceof EntityLivingBase)
                {
                    this.thrower = (EntityLivingBase)entity;
                }
            }
            catch (Throwable var2)
            {
                this.thrower = null;
            }
        }
    }

    return this.thrower;
}
项目:BaseClient    文件:ModelSilverfish.java   
/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
    for (int i = 0; i < this.silverfishBodyParts.length; ++i)
    {
        this.silverfishBodyParts[i].rotateAngleY = MathHelper.cos(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.05F * (float)(1 + Math.abs(i - 2));
        this.silverfishBodyParts[i].rotationPointX = MathHelper.sin(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.2F * (float)Math.abs(i - 2);
    }

    this.silverfishWings[0].rotateAngleY = this.silverfishBodyParts[2].rotateAngleY;
    this.silverfishWings[1].rotateAngleY = this.silverfishBodyParts[4].rotateAngleY;
    this.silverfishWings[1].rotationPointX = this.silverfishBodyParts[4].rotationPointX;
    this.silverfishWings[2].rotateAngleY = this.silverfishBodyParts[1].rotateAngleY;
    this.silverfishWings[2].rotationPointX = this.silverfishBodyParts[1].rotationPointX;
}
项目:CustomWorldGen    文件:EntityEvent.java   
public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ)
{
    super(entity);
    this.setNewChunkX(newChunkX);
    this.setNewChunkZ(newChunkZ);
    this.setOldChunkX(oldChunkX);
    this.setOldChunkZ(oldChunkZ);
}
项目:Backmemed    文件:CrystalLog.java   
public void onUpdate(EntityPlayerSP player) {
    if(isEnabled()) {
        for (Entity e : Wrapper.getWorld().loadedEntityList) {
            if (e instanceof EntityEnderCrystal) {
                if (player.getDistanceToEntity(e) > distance.getValue() && player.getPosition().getY() >= e.getPosition().getY()) {
                    Wrapper.getWorld().sendQuittingDisconnectingPacket();
                    Hacks.findMod(CrystalLog.class).toggle();
                }
            }
        }
    }
}
项目:Backmemed    文件:WorldClient.java   
/**
 * Runs a single tick for the world
 */
public void tick()
{
    super.tick();
    this.setTotalWorldTime(this.getTotalWorldTime() + 1L);

    if (this.getGameRules().getBoolean("doDaylightCycle"))
    {
        this.setWorldTime(this.getWorldTime() + 1L);
    }

    this.theProfiler.startSection("reEntryProcessing");

    for (int i = 0; i < 10 && !this.entitySpawnQueue.isEmpty(); ++i)
    {
        Entity entity = (Entity)this.entitySpawnQueue.iterator().next();
        this.entitySpawnQueue.remove(entity);

        if (!this.loadedEntityList.contains(entity))
        {
            this.spawnEntityInWorld(entity);
        }
    }

    this.theProfiler.endStartSection("chunkCache");
    this.clientChunkProvider.unloadQueuedChunks();
    this.theProfiler.endStartSection("blocks");
    this.updateBlocks();
    this.theProfiler.endSection();
}
项目:Backmemed    文件:ParticleFootStep.java   
/**
 * Renders the particle
 */
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
    float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
    f = f * f;
    float f1 = 2.0F - f * 2.0F;

    if (f1 > 1.0F)
    {
        f1 = 1.0F;
    }

    f1 = f1 * 0.2F;
    GlStateManager.disableLighting();
    float f2 = 0.125F;
    float f3 = (float)(this.posX - interpPosX);
    float f4 = (float)(this.posY - interpPosY);
    float f5 = (float)(this.posZ - interpPosZ);
    float f6 = this.worldObj.getLightBrightness(new BlockPos(this.posX, this.posY, this.posZ));
    this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
    Tessellator.getInstance().draw();
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
}
项目:BaseClient    文件:ItemMonsterPlacer.java   
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
    {
        return null;
    }
    else
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByID(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
}