Skip to content

Instantly share code, notes, and snippets.

@cornedor
Last active January 2, 2016 03:49
Show Gist options
  • Save cornedor/8246672 to your computer and use it in GitHub Desktop.
Save cornedor/8246672 to your computer and use it in GitHub Desktop.

In Minecraft 1.6.4 the following check is made:

if (this.worldObj.canLightningStrikeAt(this.posX, this.posY + 1, this.posZ))

This will check if rain can reach the block AND if it is raining. If that is true the possibility to catch a fish goes up from 1 in 500 to 1 in 300

From EntityFishHook.java:

short var28 = 500;

if (this.worldObj.canLightningStrikeAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) + 1, MathHelper.floor_double(this.posZ)))
{
    var28 = 300;
}

if (this.rand.nextInt(var28) == 0)
{
    // catch fish
}

Minecraft 1.7.2 uses a similar check, however this is one is a little bit more complicated:

if (this.rand.nextFloat() < 0.25F && this.worldObj.canLightningStrikeAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) + 1, MathHelper.floor_double(this.posZ)))
{
    var36 = 2;
}

if (this.rand.nextFloat() < 0.5F && !this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) + 1, MathHelper.floor_double(this.posZ)))
{
    --var36;
}

var36 is substracted from another variable, if that second variable is < 0 a fish is catched, Here you can see that now is also checked if there is a block above the water even if it is not raining.

See screenshots for a ingame debug i made which shows the possibility to catch a fish in minecraft 1.6.4 it shows that removing the block above the water block will be enough to improve the fishing rate.

With the block above the water block With Block

With the block removed Without Block

Results in Minecraft 1.7.2 Minecraft 1.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment