use of org.bukkit.craftbukkit.v1_8_R3.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;
}
}
use of org.bukkit.craftbukkit.v1_8_R3.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;
}
}
use of org.bukkit.craftbukkit.v1_8_R3.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;
}
}
use of org.bukkit.craftbukkit.v1_8_R3.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;
}
}
Aggregations