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

项目:DecompiledMinecraft    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingItem();
    }
    else
    {
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingItem();
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    }

    return itemStackIn;
}
项目:DecompiledMinecraft    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingItem();
    }
    else
    {
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingItem();
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    }

    return itemStackIn;
}
项目:BaseClient    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingItem();
    }
    else
    {
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingItem();
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    }

    return itemStackIn;
}
项目:BaseClient    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingItem();
    }
    else
    {
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingItem();
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
    }

    return itemStackIn;
}
项目:CustomWorldGen    文件:ItemFishingRod.java   
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingArm(hand);
    }
    else
    {
        worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingArm(hand);
        playerIn.addStat(StatList.getObjectUseStats(this));
    }

    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
项目:Mob-Amputation    文件:EventHandlerClient.java   
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
    if(event.getEntity().world.isRemote)
    {
        Minecraft mc = Minecraft.getMinecraft();
        if(event.getEntity() instanceof EntityFishHook)
        {
            fishHooks.add((EntityFishHook)event.getEntity());
        }
        if(event.getEntity() instanceof EntityZombie && !(event.getEntity() instanceof EntityZombieVillager) || event.getEntity() instanceof EntitySkeleton || MobAmputation.config.playerGibs == 1 && event.getEntity() instanceof EntityPlayer && event.getEntity() != mc.player)
        {
            EntityLivingBase living = (EntityLivingBase)event.getEntity();
            if(!amputationMap.containsKey(living) && !living.isChild())
            {
                attachGibs(event.getEntity().world, living);
            }
        }
    }
}
项目:OldMods    文件:FishingRodItem.java   
@SideOnly( Side.CLIENT )
  public ItemStack onItemRightClick( ItemStack stack, World world, EntityPlayer player )
  {
ItemStack ret = super.onItemRightClick( stack, world, player );

if ( world.isRemote )
{
    Minecraft mc = FMLClientHandler.instance().getClient();

    EntityFishHook hook = player.fishEntity;
    if ( player == mc.thePlayer && hook != null )
    {
        stagnated = false;
        prevMotionY = 0;
        timeSinceCasted = 0;
    }
}

return ret;
  }
项目:Resilience-Client-Source    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.fishEntity != null)
    {
        int var4 = par3EntityPlayer.fishEntity.func_146034_e();
        par1ItemStack.damageItem(var4, par3EntityPlayer);
        par3EntityPlayer.swingItem();
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isClient)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:mod_autofish    文件:AutoFish.java   
public void onBobberSplashDetected(float x, float y, float z) {
        if (playerHookInWater(this.player)) {
            EntityFishHook hook = this.player.fishEntity;
//                double yDifference = Math.abs(hook.posY - y);
            // Ignore Y component when calculating distance from hook
            double xzDistanceFromHook = hook.getDistanceSq(x, hook.posY, z);
            if (xzDistanceFromHook <= CLOSE_BOBBER_SPLASH_THRESHOLD) {
//                    AutoFishLogger.info("[%d] Close bobber splash at %f /  %f", this.minecraft.world.getTotalWorldTime(), xzDistanceFromHook, yDifference);
                this.closeBobberSplashDetectedAt = this.minecraftClient.world.getTotalWorldTime();
//                    if (xzDistanceFromHook <= EXACT_BOBBER_SPLASH_THRESHOLD) {
//    //                    AutoFishLogger.info("[%d] Exact bobber splash at %f /  %f", this.minecraft.world.getTotalWorldTime(), xzDistanceFromHook, yDifference);
//                        this.exactBobberSplashDetectedAt = this.minecraft.world.getTotalWorldTime();
//                    } 
            }
        }
    }
项目:mod_autofish    文件:AutoFish.java   
/**
     * Callback from the WorldEventListener to tell us whenever a WATER_WAKE particle
     * is spawned in the world.
     * 
     * @param x
     * @param y
     * @param z
     */
    public void onWaterWakeDetected(double x, double y, double z) {
        if (this.minecraftClient != null && this.minecraftClient.player != null && playerHookInWater(this.minecraftClient.player)) {
            EntityFishHook hook = this.minecraftClient.player.fishEntity;
            double distanceFromHook = new BlockPos(x, y, z).distanceSq(hook.posX, hook.posY, hook.posZ);
            if (distanceFromHook <= CLOSE_WATER_WAKE_THRESHOLD) {
                if (this.closeWaterWakeDetectedAt <= 0) {
//                    AutoFishLogger.info("[%d] Close water wake at %f", this.minecraft.world.getTotalWorldTime(), distanceFromHook);
                    this.closeWaterWakeDetectedAt = this.minecraftClient.world.getTotalWorldTime();
                }
//                if (distanceFromHook <= EXACT_WATER_WAKE_THRESHOLD) {
//                    if (this.exactWaterWakeDetectedAt <=0) {
////                        AutoFishLogger.info("[%d] Exact water wake at %f", this.minecraft.world.getTotalWorldTime(), distanceFromHook);
//                        this.exactWaterWakeDetectedAt = this.minecraft.world.getTotalWorldTime();
//                    }
//                }
            }
        }
    }
项目:mod_autofish    文件:AutoFish.java   
private boolean isFishBiting_fromAll() {
        /** Assume a bit if the following conditions are true:
         * (1) There is at least a little Y motion of the fish hook
         * (2) Either (a) There has been a "close" bobber splash very recently; OR
         *            (b) A "close" water wake was detected long enough ago  
         */
        EntityFishHook fishEntity = this.player.fishEntity;
        if (fishEntity != null 
                // Checking for no X and Z motion prevents a false alarm when the hook is moving through the air
                && fishEntity.motionX == 0 
                && fishEntity.motionZ == 0 
                && fishEntity.motionY < MOTION_Y_MAYBE_THRESHOLD) {
//            long totalWorldTime = this.minecraft.world.getTotalWorldTime();
            if (recentCloseBobberSplash() || recentCloseWaterWake()) {
                Logger.debug("[%d] Detected bite by ALL", this.minecraftClient.world.getTotalWorldTime());
                return true;
            }
        }
        return false;
    }
项目:RTM    文件:ItemCatToyWIP.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.fishEntity != null)
    {
        int i = par3EntityPlayer.fishEntity.func_146034_e();
        par1ItemStack.damageItem(i, par3EntityPlayer);
        par3EntityPlayer.swingItem();
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:ExpandedRailsMod    文件:ItemFishingRod.java   
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingArm(hand);
    }
    else
    {
        worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingArm(hand);
        playerIn.addStat(StatList.getObjectUseStats(this));
    }

    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
项目:Cauldron    文件:ItemFishingRod.java   
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
    if (p_77659_3_.fishEntity != null)
    {
        int i = p_77659_3_.fishEntity.func_146034_e();
        p_77659_1_.damageItem(i, p_77659_3_);
        p_77659_3_.swingItem();
    }
    else
    {
        p_77659_2_.playSoundAtEntity(p_77659_3_, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!p_77659_2_.isRemote)
        {
            p_77659_2_.spawnEntityInWorld(new EntityFishHook(p_77659_2_, p_77659_3_));
        }

        p_77659_3_.swingItem();
    }

    return p_77659_1_;
}
项目:RuneCraftery    文件:ItemFishingRod.java   
public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
   if(p_77659_3_.field_71104_cf != null) {
      int var4 = p_77659_3_.field_71104_cf.func_70198_d();
      p_77659_1_.func_77972_a(var4, p_77659_3_);
      p_77659_3_.func_71038_i();
   } else {
      p_77659_2_.func_72956_a(p_77659_3_, "random.bow", 0.5F, 0.4F / (field_77697_d.nextFloat() * 0.4F + 0.8F));
      if(!p_77659_2_.field_72995_K) {
         p_77659_2_.func_72838_d(new EntityFishHook(p_77659_2_, p_77659_3_));
      }

      p_77659_3_.func_71038_i();
   }

   return p_77659_1_;
}
项目:RuneCraftery    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.fishEntity != null)
    {
        int i = par3EntityPlayer.fishEntity.catchFish();
        par1ItemStack.damageItem(i, par3EntityPlayer);
        par3EntityPlayer.swingItem();
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:BetterNutritionMod    文件:ItemFishingRod.java   
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.fishEntity != null)
    {
        int i = par3EntityPlayer.fishEntity.catchFish();
        par1ItemStack.damageItem(i, par3EntityPlayer);
        par3EntityPlayer.swingItem();
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:Thaumic-Tools    文件:ItemInfusedFishingPole.java   
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    ///LoggerHelper.log(Level.INFO, "Right Clicked");
    if (par3EntityPlayer.fishEntity != null)
    {
        int i = par3EntityPlayer.fishEntity.catchFish();
        par1ItemStack.damageItem(i, par3EntityPlayer);
        par3EntityPlayer.swingItem();
        //LoggerHelper.log(Level.INFO, "Entity!=null");
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
       // LoggerHelper.log(Level.INFO, "Entity=null");
        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:Thaumic-Tools    文件:ItemThaumiumFishingPole.java   
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    ///LoggerHelper.log(Level.INFO, "Right Clicked");
    if (par3EntityPlayer.fishEntity != null)
    {
        int i = par3EntityPlayer.fishEntity.catchFish();
        par1ItemStack.damageItem(i, par3EntityPlayer);
        par3EntityPlayer.swingItem();
        //LoggerHelper.log(Level.INFO, "Entity!=null");
    }
    else
    {
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
       // LoggerHelper.log(Level.INFO, "Entity=null");
        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer));
        }

        par3EntityPlayer.swingItem();
    }

    return par1ItemStack;
}
项目:Uranium    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Backmemed    文件:ItemFishingRod.java   
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (worldIn.fishEntity != null)
    {
        int i = worldIn.fishEntity.handleHookRetraction();
        itemstack.damageItem(i, worldIn);
        worldIn.swingArm(playerIn);
    }
    else
    {
        itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!itemStackIn.isRemote)
        {
            EntityFishHook entityfishhook = new EntityFishHook(itemStackIn, worldIn);
            int j = EnchantmentHelper.func_191528_c(itemstack);

            if (j > 0)
            {
                entityfishhook.func_191516_a(j);
            }

            int k = EnchantmentHelper.func_191529_b(itemstack);

            if (k > 0)
            {
                entityfishhook.func_191517_b(k);
            }

            itemStackIn.spawnEntityInWorld(entityfishhook);
        }

        worldIn.swingArm(playerIn);
        worldIn.addStat(StatList.getObjectUseStats(this));
    }

    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
项目:Gravestone-mod-Extended    文件:GSEventsHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void entityJoinWorldEvent(EntityJoinWorldEvent event) {
    Entity entity = event.getEntity();

    if (ExtendedConfig.overrideVanillaFishing && entity instanceof EntityFishHook && entity.getClass().equals(EntityFishHook.class)) {
        World world = event.getWorld();
        if (!world.isRemote) {
            EntityPlayer player = ((EntityFishHook) entity).getAngler();
            ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
            if (stack.getItem() != Items.FISHING_ROD) {
                stack = player.getHeldItem(EnumHand.OFF_HAND);
            }
            entity.setDead();

            EntityCustomFishHook hook = new EntityCustomFishHook(world, player);

            int speed = EnchantmentHelper.getFishingSpeedBonus(stack);
            if (speed > 0) {
                hook.setLureSpeed(speed);
            }
            int luck = EnchantmentHelper.getFishingLuckBonus(stack);
            if (luck > 0) {
                hook.setLuck(luck);
            }

            world.spawnEntity(hook);
        }

        event.setCanceled(true);
    }
}
项目:ThermosRebased    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Thermos    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:KCauldron    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:CauldronGit    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Cauldron-Old    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Cauldron-Reloaded    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:FFoKC    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:mod_autofish    文件:AutoFish.java   
/**
 * Determine whether a fish is biting the player's hook, using the server-side player entity.
 * This only works in Single Player, but is 100% accurate.
 * 
 * @param serverPlayerEntity
 * @return
 * @throws NumberFormatException
 * @throws NoSuchFieldException
 * @throws SecurityException
 * @throws IllegalArgumentException
 * @throws IllegalAccessException
 */
private boolean isFishBiting_fromServerEntity(EntityPlayer serverPlayerEntity) throws NumberFormatException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    /*
     * The fish hook entity on the server side knows whether a fish is catchable at any given time.  However,
     * that field is private and not exposed in any way.  So we must use reflection to access that field.
     */
    EntityFishHook serverFishEntity = serverPlayerEntity.fishEntity;
    int ticksCatchable = ReflectionUtils.getPrivateIntFieldFromObject(serverFishEntity, "ticksCatchable", "field_146045_ax");
    if (ticksCatchable > 0) {
        return true;
    }
    return false;
}
项目:mod_autofish    文件:AutoFish.java   
private boolean isFishBiting_fromMovement() {
    EntityFishHook fishEntity = this.player.fishEntity;
    if (fishEntity != null 
            // Checking for no X and Z motion prevents a false alarm when the hook is moving through the air
            && fishEntity.motionX == 0 
            && fishEntity.motionZ == 0 
            && fishEntity.motionY < MOTION_Y_THRESHOLD) {
        Logger.debug("[%d] Detected bite by MOVEMENT", this.minecraftClient.world.getTotalWorldTime());
        return true;
    }
    return false;
}
项目:mod_autofish    文件:AutoFish.java   
/**
 * For the current player, trigger a bite on the fish hook.
 */
@SuppressWarnings("unused")
private void triggerBite() {
    EntityPlayer serverPlayerEntity = getServerPlayerEntity();
    if (serverPlayerEntity != null) {
        /*
         * If we are single player and have access to the server player entity, try to hack the fish hook entity
         * to make fish bite sooner.
         */
        EntityFishHook serverFishEntity = serverPlayerEntity.fishEntity;
        int ticks = FAST_FISH_CATCHABLE_DELAY_TICKS + MathHelper.getInt(this.rand, 0, FAST_FISH_DELAY_VARIANCE);
        setTicksCatchableDelay(serverFishEntity, ticks);
    }
}
项目:Cauldron    文件:ItemFishingRod.java   
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
    if (p_77659_3_.fishEntity != null)
    {
        int i = p_77659_3_.fishEntity.func_146034_e();
        p_77659_1_.damageItem(i, p_77659_3_);
        p_77659_3_.swingItem();
    }
    else
    {
        // CraftBukkit start
        EntityFishHook hook = new EntityFishHook(p_77659_2_, p_77659_3_);
        PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) p_77659_3_.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
        p_77659_2_.getServer().getPluginManager().callEvent(playerFishEvent);

        if (playerFishEvent.isCancelled())
        {
            return p_77659_1_;
        }

        // CraftBukkit end
        p_77659_2_.playSoundAtEntity(p_77659_3_, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!p_77659_2_.isRemote)
        {
            p_77659_2_.spawnEntityInWorld(hook); // CraftBukkit - moved creation up
        }

        p_77659_3_.swingItem();
    }

    return p_77659_1_;
}
项目:Cauldron    文件:CraftFish.java   
public double getBiteChance() {
    EntityFishHook hook = getHandle();

    if (this.biteChance == -1) {
        if (hook.worldObj.canLightningStrikeAt(MathHelper.floor_double(hook.posX), net.minecraft.util.MathHelper.floor_double(hook.posY) + 1, net.minecraft.util.MathHelper.floor_double(hook.posZ))) {
            return 1/300.0;
        }
        return 1/500.0;
    }
    return this.biteChance;
}
项目:Thaumic-Tools    文件:RenderTimer.java   
public static void RenderEntityInfoInWorld(EntityFishHook entity, float partialTickTime)
 {
ItemStack itemstack = entity.angler.getCurrentEquippedItem();
   if (((mc.inGameHasFocus) || (mc.currentScreen == null) || (mc.currentScreen instanceof GuiChat) && (!mc.gameSettings.showDebugInfo)) && (itemstack.getItem() instanceof ItemInfusedFishingPole))
            {
     EntityFishHook fishhook = (EntityFishHook)entity;
     double distanceFromMe = mc.thePlayer.getDistanceToEntity(fishhook);
     if (distanceFromMe > 32) {
       return;
     }
     RenderCountdownOverlay(fishhook, partialTickTime);
   }
 }
项目:Thaumic-Tools    文件:RenderTimer.java   
protected static void RenderCountdownOverlay(EntityFishHook entityfishhook, float partialTickTime)
{
  float x = (float)entityfishhook.posX;
  float y = (float)entityfishhook.posY;
  float z = (float)entityfishhook.posZ;


  String countdown = Integer.toString((entityfishhook.hookedTimer/20)+1);

  if (countdown != null && entityfishhook.hookedTimer != 1000) {
    RenderFloatingText(countdown, x, y, z, 16777215, true, partialTickTime);}
  }
项目:Thaumic-Tools    文件:RenderTickHandler.java   
public static void RenderEntityInfo(float partialTickTime)
{
  if (mc.inGameHasFocus) {
    for (Object object : mc.theWorld.loadedEntityList) {
      if (object instanceof EntityFishHook) {
        RenderEntityInfoInWorld((EntityFishHook)object, partialTickTime);
        ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
        if (itemstack.getItem() instanceof IFishingPole)
          if (itemstack.getItem() == ThaumicTools.thaumiumFishingPoleItem) {

          }
      }
    }
  }
}
项目:Uranium    文件:CraftFish.java   
public CraftFish(CraftServer server, EntityFishHook entity) {
    super(server, entity);
}
项目:Uranium    文件:CraftFish.java   
@Override
public EntityFishHook getHandle() {
    return (EntityFishHook) entity;
}
项目:DecompiledMinecraft    文件:EntityGuardian.java   
/**
 * Causes this Entity to drop a random item.
 */
protected void addRandomDrop()
{
    ItemStack itemstack = ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, EntityFishHook.func_174855_j())).getItemStack(this.rand);
    this.entityDropItem(itemstack, 1.0F);
}