PluginBugs / Issues-ItemsAdder

Repository used to keep track of issues of my plugin ItemsAdder
https://itemsadder.devs.beer
53 stars 21 forks source link

Loot support more rules (height, weather, day/night, moon phase) #1811

Open Akiranya opened 2 years ago

Akiranya commented 2 years ago

Terms

Discord tag (optional)

Nailm#9364

Describe the solution you'd like

Hi LoneDev, could you make loot support more rules like height, temperature, weather, day/night and moon phase? so that the looting can be more flexible. For now it supports biome, which is great. But with more rules I think it would be more interesting. Like we can let player fish "night fish" only at nights, or "rain fish" when it's raining. Or some "dark fish" when the player fish below 0.

loots:
  fishing:
    pufferfish:
      biomes:
        - WARM_OCEAN
      height_below: 120
      height_above: 80
      weather:
      - RAIN
      - THUNDER
      time:
      - NIGHT
      moon_phase:
      - FULL_MOON
      - FIRST_QUARTER
      items:
        item_1:
          item: stardew_valley:pufferfish
          min_amount: 1
          max_amount: 1
          chance: 5

In this example config, the height is player-related and weather, time, moon_phase is world-related where the loot drops

Is your feature request related to a problem?

Just a feature request to make the plugin better :)

Describe alternatives you've considered

None

Additional context

No response

Akiranya commented 1 year ago

Hey Lone, I would like to add one more feature on this request.

Could you pls add support for loots in custom biome?

More specifically, the biomes firstly can accept namespaced id like minecraft:desert. Then it can accept and recognise a namespaced id from other custom ones like terra:overworld/overworld/xerophytic_forest.

Not sure if can be done in spigot but I see a post about getting the name of the custom biome. Hope it helps!

LoneDev6 commented 1 year ago

Thanks for the idea, I'll try to see if I can access this information, probably I'll have to use NMS to access this since Spigot API doesn't offer custom biome support if I recall.

Akiranya commented 1 year ago

ya I guess NMS is necessary for this purpose, the Terra implementation has done it thru NMS

Akiranya commented 1 year ago

I just implemented a biome key/name finder class that works with custom biomes (I tested it with Terra).

It also works with vanilla biomes like minecraft:desert

The NMS code is implmented in Minecraft 1.19.3.

https://gist.github.com/Akiranya/67b0f3b63e8a7e329194ccb377d7f413 https://gist.github.com/Akiranya/3be6379b3b29b8a2d2243e9e49c60d9f

Hope it helps :)