yeelp / Scaling-Feast

A simple, balanced way to increase your maximum hunger in Minecraft over the course of a world.
MIT License
0 stars 1 forks source link

Porting to Forge or Fabric 1.18 and up? (Aka "Scaling Feast Modernized") #119

Open James103 opened 2 years ago

James103 commented 2 years ago

Is your feature request related to a problem? Please describe. Currently, there appears to be no way to use the mod as it is on Minecraft versions 1.17 and up. 1.12 is no longer supported by most mod and mod pack creators, and a declining fraction of players use it.

Describe the feature you'd like It would be great to port this to the latest Minecraft versions, including 1.17, 1.18 (when it comes out), and later. Ideally, this would be ported to Fabric for easier maintenance. A Forge may be acceptable as well depending on the circumstances.

Describe why this feature belongs in Scaling Feast By porting this mod to modern versions such as 1.17 and up, you open up the mod to being used by more players, especially those that play on modern versions of Minecraft. By porting this mod to Fabric, you make it easier to maintain and more accessible to people.

Describe alternatives you've considered You could try to find a mod that does the same thing as what this mod does, however, there is likely no such mod. You could try to recreate the mod server-side-only using data packs or functions, but you would not be able to recreate all of the functionality.

yeelp commented 2 years ago

I'm not sure about the feasibility, Scaling Feast relies heavily on AppleCore for a large majority of its features, and leaves handling max hunger to AppleCore, and AppleCore is stuck in 1.12 (check out the discussion here). A Forge PR has been made that adds AppleCore's features to Forge, but it hasn't been merged last I checked. Porting to newer versions is effectively stalled until that change is merged. It may be possible to port to newer versions without AppleCore, but that would be a rewrite instead of a port, which would take much more time (and not all features may be able to make it).

As for Fabric, I don't know how it differs from Forge. What makes Fabric a better Forge alternative for modern versions?

James103 commented 2 years ago

See the following posts for example: https://forums.minecraftforge.net/topic/87328-forge-fabric-difference/ https://www.reddit.com/r/feedthebeast/comments/e57sps/what_is_the_functional_difference_between_forge/ https://www.reddit.com/r/feedthebeast/comments/j7buq9/whats_the_difference_between_forge_and_fabric_and/ ... and many of the other links found on https://duckduckgo.com/?q=difference+between+fabric+and+forge

To summarize, Fabric is lightweight and allows mods to more easily mod the vanilla code directly. It loads faster and is smaller / more efficient compared to Forge. In addition, Fabric can update to newer Minecraft versions much faster compared to Forge, mainly as a result of it being more lightweight and reduced development overhead.

For example, a mod created for the Fabric mod loader can mixin into the HungerManager (and many other classes in the Minecraft source code) directly, but that may not be the case for Forge.

yeelp commented 2 years ago

If that's the case, then ScalingFeast may only be possible for modern versions as a Fabric exclusive, so I can see that as a possibility, but potentially a challenging one. Something to tackle after #113

James103 commented 2 years ago

ScalingFeast may only be possible for modern versions as a Fabric exclusive

At the very least, until https://github.com/MinecraftForge/MinecraftForge/pull/8405 is merged for 1.18 compatibility and https://github.com/MinecraftForge/MinecraftForge/pull/7266 is merged for 1.16 compatibility.

If you choose to go the Fabric route, it is recommended to:

  1. Check out the source code of other (related) Fabric mods and https://github.com/FabricMC/fabric-example-mod/ so that you can learn from them.
  2. Make Fabric API a dependency for your mod. This allows you to use all of Fabric API's features in addition to the features from the Fabric loader itself.
James103 commented 1 year ago

Regarding porting Scaling Feast to Fabric, what I would like to have happen is that (on Fabric) the Scaling Feast mod itself contains the new mechanics, effects, blocks and items etc, while a separate library mod tentatively called "Hunger Attributes" (hunger-attributes) has the actual hunger attributes themselves.

This should allow other mods and datapacks, not just Scaling Feast, to make use of the new attributes to modify various numbers about a player's hunger system.

AppleSkin (or a fork thereof) may need to be updated to support the new library mod, allowing the hunger and saturation bars to be at their proper size with respect to the corresponding attributes.

List of attributes to be implemented by Hunger Attributes ### Max Hunger (`hunger_attributes:max_hunger`) * Modifies the maximum hunger level a player can have. * Default value: 20, same as in vanilla. * Example 1: Setting this to 40 allows the player's food level to be 2x greater compared to vanilla. Client-side, their hunger bar will gain an additional row, have colored overlays or just scale to the higher maximum (with each half-shank representing 2 hunger). * Example 2: Setting this to 10 limits the player's food level to half that of vanilla. Client side, their hunger bar will either show only 5 shank slots or scale to the lower maximum (with each full shank representing 1 hunger). * Minimum value: 1 (a player needs some hunger or else they starve) ### Max Saturation Ratio (`hunger_attributes:max_saturation_ratio`) * Multiplies the maximum saturation level a player can have (compared to their hunger). * Default value: 1.0, same as in vanilla. * Example 1: Setting this to 2.0 allows the player to have twice as much saturation compared to their hunger. * Example 2: Setting this to 0.5 caps the player's saturation at half their hunger level. * Minimum value: 0, which does not allow the player to gain starvation. ### Exhaustion Cap (`hunger_attributes:exhaustion_cap`) * Modifies the maximum exhaustion level a player can ever have. * Default value: 40.0, same as in vanilla. * Example 1: Setting this to 1000.0 allows the player to reach 1000.0 exhaustion at once, which if left unchecked will drain 250 food points. * Example 2: Setting this to 8.0 allows the player to lose a maximum of 2 food points from a single action, even if said action would cost more. * Minimum value: 0, which does not allow the player to gain exhaustion. ### Max Exhaustion (`hunger_attributes:max_exhaustion`) * Modifies the exhaustion level required for a player to lose a food point (first saturation then hunger). * Default value: 1.0, which corresponds to no multiplier. * If this attribute's value is above 1, it takes that many times more exhaustion points to lose a food point. * If this attribute's value is below 1, take 2 minus the attribute value and the amount of exhaustion points required to lose a food point is divided by the result. * No hard upper or lower bound, given the special case behavior. If the attribute had worked like a simple multiplier, its value would need to be lower-bounded by 0. ### Food Efficiency (`hunger_attributes:food_efficiency`) * Modifies the amount of exhaustion gained from all sources, effectively making food last longer (or shorter). * Default value: 1.0, same as in vanilla. * If this attribute's value is above 1, the player accumulates exhaustion that many times slower. * If this attribute's value is below 1, take 2 minus the attribute value and the result multiplies the amount of exhaustion the player accumulates. * No hard upper or lower bound, given the special case behavior. If the attribute had worked like a simple multiplier, its value would need to be lower-bounded by 0.
yeelp commented 1 year ago

Library mod is a great idea. Currently, Fabric seems to be the only way forward for Scaling Feast.

We return to the age old question of how to handle AppleSkin. A fork could be made, but I may stick to doing it in a similar manner to how it was handled in Scaling Feast.

I'm not sure how much I like the arbitrary minimum values for exhaustion; there's gotta be some reasonable and logical minimum value or a different way of representing the attribute that has a logical minimum value. Food efficiency should already be designed in a way that avoids divide by zero errors (since it's a percentage increase, and thus has no minimum value) so an option for max exhaustion should exist too

James103 commented 1 year ago

If the behavior for food efficiency in the current version of Scaling Feast described in https://github.com/yeelp/Scaling-Feast/issues/81 still how you want the attribute to work in its port?

When food efficiency is greater than 1, divide exhaustion gained by the food efficiency (this is normal behavior). When food efficiency is less than 1, however, take 2 minus the food efficiency value and multiply exhaustion gained by the result.

If so, the attribute for 'max exhaustion' may need to get the same treatment. I've updated the descriptions of the corresponding proposed attributes to match.

yeelp commented 1 year ago

Yeah, it makes sense to leave the food efficiency attribute functionally as is. I think it's implemented well enough.