Skip to content

Add FishHook#(get/set)BobbingFluids API #12126

@NamiUni

Description

@NamiUni

Is your feature request related to a problem?

I am developing a fishing plugin and would like to implement fishing in lava.

However, the TagKey<Fluid> referenced by the NMS FishingHook class is hardcoded. To allow fishing in lava, I would have to completely reimplement the vanilla water fishing mechanics from scratch. This would require significant effort and could negatively impact server performance.

Describe the solution you'd like.

  • Add a TagKey field to the FishingHook class and set its default value to FluidTags.WATER.
  • Modify references to FluidTags.WATER within the FishingHook class to use the newly added field instead.
  • Add two methods to the Bukkit FishHook class:
    • TagKey<Fluid> getBobbingFluids()
    • void setBobbingFluids(TagKey<Fluid> fluids)
  • Implement these methods in CraftFishHook. (Would parsing with PaperRegistries.toNms be the appropriate implementation?)

I considered adding this as a World Configuration option, but since the demand for this feature is limited and the runtime cost for plugins is low, I believe it is unnecessary.

If this request is accepted, I am willing to submit a PR myself :)

Describe alternatives you've considered.

  • Reimplement vanilla water fishing mechanics for lava fishing within the plugin.
    • This could lead to inconsistencies between versions.
    • It may negatively impact performance.
  • Attempted to modify FluidState using ServerTickStartEvent, but it didn't work.
    • Even if it worked, it would negatively impact performance.
  • Use a data pack to modify fluid/water.json in fluid tags by adding flowing_lava and lava. (This is the closest to an ideal implementation.)
    • However, it would affect other game mechanics that rely on fluid tags. Reference
  • Implement a CustomFishingHook class.
    • This would involve copying the NMS FishingHook class and modifying only a few lines in the tick method. However, publishing this code on GitHub or including it in a JAR could violate Mojang Mappings licensing terms.
    • Additionally, using NMS directly introduces compatibility issues across versions.
  • Fork Paper and modify the FishingHook class directly.
    • This is stupid solution.

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions