Java 类net.minecraft.entity.projectile.EntityTippedArrow 实例源码

项目:Backmemed    文件:EntitySkeleton.java   
protected EntityArrow func_190726_a(float p_190726_1_)
{
    ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);

    if (itemstack.getItem() == Items.SPECTRAL_ARROW)
    {
        EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
        entityspectralarrow.func_190547_a(this, p_190726_1_);
        return entityspectralarrow;
    }
    else
    {
        EntityArrow entityarrow = super.func_190726_a(p_190726_1_);

        if (itemstack.getItem() == Items.TIPPED_ARROW && entityarrow instanceof EntityTippedArrow)
        {
            ((EntityTippedArrow)entityarrow).setPotionEffect(itemstack);
        }

        return entityarrow;
    }
}
项目:runesofwizardry-classics    文件:RuneEntityHellstorm.java   
@Override
public void update() {
    super.update();
    World world = entity.getWorld();
    if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){
        BlockPos pos = getPos();
        for(int i=0;i<AMOUNT;i++){
            double x = pos.getX()+Math.random() * RAD * 2 - RAD,
                   z = pos.getZ()+Math.random() * RAD * 2 - RAD;
            BlockPos spawn = new BlockPos(x,pos.getY()+94,z);
            while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down();
            //Original spawned arrows at a fixed height of 158
            EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z);
            arrow.motionX=0;
            arrow.motionZ=0;
            arrow.motionY=-2D;
            arrow.setFire(30);
            arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int...
            //arrow.setThrowableHeading(0, -1, 0, 2F, 0);
            world.spawnEntity(arrow);
        }
    }
}
项目:Overlord    文件:EntityConvertedSkeleton.java   
protected EntityArrow getArrow(float distanceFactor) {
    ItemStack arrowItem = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);

    if (arrowItem.getItem() == Items.SPECTRAL_ARROW) {
        EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
        entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
        return entityspectralarrow;
    } else {
        EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
        entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);

        if (arrowItem.getItem() == Items.TIPPED_ARROW)
            entityarrow.setPotionEffect(arrowItem);

        return entityarrow;
    }
}
项目:Overlord    文件:EntitySkeletonWarrior.java   
protected EntityArrow getArrow(float distanceFactor) {
    ItemStack arrowStack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);

    if (arrowStack.getItem() == Items.SPECTRAL_ARROW) {
        EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
        entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
        return entityspectralarrow;
    } else {
        EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
        entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);

        if (arrowStack.getItem() == Items.TIPPED_ARROW)
            entityarrow.setPotionEffect(arrowStack);

        return entityarrow;
    }
}
项目:Levels    文件:EventBarrage.java   
@SuppressWarnings("static-access")
@SubscribeEvent
public void onBowFire(ArrowLooseEvent event)
{
    EntityPlayer player = event.getEntityPlayer();
    ItemStack stack = event.getBow();
    NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);

    if (player != null && stack != null && nbt != null && !player.getEntityWorld().isRemote)
    {
        if (BowAttribute.BARRAGE.hasAttribute(nbt))
        {
            for (int i = 0; i < (int) BowAttribute.BARRAGE.getCalculatedValue(nbt, 3, 1.5); i++)
            {
                EntityArrow entityarrow = new EntityTippedArrow(player.getEntityWorld(), player);
                entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0, ((ItemBow) event.getBow().getItem()).getArrowVelocity(event.getCharge()) * 3, 20F);
                entityarrow.pickupStatus = PickupStatus.DISALLOWED;
                player.getEntityWorld().spawnEntity(entityarrow);
            }
        }
    }
}
项目:AbyssalCraft    文件:EntityAntiSkeleton.java   
/**
 * Attack the specified entity using a ranged attack.
 */
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
    EntityArrow entityarrow = new EntityTippedArrow(world, this);
    double d0 = par1EntityLivingBase.posX - posX;
    double d1 = par1EntityLivingBase.getEntityBoundingBox().minY + par1EntityLivingBase.height / 3.0F - entityarrow.posY;
    double d2 = par1EntityLivingBase.posZ - posZ;
    double d3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
    entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, 14 - world.getDifficulty().getDifficultyId() * 4);
    int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
    int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
    entityarrow.setDamage(par2 * 2.0F + rand.nextGaussian() * 0.25D + world.getDifficulty().getDifficultyId() * 0.11F);

    if (i > 0)
        entityarrow.setDamage(entityarrow.getDamage() + i * 0.5D + 0.5D);

    if (j > 0)
        entityarrow.setKnockbackStrength(j);

    if (EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0)
        entityarrow.setFire(100);

    playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
    world.spawnEntity(entityarrow);
}
项目:OpenBlocks    文件:SkeletonBehavior.java   
@Override
public int executeActivateBehavior(TileEntityTrophy tile, EntityPlayer player) {
    final BlockPos pos = tile.getPos();
    double pX = pos.getX() + 0.5;
    final int pZ = pos.getY() + 1;
    double pY = pos.getZ() + 0.5;
    final World world = tile.getWorld();

    EntityArrow entityarrow = new EntityTippedArrow(world, pX, pZ, pY);
    entityarrow.setDamage(0.1);
    entityarrow.shoot(world.rand.nextInt(10) - 5, 40, world.rand.nextInt(10) - 5, 1.0f, 6.0f);
    world.playSound((EntityPlayer)null, player.getPosition(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + 0.5F);
    world.spawnEntity(entityarrow);

    return 0;
}
项目:Backmemed    文件:EntityStray.java   
protected EntityArrow func_190726_a(float p_190726_1_)
{
    EntityArrow entityarrow = super.func_190726_a(p_190726_1_);

    if (entityarrow instanceof EntityTippedArrow)
    {
        ((EntityTippedArrow)entityarrow).addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
    }

    return entityarrow;
}
项目:ToroQuest    文件:EntityMonolithEye.java   
protected void attackWithArrow(EntityLivingBase target) {

        int charge = 2 + rand.nextInt(10);

        EntityArrow entityarrow = new EntityTippedArrow(this.world, this);
        double d0 = target.posX - this.posX;
        double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityarrow.posY;
        double d2 = target.posZ - this.posZ;
        double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
        entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F,
                (float) (14 - this.world.getDifficulty().getDifficultyId() * 4));
        int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
        int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
        entityarrow.setDamage((double) (charge * 2.0F) + this.rand.nextGaussian() * 0.25D
                + (double) ((float) this.world.getDifficulty().getDifficultyId() * 0.11F));

        if (i > 0) {
            entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D);
        }

        if (j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if (rand.nextBoolean()) {
            entityarrow.setFire(100);
        }

        this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
        this.world.spawnEntity(entityarrow);
    }
项目:ToroQuest    文件:EntityMage.java   
protected void attackWithArrow(EntityLivingBase target) {

        int charge = 2 + rand.nextInt(10);

        EntityArrow entityarrow = new EntityTippedArrow(this.world, this);
        double d0 = target.posX - this.posX;
        double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityarrow.posY;
        double d2 = target.posZ - this.posZ;
        double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
        entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F,
                (float) (14 - this.world.getDifficulty().getDifficultyId() * 4));
        int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
        int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
        entityarrow.setDamage((double) (charge * 2.0F) + this.rand.nextGaussian() * 0.25D
                + (double) ((float) this.world.getDifficulty().getDifficultyId() * 0.11F));

        if (i > 0) {
            entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D);
        }

        if (j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if (rand.nextBoolean()) {
            entityarrow.setFire(100);
        }

        this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
        this.world.spawnEntity(entityarrow);
    }
项目:blockbuster    文件:ShootArrowAction.java   
/**
 * Some code in this method is borrowed from ItemBow, I guess, I don't
 * remember
 */
@Override
public void apply(EntityActor actor)
{
    World world = actor.worldObj;
    Frame frame = actor.playback.record.frames.get(actor.playback.tick);

    EntityTippedArrow arrow = new EntityTippedArrow(world, actor);
    float f = ItemBow.getArrowVelocity(this.charge);

    arrow.setAim(actor, frame.pitch, frame.yaw, 0.0F, f * 3.0F, 1.0F);
    world.spawnEntityInWorld(arrow);
}
项目:Inhuman-Resources    文件:MobRanged.java   
public void attackEntityWithRangedAttack(EntityLivingBase target, float arrowSpeed)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
       double d0 = target.posX - this.posX;
       double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
       double d2 = target.posZ - this.posZ;
       double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2);
       entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, (float)(14 - this.world.getDifficulty().getDifficultyId() * 4));
       int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
       int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
       entitytippedarrow.setDamage((double)(arrowSpeed * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().getDifficultyId() * 0.11F));

       if (i > 0)
           entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);

       if (j > 0)
           entitytippedarrow.setKnockbackStrength(j);

       boolean flag = this.isBurning() && this.rand.nextBoolean();
       flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;

       if (flag)
           entitytippedarrow.setFire(100);

       ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);

       if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
           entitytippedarrow.setPotionEffect(itemstack);

       this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
       this.world.spawnEntity(entitytippedarrow);
}
项目:Cyclic    文件:EntityMinecartTurret.java   
public void shootThisDirection(EnumFacing enumfacing) {
  BlockPos position = this.getPosition().up().offset(enumfacing, 2);
  EntityTippedArrow entitytippedarrow = new EntityTippedArrow(world, position.getX(), position.getY(), position.getZ());
  entitytippedarrow.setPotionEffect(PotionUtils.addPotionToItemStack(new ItemStack(Items.TIPPED_ARROW), PotionType.getPotionTypeForName("slowness")));
  entitytippedarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
  entitytippedarrow.setThrowableHeading((double) enumfacing.getFrontOffsetX(), YAW, (double) enumfacing.getFrontOffsetZ(), VELOCITY, INACCRACY);
  world.spawnEntity(entitytippedarrow);
}
项目:mod_quiver    文件:ItemQuiverableArrow.java   
public EntityArrow getNewEntityArrow(World worldIn, EntityPlayer playerIn, int itemUseDuration) {
    if (this.getBowToMimick() == null) {
        FFQLogger.warning("ItemQuiverableArrow getnewEntityArrow: I have been called to get a new arrow entity, but I have no bow to mimic.  Subclass needs to override this method.");
        return new EntityTippedArrow(worldIn, playerIn);
    } else {
        return this.getBowToMimick().getNewEntityArrow(worldIn, playerIn, itemUseDuration);
    }
}
项目:Fake-Ores-2    文件:EntityOresBoss.java   
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
    EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
    EntityArrow entityarrow = new EntityTippedArrow(this.world, this);
    double d0 = par1EntityLivingBase.posX - this.posX;
    double d1 = par1EntityLivingBase.posY + (double)par1EntityLivingBase.getEyeHeight() - 1.100000023841858D - entitysnowball.posY;
    double d2 = par1EntityLivingBase.posZ - this.posZ;
    float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
    entitysnowball.setThrowableHeading(d0, d1 + (double)f1, d2, 1.6F, 12.0F);
    entityarrow.setThrowableHeading(d0, d1 + (double)f1, d2, 1.6F, 12.0F);
    this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.world.spawnEntity(entityarrow);
    this.world.spawnEntity(entitysnowball);
}
项目:MineCraft    文件:SharpSnowballs.java   
@SubscribeEvent
public void replaceSnowballWithArrow(EntityJoinWorldEvent event) {
    Entity snowball = event.getEntity();
    World world = snowball.worldObj;

    if (!(snowball instanceof EntitySnowball)) {
        return;
    }

    if (!world.isRemote) {
        EntityTippedArrow arrow = new EntityTippedArrow(world);
        arrow.setLocationAndAngles(snowball.posX, snowball.posY, snowball.posZ,
                0, 0);
        arrow.motionX = snowball.motionX;
        arrow.motionY = snowball.motionY;
        arrow.motionZ = snowball.motionZ;

        // gets arrow out of player's head
        // gets the angle of arrow right, in the direction of motion
        arrow.posX += arrow.motionX;
        arrow.posY += arrow.motionY;
        arrow.posZ += arrow.motionZ;

        world.spawnEntityInWorld(arrow);
        snowball.setDead();
    }
}
项目:Battlegear2    文件:Battlegear.java   
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    logger = event.getModLog();
    knightArmourMaterial = EnumHelper.addArmorMaterial("knights.armour", "battlegear2:knight", 25, new int[]{3, 5, 7, 3}, 15, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.5F);
    ResourceLocation sound = new ResourceLocation(MODID, "shield");
    shieldSound = GameRegistry.register(new SoundEvent(sound).setRegistryName(sound));
    BattlegearConfig.getConfig(new Configuration(event.getSuggestedConfigurationFile()));

    if((event.getSourceFile().getName().endsWith(".jar") || debug) && event.getSide().isClient()){
        try {
            Class.forName("mods.mud.ModUpdateDetector").getDeclaredMethod("registerMod", ModContainer.class, String.class, String.class).invoke(null,
                    FMLCommonHandler.instance().findContainerFor(this),
                    "https://raw.github.com/Mine-and-blade-admin/Battlegear2/master/battlegear_update.xml",
                    "https://raw.github.com/Mine-and-blade-admin/Battlegear2/master/changelog.md"
            );
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    proxy.registerHandlers();
    QuiverArrowRegistry.addArrowToRegistry(Items.ARROW, EntityTippedArrow.class);
    QuiverArrowRegistry.addArrowToRegistry(Items.TIPPED_ARROW, EntityTippedArrow.class);
    QuiverArrowRegistry.addArrowToRegistry(Items.SPECTRAL_ARROW, EntitySpectralArrow.class);
    //Fetch early messages
    IMCEvent imc = new IMCEvent();
    imc.applyModContainer(FMLCommonHandler.instance().findContainerFor(MODID));
    onMessage(imc);
}
项目:Battlegear2    文件:MobHookContainerClass.java   
/**
 * Listen to {@link EntityJoinWorldEvent} :
 * Adds random special {@link EntityArrow}s data to {@link AbstractSkeleton}s {@link net.minecraft.network.datasync.EntityDataManager} (for display)
 * Replace the vanilla fired {@link EntityTippedArrow} with the custom {@link AbstractMBArrow} (for actual action)
 * Note: Fails silently
 */
@SubscribeEvent(priority = EventPriority.LOW)
public void onEntityJoinWorld(EntityJoinWorldEvent event){
    if(event.getEntity() instanceof AbstractSkeleton){
        registerArrowType((AbstractSkeleton)event.getEntity());
    }else if(event.getEntity() instanceof EntityTippedArrow && ((EntityTippedArrow) event.getEntity()).getColor() == 0){
        EntityArrow arrow = ((EntityArrow)event.getEntity());
        if (arrow.shootingEntity instanceof AbstractSkeleton) {
            AbstractSkeleton skeleton = (AbstractSkeleton) arrow.shootingEntity;
            if(skeleton.getAttackTarget() != null) {
                ItemStack type = getArrowForMob(skeleton);
                if (type.getItem() instanceof ItemArrow) {
                    EntityArrow mbArrow = ((ItemArrow)type.getItem()).createArrow(skeleton.world, type, skeleton);
                    if (!(mbArrow instanceof EntityTippedArrow)) {
                        EntityLivingBase target = skeleton.getAttackTarget();
                        float pow = MathHelper.sqrt(skeleton.getDistanceSq(target.posX, target.getEntityBoundingBox().minY, target.posZ)) / 15F;
                        pow = MathHelper.clamp(pow, 0.1F, 1.0F);

                        mbArrow.setEnchantmentEffectsFromEntity(skeleton, pow);
                        if (skeleton instanceof EntityWitherSkeleton)
                            mbArrow.setFire(100);
                        double d0 = target.posX - skeleton.posX;
                        double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - mbArrow.posY;
                        double d2 = target.posZ - skeleton.posZ;
                        double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2);
                        mbArrow.setThrowableHeading(d0, d1 + d3 * 0.2D, d2, 1.6F, (float)(14 - skeleton.world.getDifficulty().getDifficultyId() * 4));
                        mbArrow.setDamage(arrow.getDamage());
                        if (skeleton.world.spawnEntity(mbArrow))
                            event.setCanceled(true);
                    }
                }
            }
        }
    }
}
项目:TurtleMod    文件:EntityWitherSkeletonTurtle.java   
protected EntityArrow getArrow(float p_190726_1_)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
    entitytippedarrow.setEnchantmentEffectsFromEntity(this, p_190726_1_);
    entitytippedarrow.setFire(100);
    return entitytippedarrow;
}
项目:Backmemed    文件:AbstractSkeleton.java   
protected EntityArrow func_190726_a(float p_190726_1_)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
    entitytippedarrow.func_190547_a(this, p_190726_1_);
    return entitytippedarrow;
}
项目:Backmemed    文件:ItemTippedArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:Backmemed    文件:ItemArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:Backmemed    文件:LayerArrow.java   
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    int i = entitylivingbaseIn.getArrowCountInEntity();

    if (i > 0)
    {
        Entity entity = new EntityTippedArrow(entitylivingbaseIn.world, entitylivingbaseIn.posX, entitylivingbaseIn.posY, entitylivingbaseIn.posZ);
        Random random = new Random((long)entitylivingbaseIn.getEntityId());
        RenderHelper.disableStandardItemLighting();

        for (int j = 0; j < i; ++j)
        {
            GlStateManager.pushMatrix();
            ModelRenderer modelrenderer = this.renderer.getMainModel().getRandomModelBox(random);
            ModelBox modelbox = (ModelBox)modelrenderer.cubeList.get(random.nextInt(modelrenderer.cubeList.size()));
            modelrenderer.postRender(0.0625F);
            float f = random.nextFloat();
            float f1 = random.nextFloat();
            float f2 = random.nextFloat();
            float f3 = (modelbox.posX1 + (modelbox.posX2 - modelbox.posX1) * f) / 16.0F;
            float f4 = (modelbox.posY1 + (modelbox.posY2 - modelbox.posY1) * f1) / 16.0F;
            float f5 = (modelbox.posZ1 + (modelbox.posZ2 - modelbox.posZ1) * f2) / 16.0F;
            GlStateManager.translate(f3, f4, f5);
            f = f * 2.0F - 1.0F;
            f1 = f1 * 2.0F - 1.0F;
            f2 = f2 * 2.0F - 1.0F;
            f = f * -1.0F;
            f1 = f1 * -1.0F;
            f2 = f2 * -1.0F;
            float f6 = MathHelper.sqrt(f * f + f2 * f2);
            entity.rotationYaw = (float)(Math.atan2((double)f, (double)f2) * (180D / Math.PI));
            entity.rotationPitch = (float)(Math.atan2((double)f1, (double)f6) * (180D / Math.PI));
            entity.prevRotationYaw = entity.rotationYaw;
            entity.prevRotationPitch = entity.rotationPitch;
            double d0 = 0.0D;
            double d1 = 0.0D;
            double d2 = 0.0D;
            this.renderer.getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
            GlStateManager.popMatrix();
        }

        RenderHelper.enableStandardItemLighting();
    }
}
项目:Backmemed    文件:RenderTippedArrow.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntityTippedArrow entity)
{
    return entity.getColor() > 0 ? RES_TIPPED_ARROW : RES_ARROW;
}
项目:CustomWorldGen    文件:EntitySkeleton.java   
/**
 * Attack the specified entity using a ranged attack.
 *  
 * @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0
 */
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this);
    double d0 = target.posX - this.posX;
    double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
    double d2 = target.posZ - this.posZ;
    double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
    entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
    int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
    DifficultyInstance difficultyinstance = this.worldObj.getDifficultyForLocation(new BlockPos(this));
    entitytippedarrow.setDamage((double)(distanceFactor * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entitytippedarrow.setKnockbackStrength(j);
    }

    boolean flag = this.isBurning() && difficultyinstance.isHard() && this.rand.nextBoolean() || this.getSkeletonType() == SkeletonType.WITHER;
    flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;

    if (flag)
    {
        entitytippedarrow.setFire(100);
    }

    ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);

    if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
    {
        entitytippedarrow.setPotionEffect(itemstack);
    }
    else if (this.getSkeletonType() == SkeletonType.STRAY)
    {
        entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
    }

    this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entitytippedarrow);
}
项目:CustomWorldGen    文件:ItemTippedArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:CustomWorldGen    文件:ItemArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:CustomWorldGen    文件:RenderManager.java   
public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn)
{
    this.renderEngine = renderEngineIn;
    this.entityRenderMap.put(EntityCaveSpider.class, new RenderCaveSpider(this));
    this.entityRenderMap.put(EntitySpider.class, new RenderSpider(this));
    this.entityRenderMap.put(EntityPig.class, new RenderPig(this, new ModelPig(), 0.7F));
    this.entityRenderMap.put(EntitySheep.class, new RenderSheep(this, new ModelSheep2(), 0.7F));
    this.entityRenderMap.put(EntityCow.class, new RenderCow(this, new ModelCow(), 0.7F));
    this.entityRenderMap.put(EntityMooshroom.class, new RenderMooshroom(this, new ModelCow(), 0.7F));
    this.entityRenderMap.put(EntityWolf.class, new RenderWolf(this, new ModelWolf(), 0.5F));
    this.entityRenderMap.put(EntityChicken.class, new RenderChicken(this, new ModelChicken(), 0.3F));
    this.entityRenderMap.put(EntityOcelot.class, new RenderOcelot(this, new ModelOcelot(), 0.4F));
    this.entityRenderMap.put(EntityRabbit.class, new RenderRabbit(this, new ModelRabbit(), 0.3F));
    this.entityRenderMap.put(EntitySilverfish.class, new RenderSilverfish(this));
    this.entityRenderMap.put(EntityEndermite.class, new RenderEndermite(this));
    this.entityRenderMap.put(EntityCreeper.class, new RenderCreeper(this));
    this.entityRenderMap.put(EntityEnderman.class, new RenderEnderman(this));
    this.entityRenderMap.put(EntitySnowman.class, new RenderSnowMan(this));
    this.entityRenderMap.put(EntitySkeleton.class, new RenderSkeleton(this));
    this.entityRenderMap.put(EntityWitch.class, new RenderWitch(this));
    this.entityRenderMap.put(EntityBlaze.class, new RenderBlaze(this));
    this.entityRenderMap.put(EntityPigZombie.class, new RenderPigZombie(this));
    this.entityRenderMap.put(EntityZombie.class, new RenderZombie(this));
    this.entityRenderMap.put(EntitySlime.class, new RenderSlime(this, new ModelSlime(16), 0.25F));
    this.entityRenderMap.put(EntityMagmaCube.class, new RenderMagmaCube(this));
    this.entityRenderMap.put(EntityGiantZombie.class, new RenderGiantZombie(this, new ModelZombie(), 0.5F, 6.0F));
    this.entityRenderMap.put(EntityGhast.class, new RenderGhast(this));
    this.entityRenderMap.put(EntitySquid.class, new RenderSquid(this, new ModelSquid(), 0.7F));
    this.entityRenderMap.put(EntityVillager.class, new RenderVillager(this));
    this.entityRenderMap.put(EntityIronGolem.class, new RenderIronGolem(this));
    this.entityRenderMap.put(EntityBat.class, new RenderBat(this));
    this.entityRenderMap.put(EntityGuardian.class, new RenderGuardian(this));
    this.entityRenderMap.put(EntityShulker.class, new RenderShulker(this, new ModelShulker()));
    this.entityRenderMap.put(EntityPolarBear.class, new RenderPolarBear(this, new ModelPolarBear(), 0.7F));
    this.entityRenderMap.put(EntityDragon.class, new RenderDragon(this));
    this.entityRenderMap.put(EntityEnderCrystal.class, new RenderEnderCrystal(this));
    this.entityRenderMap.put(EntityWither.class, new RenderWither(this));
    this.entityRenderMap.put(Entity.class, new RenderEntity(this));
    this.entityRenderMap.put(EntityPainting.class, new RenderPainting(this));
    this.entityRenderMap.put(EntityItemFrame.class, new RenderItemFrame(this, itemRendererIn));
    this.entityRenderMap.put(EntityLeashKnot.class, new RenderLeashKnot(this));
    this.entityRenderMap.put(EntityTippedArrow.class, new RenderTippedArrow(this));
    this.entityRenderMap.put(EntitySpectralArrow.class, new RenderSpectralArrow(this));
    this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball(this, Items.SNOWBALL, itemRendererIn));
    this.entityRenderMap.put(EntityEnderPearl.class, new RenderSnowball(this, Items.ENDER_PEARL, itemRendererIn));
    this.entityRenderMap.put(EntityEnderEye.class, new RenderSnowball(this, Items.ENDER_EYE, itemRendererIn));
    this.entityRenderMap.put(EntityEgg.class, new RenderSnowball(this, Items.EGG, itemRendererIn));
    this.entityRenderMap.put(EntityPotion.class, new RenderPotion(this, itemRendererIn));
    this.entityRenderMap.put(EntityExpBottle.class, new RenderSnowball(this, Items.EXPERIENCE_BOTTLE, itemRendererIn));
    this.entityRenderMap.put(EntityFireworkRocket.class, new RenderSnowball(this, Items.FIREWORKS, itemRendererIn));
    this.entityRenderMap.put(EntityLargeFireball.class, new RenderFireball(this, 2.0F));
    this.entityRenderMap.put(EntitySmallFireball.class, new RenderFireball(this, 0.5F));
    this.entityRenderMap.put(EntityDragonFireball.class, new RenderDragonFireball(this));
    this.entityRenderMap.put(EntityWitherSkull.class, new RenderWitherSkull(this));
    this.entityRenderMap.put(EntityShulkerBullet.class, new RenderShulkerBullet(this));
    this.entityRenderMap.put(EntityItem.class, new RenderEntityItem(this, itemRendererIn));
    this.entityRenderMap.put(EntityXPOrb.class, new RenderXPOrb(this));
    this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed(this));
    this.entityRenderMap.put(EntityFallingBlock.class, new RenderFallingBlock(this));
    this.entityRenderMap.put(EntityArmorStand.class, new RenderArmorStand(this));
    this.entityRenderMap.put(EntityMinecartTNT.class, new RenderTntMinecart(this));
    this.entityRenderMap.put(EntityMinecartMobSpawner.class, new RenderMinecartMobSpawner(this));
    this.entityRenderMap.put(EntityMinecart.class, new RenderMinecart(this));
    this.entityRenderMap.put(EntityBoat.class, new RenderBoat(this));
    this.entityRenderMap.put(EntityFishHook.class, new RenderFish(this));
    this.entityRenderMap.put(EntityAreaEffectCloud.class, new RenderAreaEffectCloud(this));
    this.entityRenderMap.put(EntityHorse.class, new RenderHorse(this, new ModelHorse(), 0.75F));
    this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt(this));
    this.playerRenderer = new RenderPlayer(this);
    this.skinMap.put("default", this.playerRenderer);
    this.skinMap.put("slim", new RenderPlayer(this, true));
    net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap);
}
项目:CustomWorldGen    文件:LayerArrow.java   
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    int i = entitylivingbaseIn.getArrowCountInEntity();

    if (i > 0)
    {
        Entity entity = new EntityTippedArrow(entitylivingbaseIn.worldObj, entitylivingbaseIn.posX, entitylivingbaseIn.posY, entitylivingbaseIn.posZ);
        Random random = new Random((long)entitylivingbaseIn.getEntityId());
        RenderHelper.disableStandardItemLighting();

        for (int j = 0; j < i; ++j)
        {
            GlStateManager.pushMatrix();
            ModelRenderer modelrenderer = this.renderer.getMainModel().getRandomModelBox(random);
            ModelBox modelbox = (ModelBox)modelrenderer.cubeList.get(random.nextInt(modelrenderer.cubeList.size()));
            modelrenderer.postRender(0.0625F);
            float f = random.nextFloat();
            float f1 = random.nextFloat();
            float f2 = random.nextFloat();
            float f3 = (modelbox.posX1 + (modelbox.posX2 - modelbox.posX1) * f) / 16.0F;
            float f4 = (modelbox.posY1 + (modelbox.posY2 - modelbox.posY1) * f1) / 16.0F;
            float f5 = (modelbox.posZ1 + (modelbox.posZ2 - modelbox.posZ1) * f2) / 16.0F;
            GlStateManager.translate(f3, f4, f5);
            f = f * 2.0F - 1.0F;
            f1 = f1 * 2.0F - 1.0F;
            f2 = f2 * 2.0F - 1.0F;
            f = f * -1.0F;
            f1 = f1 * -1.0F;
            f2 = f2 * -1.0F;
            float f6 = MathHelper.sqrt_float(f * f + f2 * f2);
            entity.rotationYaw = (float)(Math.atan2((double)f, (double)f2) * (180D / Math.PI));
            entity.rotationPitch = (float)(Math.atan2((double)f1, (double)f6) * (180D / Math.PI));
            entity.prevRotationYaw = entity.rotationYaw;
            entity.prevRotationPitch = entity.rotationPitch;
            double d0 = 0.0D;
            double d1 = 0.0D;
            double d2 = 0.0D;
            this.renderer.getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
            GlStateManager.popMatrix();
        }

        RenderHelper.enableStandardItemLighting();
    }
}
项目:CustomWorldGen    文件:RenderTippedArrow.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntityTippedArrow entity)
{
    return entity.getColor() > 0 ? RES_TIPPED_ARROW : RES_ARROW;
}
项目:CustomWorldGen    文件:DataFixesManager.java   
public static DataFixer createFixer()
{
    DataFixer datafixer = new DataFixer(512);
    WorldInfo.registerFixes(datafixer);
    EntityPlayer.registerFixesPlayer(datafixer);
    AnvilChunkLoader.registerFixes(datafixer);
    ItemStack.registerFixes(datafixer);
    EntityArmorStand.registerFixesArmorStand(datafixer);
    EntityArrow.registerFixesArrow(datafixer);
    EntityBat.registerFixesBat(datafixer);
    EntityBlaze.registerFixesBlaze(datafixer);
    EntityCaveSpider.registerFixesCaveSpider(datafixer);
    EntityChicken.registerFixesChicken(datafixer);
    EntityCow.registerFixesCow(datafixer);
    EntityCreeper.registerFixesCreeper(datafixer);
    EntityDragonFireball.registerFixesDragonFireball(datafixer);
    EntityDragon.registerFixesDragon(datafixer);
    EntityEnderman.registerFixesEnderman(datafixer);
    EntityEndermite.registerFixesEndermite(datafixer);
    EntityFallingBlock.registerFixesFallingBlock(datafixer);
    EntityLargeFireball.registerFixesLargeFireball(datafixer);
    EntityFireworkRocket.registerFixesFireworkRocket(datafixer);
    EntityGhast.registerFixesGhast(datafixer);
    EntityGiantZombie.registerFixesGiantZombie(datafixer);
    EntityGuardian.registerFixesGuardian(datafixer);
    EntityHorse.registerFixesHorse(datafixer);
    EntityItem.registerFixesItem(datafixer);
    EntityItemFrame.registerFixesItemFrame(datafixer);
    EntityMagmaCube.registerFixesMagmaCube(datafixer);
    EntityMinecartChest.registerFixesMinecartChest(datafixer);
    EntityMinecartCommandBlock.registerFixesMinecartCommand(datafixer);
    EntityMinecartFurnace.registerFixesMinecartFurnace(datafixer);
    EntityMinecartHopper.registerFixesMinecartHopper(datafixer);
    EntityMinecartEmpty.registerFixesMinecartEmpty(datafixer);
    EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(datafixer);
    EntityMinecartTNT.registerFixesMinecartTNT(datafixer);
    EntityLiving.registerFixesMob(datafixer);
    EntityMob.registerFixesMonster(datafixer);
    EntityMooshroom.registerFixesMooshroom(datafixer);
    EntityOcelot.registerFixesOcelot(datafixer);
    EntityPig.registerFixesPig(datafixer);
    EntityPigZombie.registerFixesPigZombie(datafixer);
    EntityRabbit.registerFixesRabbit(datafixer);
    EntitySheep.registerFixesSheep(datafixer);
    EntityShulker.registerFixesShulker(datafixer);
    EntitySilverfish.registerFixesSilverfish(datafixer);
    EntitySkeleton.registerFixesSkeleton(datafixer);
    EntitySlime.registerFixesSlime(datafixer);
    EntitySmallFireball.registerFixesSmallFireball(datafixer);
    EntitySnowman.registerFixesSnowman(datafixer);
    EntitySnowball.registerFixesSnowball(datafixer);
    EntitySpectralArrow.registerFixesSpectralArrow(datafixer);
    EntitySpider.registerFixesSpider(datafixer);
    EntitySquid.registerFixesSquid(datafixer);
    EntityEgg.registerFixesEgg(datafixer);
    EntityEnderPearl.registerFixesEnderPearl(datafixer);
    EntityExpBottle.registerFixesExpBottle(datafixer);
    EntityPotion.registerFixesPotion(datafixer);
    EntityTippedArrow.registerFixesTippedArrow(datafixer);
    EntityVillager.registerFixesVillager(datafixer);
    EntityIronGolem.registerFixesIronGolem(datafixer);
    EntityWitch.registerFixesWitch(datafixer);
    EntityWither.registerFixesWither(datafixer);
    EntityWitherSkull.registerFixesWitherSkull(datafixer);
    EntityWolf.registerFixesWolf(datafixer);
    EntityZombie.registerFixesZombie(datafixer);
    TileEntityPiston.registerFixesPiston(datafixer);
    TileEntityFlowerPot.registerFixesFlowerPot(datafixer);
    TileEntityFurnace.registerFixesFurnace(datafixer);
    TileEntityChest.registerFixesChest(datafixer);
    TileEntityDispenser.registerFixes(datafixer);
    TileEntityDropper.registerFixesDropper(datafixer);
    TileEntityBrewingStand.registerFixesBrewingStand(datafixer);
    TileEntityHopper.registerFixesHopper(datafixer);
    BlockJukebox.registerFixesJukebox(datafixer);
    TileEntityMobSpawner.registerFixesMobSpawner(datafixer);
    registerFixes(datafixer);
    return datafixer;
}
项目:Possessed    文件:SkeletonHandler.java   
@SubscribeEvent
public void onArrowLoose(ArrowLooseEvent event) {
    EntityPlayer player = event.getEntityPlayer();
    if (this.isActive(player)) {
        if (!event.hasAmmo()) {
            ItemStack stack = event.getBow();
            World world = player.getEntityWorld();
            EntitySkeleton skeleton = (EntitySkeleton) PossessHandler.get(player).getPossessing();
            float velocity = ItemBow.getArrowVelocity(event.getCharge());
            if (velocity >= 0.1) {
                if (!world.isRemote) {
                    EntityTippedArrow arrow = new EntityTippedArrow(world, player);
                    if (skeleton.getSkeletonType() != SkeletonType.STRAY) {
                        arrow.setPotionEffect(new ItemStack(Items.ARROW));
                    } else {
                        arrow.setPotionEffect(new ItemStack(Items.TIPPED_ARROW));
                        arrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
                    }
                    arrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, velocity * 3.0F, 1.0F);
                    arrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
                    if (velocity == 1.0F) {
                        arrow.setIsCritical(true);
                    }
                    int power = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, stack);
                    if (power > 0) {
                        arrow.setDamage(arrow.getDamage() + (double) power * 0.5 + 0.5);
                    }
                    int punch = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
                    if (punch > 0) {
                        arrow.setKnockbackStrength(punch);
                    }
                    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
                        arrow.setFire(100);
                    }
                    stack.damageItem(1, player);
                    world.spawnEntityInWorld(arrow);
                }
                world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + velocity * 0.5F);
                player.addStat(StatList.getObjectUseStats(stack.getItem()));
            }
        }
    }
}
项目:ExpandedRailsMod    文件:EntitySkeleton.java   
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_2_)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this);
    double d0 = target.posX - this.posX;
    double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
    double d2 = target.posZ - this.posZ;
    double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
    entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
    int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
    DifficultyInstance difficultyinstance = this.worldObj.getDifficultyForLocation(new BlockPos(this));
    entitytippedarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entitytippedarrow.setKnockbackStrength(j);
    }

    boolean flag = this.isBurning() && difficultyinstance.func_190083_c() && this.rand.nextBoolean() || this.func_189771_df() == SkeletonType.WITHER;
    flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;

    if (flag)
    {
        entitytippedarrow.setFire(100);
    }

    ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);

    if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
    {
        entitytippedarrow.setPotionEffect(itemstack);
    }
    else if (this.func_189771_df() == SkeletonType.STRAY)
    {
        entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
    }

    this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entitytippedarrow);
}
项目:ExpandedRailsMod    文件:ItemTippedArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:ExpandedRailsMod    文件:ItemArrow.java   
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
项目:ExpandedRailsMod    文件:RenderManager.java   
public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn)
{
    this.renderEngine = renderEngineIn;
    this.entityRenderMap.put(EntityCaveSpider.class, new RenderCaveSpider(this));
    this.entityRenderMap.put(EntitySpider.class, new RenderSpider(this));
    this.entityRenderMap.put(EntityPig.class, new RenderPig(this, new ModelPig(), 0.7F));
    this.entityRenderMap.put(EntitySheep.class, new RenderSheep(this, new ModelSheep2(), 0.7F));
    this.entityRenderMap.put(EntityCow.class, new RenderCow(this, new ModelCow(), 0.7F));
    this.entityRenderMap.put(EntityMooshroom.class, new RenderMooshroom(this, new ModelCow(), 0.7F));
    this.entityRenderMap.put(EntityWolf.class, new RenderWolf(this, new ModelWolf(), 0.5F));
    this.entityRenderMap.put(EntityChicken.class, new RenderChicken(this, new ModelChicken(), 0.3F));
    this.entityRenderMap.put(EntityOcelot.class, new RenderOcelot(this, new ModelOcelot(), 0.4F));
    this.entityRenderMap.put(EntityRabbit.class, new RenderRabbit(this, new ModelRabbit(), 0.3F));
    this.entityRenderMap.put(EntitySilverfish.class, new RenderSilverfish(this));
    this.entityRenderMap.put(EntityEndermite.class, new RenderEndermite(this));
    this.entityRenderMap.put(EntityCreeper.class, new RenderCreeper(this));
    this.entityRenderMap.put(EntityEnderman.class, new RenderEnderman(this));
    this.entityRenderMap.put(EntitySnowman.class, new RenderSnowMan(this));
    this.entityRenderMap.put(EntitySkeleton.class, new RenderSkeleton(this));
    this.entityRenderMap.put(EntityWitch.class, new RenderWitch(this));
    this.entityRenderMap.put(EntityBlaze.class, new RenderBlaze(this));
    this.entityRenderMap.put(EntityPigZombie.class, new RenderPigZombie(this));
    this.entityRenderMap.put(EntityZombie.class, new RenderZombie(this));
    this.entityRenderMap.put(EntitySlime.class, new RenderSlime(this, new ModelSlime(16), 0.25F));
    this.entityRenderMap.put(EntityMagmaCube.class, new RenderMagmaCube(this));
    this.entityRenderMap.put(EntityGiantZombie.class, new RenderGiantZombie(this, new ModelZombie(), 0.5F, 6.0F));
    this.entityRenderMap.put(EntityGhast.class, new RenderGhast(this));
    this.entityRenderMap.put(EntitySquid.class, new RenderSquid(this, new ModelSquid(), 0.7F));
    this.entityRenderMap.put(EntityVillager.class, new RenderVillager(this));
    this.entityRenderMap.put(EntityIronGolem.class, new RenderIronGolem(this));
    this.entityRenderMap.put(EntityBat.class, new RenderBat(this));
    this.entityRenderMap.put(EntityGuardian.class, new RenderGuardian(this));
    this.entityRenderMap.put(EntityShulker.class, new RenderShulker(this, new ModelShulker()));
    this.entityRenderMap.put(EntityPolarBear.class, new RenderPolarBear(this, new ModelPolarBear(), 0.7F));
    this.entityRenderMap.put(EntityDragon.class, new RenderDragon(this));
    this.entityRenderMap.put(EntityEnderCrystal.class, new RenderEnderCrystal(this));
    this.entityRenderMap.put(EntityWither.class, new RenderWither(this));
    this.entityRenderMap.put(Entity.class, new RenderEntity(this));
    this.entityRenderMap.put(EntityPainting.class, new RenderPainting(this));
    this.entityRenderMap.put(EntityItemFrame.class, new RenderItemFrame(this, itemRendererIn));
    this.entityRenderMap.put(EntityLeashKnot.class, new RenderLeashKnot(this));
    this.entityRenderMap.put(EntityTippedArrow.class, new RenderTippedArrow(this));
    this.entityRenderMap.put(EntitySpectralArrow.class, new RenderSpectralArrow(this));
    this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball(this, Items.SNOWBALL, itemRendererIn));
    this.entityRenderMap.put(EntityEnderPearl.class, new RenderSnowball(this, Items.ENDER_PEARL, itemRendererIn));
    this.entityRenderMap.put(EntityEnderEye.class, new RenderSnowball(this, Items.ENDER_EYE, itemRendererIn));
    this.entityRenderMap.put(EntityEgg.class, new RenderSnowball(this, Items.EGG, itemRendererIn));
    this.entityRenderMap.put(EntityPotion.class, new RenderPotion(this, itemRendererIn));
    this.entityRenderMap.put(EntityExpBottle.class, new RenderSnowball(this, Items.EXPERIENCE_BOTTLE, itemRendererIn));
    this.entityRenderMap.put(EntityFireworkRocket.class, new RenderSnowball(this, Items.FIREWORKS, itemRendererIn));
    this.entityRenderMap.put(EntityLargeFireball.class, new RenderFireball(this, 2.0F));
    this.entityRenderMap.put(EntitySmallFireball.class, new RenderFireball(this, 0.5F));
    this.entityRenderMap.put(EntityDragonFireball.class, new RenderDragonFireball(this));
    this.entityRenderMap.put(EntityWitherSkull.class, new RenderWitherSkull(this));
    this.entityRenderMap.put(EntityShulkerBullet.class, new RenderShulkerBullet(this));
    this.entityRenderMap.put(EntityItem.class, new RenderEntityItem(this, itemRendererIn));
    this.entityRenderMap.put(EntityXPOrb.class, new RenderXPOrb(this));
    this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed(this));
    this.entityRenderMap.put(EntityFallingBlock.class, new RenderFallingBlock(this));
    this.entityRenderMap.put(EntityArmorStand.class, new RenderArmorStand(this));
    this.entityRenderMap.put(EntityMinecartTNT.class, new RenderTntMinecart(this));
    this.entityRenderMap.put(EntityMinecartMobSpawner.class, new RenderMinecartMobSpawner(this));
    this.entityRenderMap.put(EntityMinecart.class, new RenderMinecart(this));
    this.entityRenderMap.put(EntityBoat.class, new RenderBoat(this));
    this.entityRenderMap.put(EntityFishHook.class, new RenderFish(this));
    this.entityRenderMap.put(EntityAreaEffectCloud.class, new RenderAreaEffectCloud(this));
    this.entityRenderMap.put(EntityHorse.class, new RenderHorse(this, new ModelHorse(), 0.75F));
    this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt(this));
    this.playerRenderer = new RenderPlayer(this);
    this.skinMap.put("default", this.playerRenderer);
    this.skinMap.put("slim", new RenderPlayer(this, true));
    net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.entityRenderMap);
}
项目:ExpandedRailsMod    文件:LayerArrow.java   
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    int i = entitylivingbaseIn.getArrowCountInEntity();

    if (i > 0)
    {
        Entity entity = new EntityTippedArrow(entitylivingbaseIn.worldObj, entitylivingbaseIn.posX, entitylivingbaseIn.posY, entitylivingbaseIn.posZ);
        Random random = new Random((long)entitylivingbaseIn.getEntityId());
        RenderHelper.disableStandardItemLighting();

        for (int j = 0; j < i; ++j)
        {
            GlStateManager.pushMatrix();
            ModelRenderer modelrenderer = this.renderer.getMainModel().getRandomModelBox(random);
            ModelBox modelbox = (ModelBox)modelrenderer.cubeList.get(random.nextInt(modelrenderer.cubeList.size()));
            modelrenderer.postRender(0.0625F);
            float f = random.nextFloat();
            float f1 = random.nextFloat();
            float f2 = random.nextFloat();
            float f3 = (modelbox.posX1 + (modelbox.posX2 - modelbox.posX1) * f) / 16.0F;
            float f4 = (modelbox.posY1 + (modelbox.posY2 - modelbox.posY1) * f1) / 16.0F;
            float f5 = (modelbox.posZ1 + (modelbox.posZ2 - modelbox.posZ1) * f2) / 16.0F;
            GlStateManager.translate(f3, f4, f5);
            f = f * 2.0F - 1.0F;
            f1 = f1 * 2.0F - 1.0F;
            f2 = f2 * 2.0F - 1.0F;
            f = f * -1.0F;
            f1 = f1 * -1.0F;
            f2 = f2 * -1.0F;
            float f6 = MathHelper.sqrt_float(f * f + f2 * f2);
            entity.rotationYaw = (float)(Math.atan2((double)f, (double)f2) * (180D / Math.PI));
            entity.rotationPitch = (float)(Math.atan2((double)f1, (double)f6) * (180D / Math.PI));
            entity.prevRotationYaw = entity.rotationYaw;
            entity.prevRotationPitch = entity.rotationPitch;
            double d0 = 0.0D;
            double d1 = 0.0D;
            double d2 = 0.0D;
            this.renderer.getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, false);
            GlStateManager.popMatrix();
        }

        RenderHelper.enableStandardItemLighting();
    }
}
项目:ExpandedRailsMod    文件:RenderTippedArrow.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntityTippedArrow entity)
{
    return entity.getColor() > 0 ? RES_TIPPED_ARROW : RES_ARROW;
}
项目:TurtleMod    文件:EntitySkeletonTurtle.java   
protected EntityArrow getArrow(float p_190726_1_)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
    entitytippedarrow.setEnchantmentEffectsFromEntity(this, p_190726_1_);
    return entitytippedarrow;
}
项目:mod_quiver    文件:ItemCustomBow.java   
/**
 * Helper function for onPlayerStoppedUsing() that allows subclasses to easily overwrite custom
 * EntityArrow subclass to be spawned by bow release
 * 
 * Some subclasses may want the stack meta value, while others may not
 * 
 * @param worldIn
 * @param playerIn
 * @param damage
 * @return
 */
protected EntityArrow getNewEntityArrow(World worldIn, EntityPlayer playerIn, int itemUseDuration) {
    return new EntityTippedArrow(worldIn, playerIn);
}