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

项目:BaseClient    文件:BlockFarmland.java   
/**
 * Block's chance to react to a living entity falling on it.
 */
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
    if (entityIn instanceof EntityLivingBase)
    {
        if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F)
        {
            if (!(entityIn instanceof EntityPlayer) && !worldIn.getGameRules().getBoolean("mobGriefing"))
            {
                return;
            }

            worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
        }

        super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
    }
}
项目:DecompiledMinecraft    文件:Village.java   
public EntityPlayer getNearestTargetPlayer(EntityLivingBase villageDefender)
{
    double d0 = Double.MAX_VALUE;
    EntityPlayer entityplayer = null;

    for (String s : this.playerReputation.keySet())
    {
        if (this.isPlayerReputationTooLow(s))
        {
            EntityPlayer entityplayer1 = this.worldObj.getPlayerEntityByName(s);

            if (entityplayer1 != null)
            {
                double d1 = entityplayer1.getDistanceSqToEntity(villageDefender);

                if (d1 <= d0)
                {
                    entityplayer = entityplayer1;
                    d0 = d1;
                }
            }
        }
    }

    return entityplayer;
}
项目:BaseClient    文件:EntityAIAttackOnCollide.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();

    if (entitylivingbase == null)
    {
        return false;
    }
    else if (!entitylivingbase.isEntityAlive())
    {
        return false;
    }
    else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass()))
    {
        return false;
    }
    else
    {
        this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
        return this.entityPathEntity != null;
    }
}
项目:Backmemed    文件:WorldServer.java   
protected BlockPos adjustPosToNearbyEntity(BlockPos pos)
{
    BlockPos blockpos = this.getPrecipitationHeight(pos);
    AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockpos, new BlockPos(blockpos.getX(), this.getHeight(), blockpos.getZ()))).expandXyz(3.0D);
    List<EntityLivingBase> list = this.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new Predicate<EntityLivingBase>()
    {
        public boolean apply(@Nullable EntityLivingBase p_apply_1_)
        {
            return p_apply_1_ != null && p_apply_1_.isEntityAlive() && WorldServer.this.canSeeSky(p_apply_1_.getPosition());
        }
    });

    if (!list.isEmpty())
    {
        return ((EntityLivingBase)list.get(this.rand.nextInt(list.size()))).getPosition();
    }
    else
    {
        if (blockpos.getY() == -1)
        {
            blockpos = blockpos.up(2);
        }

        return blockpos;
    }
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleCombatEvent(S42PacketCombatEvent packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.field_179775_c);
    EntityLivingBase entitylivingbase = entity instanceof EntityLivingBase ? (EntityLivingBase) entity : null;

    if (packetIn.eventType == S42PacketCombatEvent.Event.END_COMBAT) {
        long i = (long) (1000 * packetIn.field_179772_d / 20);
        MetadataCombat metadatacombat = new MetadataCombat(this.gameController.thePlayer, entitylivingbase);
        this.gameController.getTwitchStream().func_176026_a(metadatacombat, 0L - i, 0L);
    } else if (packetIn.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) {
        Entity entity1 = this.clientWorldController.getEntityByID(packetIn.field_179774_b);

        if (entity1 instanceof EntityPlayer) {
            MetadataPlayerDeath metadataplayerdeath = new MetadataPlayerDeath((EntityPlayer) entity1,
                    entitylivingbase);
            metadataplayerdeath.func_152807_a(packetIn.deathMessage);
            this.gameController.getTwitchStream().func_152911_a(metadataplayerdeath, 0L);
        }
    }
}
项目:Backmemed    文件:EntityAISit.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.theEntity.isTamed())
    {
        return false;
    }
    else if (this.theEntity.isInWater())
    {
        return false;
    }
    else if (!this.theEntity.onGround)
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = this.theEntity.getOwner();
        return entitylivingbase == null ? true : (this.theEntity.getDistanceSqToEntity(entitylivingbase) < 144.0D && entitylivingbase.getAITarget() != null ? false : this.isSitting);
    }
}
项目:DecompiledMinecraft    文件:EntityAITarget.java   
/**
 * Checks to see if this entity can find a short path to the given target.
 */
private boolean canEasilyReach(EntityLivingBase p_75295_1_)
{
    this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5);
    PathEntity pathentity = this.taskOwner.getNavigator().getPathToEntityLiving(p_75295_1_);

    if (pathentity == null)
    {
        return false;
    }
    else
    {
        PathPoint pathpoint = pathentity.getFinalPathPoint();

        if (pathpoint == null)
        {
            return false;
        }
        else
        {
            int i = pathpoint.xCoord - MathHelper.floor_double(p_75295_1_.posX);
            int j = pathpoint.zCoord - MathHelper.floor_double(p_75295_1_.posZ);
            return (double)(i * i + j * j) <= 2.25D;
        }
    }
}
项目:Melodium    文件:SongHunt.java   
@SubscribeEvent
public void handleBounty(LootingLevelEvent event) {
    EntityLivingBase target = event.getEntityLiving();
    EntityLivingBase attacker = target.getAttackingEntity();
    if (attacker instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) attacker;
        Collection<PotionEffect> potions = player.getActivePotionEffects();
        for (PotionEffect potion : potions) {
            if (potion.getPotion() instanceof PotionHunt) {
                PotionHunt huntPotion = (PotionHunt) potion.getPotion();
                if (huntPotion.appliesTo(target)) {
                    event.setLootingLevel(event.getLootingLevel() + 2);

                    return;
                }
            }
        }
    }
}
项目:BaseClient    文件:EntityGuardian.java   
public EntityGuardian(World worldIn)
{
    super(worldIn);
    this.experienceValue = 10;
    this.setSize(0.85F, 0.85F);
    this.tasks.addTask(4, new EntityGuardian.AIGuardianAttack(this));
    EntityAIMoveTowardsRestriction entityaimovetowardsrestriction;
    this.tasks.addTask(5, entityaimovetowardsrestriction = new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(7, this.wander = new EntityAIWander(this, 1.0D, 80));
    this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityGuardian.class, 12.0F, 0.01F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.wander.setMutexBits(3);
    entityaimovetowardsrestriction.setMutexBits(3);
    this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 10, true, false, new EntityGuardian.GuardianTargetSelector(this)));
    this.moveHelper = new EntityGuardian.GuardianMoveHelper(this);
    this.field_175484_c = this.field_175482_b = this.rand.nextFloat();
}
项目:BaseClient    文件:ItemDye.java   
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:BlockLever.java   
/**
 * Called by ItemBlocks just before a block is actually set in the world, to
 * allow for adjustments to the IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,
        int meta, EntityLivingBase placer) {
    IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false));

    if (func_181090_a(worldIn, pos, facing.getOpposite())) {
        return iblockstate.withProperty(FACING,
                BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing()));
    } else {
        for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
            EnumFacing enumfacing = (EnumFacing) enumfacing0;
            if (enumfacing != facing && func_181090_a(worldIn, pos, enumfacing.getOpposite())) {
                return iblockstate.withProperty(FACING,
                        BlockLever.EnumOrientation.forFacings(enumfacing, placer.getHorizontalFacing()));
            }
        }

        if (World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) {
            return iblockstate.withProperty(FACING,
                    BlockLever.EnumOrientation.forFacings(EnumFacing.UP, placer.getHorizontalFacing()));
        } else {
            return iblockstate;
        }
    }
}
项目:Backmemed    文件:EntityPolarBear.java   
public boolean shouldExecute()
{
    if (EntityPolarBear.this.isChild())
    {
        return false;
    }
    else
    {
        if (super.shouldExecute())
        {
            for (EntityPolarBear entitypolarbear : EntityPolarBear.this.world.getEntitiesWithinAABB(EntityPolarBear.class, EntityPolarBear.this.getEntityBoundingBox().expand(8.0D, 4.0D, 8.0D)))
            {
                if (entitypolarbear.isChild())
                {
                    return true;
                }
            }
        }

        EntityPolarBear.this.setAttackTarget((EntityLivingBase)null);
        return false;
    }
}
项目:CustomWorldGen    文件:LayerHeldItem.java   
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT;
    ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand();
    ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand();

    if (itemstack != null || itemstack1 != null)
    {
        GlStateManager.pushMatrix();

        if (this.livingEntityRenderer.getMainModel().isChild)
        {
            float f = 0.5F;
            GlStateManager.translate(0.0F, 0.625F, 0.0F);
            GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F);
            GlStateManager.scale(0.5F, 0.5F, 0.5F);
        }

        this.renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT);
        this.renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT);
        GlStateManager.popMatrix();
    }
}
项目:MakeClayValuableAgain    文件:ClayProgressionImprovements.java   
@SubscribeEvent
public void onSkeletonDeath(LivingDeathEvent event) {
    EntityLivingBase entity = event.getEntityLiving();
    Entity sourceOfDamage = event.getSource().getSourceOfDamage();
    if (entity instanceof EntitySkeleton && sourceOfDamage instanceof EntityPlayer &&
      entity.isServerWorld()) {
        spawnWitherSkeleton(entity.getEntityWorld(), entity.getPosition());
        destroyHeldTool((EntityPlayer) sourceOfDamage);
    }
}
项目:Backmemed    文件:EnchantmentFrostWalker.java   
public static void freezeNearby(EntityLivingBase living, World worldIn, BlockPos pos, int level)
{
    if (living.onGround)
    {
        float f = (float)Math.min(16, 2 + level);
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);

        for (BlockPos.MutableBlockPos blockpos$mutableblockpos1 : BlockPos.getAllInBoxMutable(pos.add((double)(-f), -1.0D, (double)(-f)), pos.add((double)f, -1.0D, (double)f)))
        {
            if (blockpos$mutableblockpos1.distanceSqToCenter(living.posX, living.posY, living.posZ) <= (double)(f * f))
            {
                blockpos$mutableblockpos.setPos(blockpos$mutableblockpos1.getX(), blockpos$mutableblockpos1.getY() + 1, blockpos$mutableblockpos1.getZ());
                IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos);

                if (iblockstate.getMaterial() == Material.AIR)
                {
                    IBlockState iblockstate1 = worldIn.getBlockState(blockpos$mutableblockpos1);

                    if (iblockstate1.getMaterial() == Material.WATER && ((Integer)iblockstate1.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.func_190527_a(Blocks.FROSTED_ICE, blockpos$mutableblockpos1, false, EnumFacing.DOWN, (Entity)null))
                    {
                        worldIn.setBlockState(blockpos$mutableblockpos1, Blocks.FROSTED_ICE.getDefaultState());
                        worldIn.scheduleUpdate(blockpos$mutableblockpos1.toImmutable(), Blocks.FROSTED_ICE, MathHelper.getInt(living.getRNG(), 60, 120));
                    }
                }
            }
        }
    }
}
项目:Backmemed    文件:EntityGuardian.java   
@Nullable
public EntityLivingBase getTargetedEntity()
{
    if (!this.hasTargetedEntity())
    {
        return null;
    }
    else if (this.world.isRemote)
    {
        if (this.targetedEntity != null)
        {
            return this.targetedEntity;
        }
        else
        {
            Entity entity = this.world.getEntityByID(((Integer)this.dataManager.get(TARGET_ENTITY)).intValue());

            if (entity instanceof EntityLivingBase)
            {
                this.targetedEntity = (EntityLivingBase)entity;
                return this.targetedEntity;
            }
            else
            {
                return null;
            }
        }
    }
    else
    {
        return this.getAttackTarget();
    }
}
项目:ToughExpansion    文件:ItemTempRegulator.java   
@Override
@Method(modid = MODID_BAUBLES)
public void onWornTick(ItemStack stack, EntityLivingBase player) {
    if (!player.getEntityWorld().isRemote) {
        doTick(player, stack);
    }
}
项目:DecompiledMinecraft    文件:RenderManager.java   
public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks)
{
    this.worldObj = worldIn;
    this.options = optionsIn;
    this.livingPlayer = livingPlayerIn;
    this.pointedEntity = pointedEntityIn;
    this.textRenderer = textRendererIn;

    if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping())
    {
        IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn));
        Block block = iblockstate.getBlock();

        if (block == Blocks.bed)
        {
            int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
            this.playerViewY = (float)(i * 90 + 180);
            this.playerViewX = 0.0F;
        }
    }
    else
    {
        this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks;
        this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks;
    }

    if (optionsIn.thirdPersonView == 2)
    {
        this.playerViewY += 180.0F;
    }

    this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks;
    this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks;
    this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks;
}
项目:CustomWorldGen    文件:ItemElytra.java   
public ItemElytra()
{
    this.maxStackSize = 1;
    this.setMaxDamage(432);
    this.setCreativeTab(CreativeTabs.TRANSPORTATION);
    this.addPropertyOverride(new ResourceLocation("broken"), new IItemPropertyGetter()
    {
        @SideOnly(Side.CLIENT)
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
        {
            return ItemElytra.isBroken(stack) ? 0.0F : 1.0F;
        }
    });
    BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, ItemArmor.DISPENSER_BEHAVIOR);
}
项目:DecompiledMinecraft    文件:RenderGuardian.java   
private Vec3 func_177110_a(EntityLivingBase entityLivingBaseIn, double p_177110_2_, float p_177110_4_)
{
    double d0 = entityLivingBaseIn.lastTickPosX + (entityLivingBaseIn.posX - entityLivingBaseIn.lastTickPosX) * (double)p_177110_4_;
    double d1 = p_177110_2_ + entityLivingBaseIn.lastTickPosY + (entityLivingBaseIn.posY - entityLivingBaseIn.lastTickPosY) * (double)p_177110_4_;
    double d2 = entityLivingBaseIn.lastTickPosZ + (entityLivingBaseIn.posZ - entityLivingBaseIn.lastTickPosZ) * (double)p_177110_4_;
    return new Vec3(d0, d1, d2);
}
项目:Mods    文件:TF2Util.java   
public static void attractMobs(EntityLivingBase living, World world) {
    if (!world.isRemote && TF2ConfigVars.shootAttract && world.getDifficulty().getDifficultyId()>1) {

        int range=world.getDifficulty()==EnumDifficulty.HARD?60:38;
        for (EntityCreature mob : world.getEntitiesWithinAABB(EntityCreature.class,
                living.getEntityBoundingBox().grow(range, range, range), new Predicate<EntityCreature>() {

                    @Override
                    public boolean apply(EntityCreature input) {
                        // TODO Auto-generated method stub
                        return input.getAttackTarget() == null && (input instanceof IMob) && input.isNonBoss();
                    }

                })) {
            mob.getLookHelper().setLookPositionWithEntity(mob, 60, 30);
            if (!TF2Util.isOnSameTeam(living, mob)) {
                if (mob.getEntitySenses().canSee(living) || mob.getDistanceSqToEntity(living)<150){
                    mob.setAttackTarget(living);
                    if(mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getModifier(FOLLOW_MODIFIER)==null)
                        mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
                    .applyModifier(new AttributeModifier(FOLLOW_MODIFIER, "Follow Check", 65-mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue(), 0));
                    //mob.getNavigator().tryMoveToEntityLiving(living, 1.1f);

                    mob.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).removeModifier(FOLLOW_MODIFIER);
                }

                // CoroUtilPath.tryMoveToEntityLivingLongDist((EntityCreature)mob,
                // living, 1.1D);
                ;
            }

        }
    }
}
项目:Loot-Slash-Conquer    文件:EventEntityJoinWorld.java   
public static void setAttributeModifiers(EntityLivingBase entity, int level)
{
    AttributeModifier attackDamage = new AttributeModifier(ATTACK_DAMAGE, "attackDamage", level * 0.1, 1);
    AttributeModifier maxHealth = new AttributeModifier(MAX_HEALTH, "maxHealth", level * 0.2, 1);

    if (!entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).hasModifier(attackDamage))
        entity.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).applyModifier(attackDamage);

    if (!entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).hasModifier(maxHealth))
    {
        entity.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).applyModifier(maxHealth);
        entity.setHealth(entity.getMaxHealth());
    }
}
项目:Industrial-Foregoing    文件:MobRenderInPrisonHandler.java   
@SubscribeEvent
public void onTooltip(RenderTooltipEvent.PostText event) {
    if (event.getStack() == null || event.getStack().isEmpty()) return;
    if (event.getStack().getItem() instanceof MobImprisonmentToolItem && ((MobImprisonmentToolItem) event.getStack().getItem()).containsEntity(event.getStack())) {
        try {
            Entity entity = EntityList.createEntityByID(event.getStack().getTagCompound().getInteger("id"), Minecraft.getMinecraft().world);
            entity.readFromNBT(event.getStack().getTagCompound());
            ItemStackUtils.renderEntity((int) (event.getX() + 15 + entity.width), (int) (event.getY() + 58 + entity.height), 15, 0, 0, (EntityLivingBase) entity);
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    }

}
项目:BaseClient    文件:Aura.java   
private void fakeAttack(final EntityLivingBase ent) {
    this.fakeSwingItem();
    final float sharpLevel = EnchantmentHelper.func_152377_a(this.mc.thePlayer.getHeldItem(), ent.getCreatureAttribute());
    final boolean vanillaCrit = this.mc.thePlayer.fallDistance > 0.0f && !this.mc.thePlayer.onGround && !this.mc.thePlayer.isOnLadder() && !this.mc.thePlayer.isInWater() && !this.mc.thePlayer.isPotionActive(Potion.blindness) && this.mc.thePlayer.ridingEntity == null;
    if (this.criticals || vanillaCrit) {
        this.mc.thePlayer.onCriticalHit(ent);
    }
    if (sharpLevel > 0.0f) {
        this.mc.thePlayer.onEnchantmentCritical(ent);
    }
    this.pseudoTimer.reset();
}
项目:Backmemed    文件:BlockMagma.java   
/**
 * Triggered whenever an entity collides with this block (enters into the block)
 */
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
{
    if (!entityIn.isImmuneToFire() && entityIn instanceof EntityLivingBase && !EnchantmentHelper.hasFrostWalkerEnchantment((EntityLivingBase)entityIn))
    {
        entityIn.attackEntityFrom(DamageSource.hotFloor, 1.0F);
    }

    super.onEntityWalk(worldIn, pos, entityIn);
}
项目:TechReborn3    文件:BlockRubberLog.java   
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
    if (!FMLForgePlugin.RUNTIME_DEOBF && placer instanceof EntityPlayer && ((EntityPlayer) placer).isCreative() && placer.isSneaking()) {
        return getDefaultState().withProperty(SAP_SIDE, getSideFromFacing(placer.getHorizontalFacing().getOpposite()));
    }
    return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
项目:EMC    文件:IEntity.java   
public boolean instanceOf(EntityType e) {
    // Generic types and players
    if (e.equals(EntityType.ENTITY_PLAYER_SP)) {
        return entity instanceof EntityPlayerSP;
    } else if (e.equals(EntityType.ENTITY_PLAYER)) {
        return entity instanceof EntityPlayer;
    } else if (e.equals(EntityType.ENTITY_LIVING_BASE)) {
        return entity instanceof EntityLivingBase;
    } else if (e.equals(EntityType.ENTITY_LIVING)) {
        return entity instanceof EntityLiving;
    }
    // Mobs
    if (e.equals(EntityType.ENTITY_WOLF)) {
        return entity instanceof EntityWolf;
    } else if (e.equals(EntityType.Entity_Ageable)) {
        return entity instanceof EntityAgeable;
    } else if (e.equals(EntityType.EntityAmbientCreature)) {
        return entity instanceof EntityAmbientCreature;
    } else if (e.equals(EntityType.EntityWaterMob)) {
        return entity instanceof EntityWaterMob;
    } else if (e.equals(EntityType.EntityMob)) {
        return entity instanceof EntityMob;
    } else if (e.equals(EntityType.EntitySlime)) {
        return entity instanceof EntitySlime;
    } else if (e.equals(EntityType.EntityFlying)) {
        return entity instanceof EntityFlying;
    } else if (e.equals(EntityType.EntityGolem)) {
        return entity instanceof EntityGolem;
    } else if (e.equals(EntityType.ENTITY_SPIDER)) {
        return entity instanceof EntitySpider;
    } else if (e.equals(EntityType.ENTITY_SPIDER)) {
        return entity instanceof EntitySpider;
    } else if (e.equals(EntityType.ENTITY_ZOMBIE_PIGMAN)) {
        return entity instanceof EntityZombie;
    } else if (e.equals(EntityType.ENTITY_ENDERMAN)) {
        return entity instanceof EntityEnderman;
    }
    return false;
}
项目:DecompiledMinecraft    文件:EntityMob.java   
public boolean attackEntityAsMob(Entity entityIn)
{
    float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
    int i = 0;

    if (entityIn instanceof EntityLivingBase)
    {
        f += EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }

    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

    if (flag)
    {
        if (i > 0)
        {
            entityIn.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }

        int j = EnchantmentHelper.getFireAspectModifier(this);

        if (j > 0)
        {
            entityIn.setFire(j * 4);
        }

        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
项目:Bewitchment    文件:ItemBoline.java   
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase target, @Nonnull EntityLivingBase attacker) {
    if (!target.world.isRemote) {
        if (attacker instanceof EntityPlayer)
            target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 5);
        stack.damageItem(1, attacker);
    }
    return true;
}
项目:BaseClient    文件:BlockTNT.java   
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!worldIn.isRemote && entityIn instanceof EntityArrow)
    {
        EntityArrow entityarrow = (EntityArrow)entityIn;

        if (entityarrow.isBurning())
        {
            this.explode(worldIn, pos, worldIn.getBlockState(pos).withProperty(EXPLODE, Boolean.valueOf(true)), entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null);
            worldIn.setBlockToAir(pos);
        }
    }
}
项目:CustomWorldGen    文件:BlockHopper.java   
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    EnumFacing enumfacing = facing.getOpposite();

    if (enumfacing == EnumFacing.UP)
    {
        enumfacing = EnumFacing.DOWN;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ENABLED, Boolean.valueOf(true));
}
项目:Thermionics    文件:LayerScarf.java   
@Override
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    //TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
    //TextureAtlasSprite stone = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("stone");
    //Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    //GlStateManager.color(1f, 0.0f, 0f);
    //legacyCube(-4,-1,-2.5f, 8, 2, 5f, sprite, true, true, true);

    //GlStateManager.pushMatrix();
    //GlStateManager.rotate(TAU/8, 1, 0, 0);
    //legacyCube(0,0,0, 16, 16, 16, sprite, true, true, true);

    //GlStateManager.popMatrix();
}
项目:CustomWorldGen    文件:EntityAIAttackMelee.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();

    if (entitylivingbase == null)
    {
        return false;
    }
    else if (!entitylivingbase.isEntityAlive())
    {
        return false;
    }
    else
    {
        if (canPenalize)
        {
            if (--this.delayCounter <= 0)
            {
                this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
                this.delayCounter = 4 + this.attacker.getRNG().nextInt(7);
                return this.entityPathEntity != null;
            }
            else
            {
                return true;
            }
        }
        this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
        return this.entityPathEntity != null;
    }
}
项目:WirelessRedstone    文件:EntityWirelessTracker.java   
@Override
public EntityLivingBase getAttachedEntity()
{
    if(attachedEntity instanceof EntityLivingBase)
        return (EntityLivingBase) attachedEntity;
    return null;
}
项目:ClientAPI    文件:EntityTravelEvent.java   
public EntityTravelEvent(EventState state, EntityLivingBase entity, float strafe, float vertical, float forward) {
    this.entity = entity;
    this.state = state;
    this.strafe = strafe;
    this.vertical = vertical;
    this.forward = forward;
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
/**
 * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
 * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
 * maxHealth and knockback resistance as well as reinforcement spawning chance.
 */
public void handleEntityProperties(S20PacketEntityProperties packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity != null)
    {
        if (!(entity instanceof EntityLivingBase))
        {
            throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
        }
        else
        {
            BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();

            for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
            {
                IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());

                if (iattributeinstance == null)
                {
                    iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
                }

                iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
                iattributeinstance.removeAllModifiers();

                for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
                {
                    iattributeinstance.applyModifier(attributemodifier);
                }
            }
        }
    }
}
项目:BaseClient    文件:EntityPigZombie.java   
protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn)
{
    super.setEntityAttackTarget(creatureIn, entityLivingBaseIn);

    if (creatureIn instanceof EntityPigZombie)
    {
        ((EntityPigZombie)creatureIn).becomeAngryAt(entityLivingBaseIn);
    }
}
项目:BaseClient    文件:EntityDragon.java   
/**
 * Attacks all entities inside this list, dealing 5 hearts of damage.
 */
private void attackEntitiesInList(List<Entity> p_70971_1_)
{
    for (int i = 0; i < p_70971_1_.size(); ++i)
    {
        Entity entity = (Entity)p_70971_1_.get(i);

        if (entity instanceof EntityLivingBase)
        {
            entity.attackEntityFrom(DamageSource.causeMobDamage(this), 10.0F);
            this.applyEnchantments(this, entity);
        }
    }
}
项目:DecompiledMinecraft    文件:EntityAIOwnerHurtTarget.java   
/**
 * Execute a one shot task or start executing a continuous task
 */
public void startExecuting()
{
    this.taskOwner.setAttackTarget(this.theTarget);
    EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner();

    if (entitylivingbase != null)
    {
        this.field_142050_e = entitylivingbase.getLastAttackerTime();
    }

    super.startExecuting();
}
项目:Randores2    文件:AbilitySeries.java   
public void onArmorHit(EntityLivingBase entity, final EntityLivingBase source) {
    if (!this.armorActive.isEmpty()) {
        AbilityContext context = new AbilityContext(source, entity, AbilityType.ARMOR_ACTIVE);
        RunNextAbility nextAbility = new RunNextAbility(this.armorActive, 0, entity, context, source::getPositionVector);
        nextAbility.run();
    }
}