Fishing.kt
Branches > main > bfb8108 > files / src / main / kotlin / net / bowmap / handlers / Fishing.kt
package net.bowmap.handlers
import net.bowmap.stormbow.*
import net.bowmap.stormbow.game.*
import net.bowmap.server.fact.*
import net.bowmap.server.loot.*
import org.bukkit.Material.*
import net.bowmap.server.loot.tables.fishingLootTable
// TODO f, not e
// private fun calculateFishVelocity(e: PlayerCaughtFish): Vector {
// val eye = e.player.eyeLocation
// val distance = eye.distance(e.hook.location)
//
// return eye.subtract(e.hook.location)
// .toVector()
// .normalize()
// .multiply(0.2 + distance * 0.1)
// }
fun handlePlayerFishing(f: PlayerStartedFishing): Effects =
Effects(SetFishTime(ticks = 20))
// TODO effects here!
fun handlePlayerCatchingFish(f: PlayerCaughtFish): Effects {
// val loot = fishingLootTable.getLoot()
//
// for (stack in toItemStacks(loot)) {
// val item = f.hook.world.dropItem(f.hook.location, stack)
// item.setVelocity(calculateFishVelocity(f))
// }
return Effects()
}