Search in sources :

Example 1 with CraftFish

use of org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_11_R1 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.a(Enchantments.LURE, nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 2 with CraftFish

use of org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_9_R2 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.h(nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_9_R2.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 3 with CraftFish

use of org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_10_R1 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.h(nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_10_R1.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 4 with CraftFish

use of org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_8_R3 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.h(nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_8_R3.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Aggregations

CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)1 CraftFish (org.bukkit.craftbukkit.v1_10_R1.entity.CraftFish)1 CraftItemStack (org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack)1 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)1 CraftFish (org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish)1 CraftItemStack (org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack)1 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)1 CraftFish (org.bukkit.craftbukkit.v1_8_R3.entity.CraftFish)1 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)1 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)1 CraftFish (org.bukkit.craftbukkit.v1_9_R2.entity.CraftFish)1 CraftItemStack (org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack)1