Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluid API v1 #1136

Closed
Closed

Conversation

PepperCode1
Copy link
Member

@PepperCode1 PepperCode1 commented Oct 23, 2020

This module adds a new FabricFlowableFluid class and FabricFluidBlock class. The new fluid class lets the user register one fluid instead of both a still fluid and a flowing fluid the vanilla way. It also lets the user set the maximum level of the fluid via an abstract method. Both classes provide some optimizations over vanilla's counterpart classes and contain some new methods that can be overriden for more control.

@i509VCB i509VCB added enhancement New feature or request new module Pull requests that introduce new modules reviews needed This PR needs more reviews test labels Oct 23, 2020

/**
* If a fluid is still, its state index is zero.
* If a fluid is flowing, its state index is non-zero and represents its level and height.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate further on what part of the state index is level and which part is height?

Copy link
Member Author

@PepperCode1 PepperCode1 Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the newer commits I removed the "and height" part from the javadoc, since that is confusing. The height of the fluid is level/(maxLevel+1), as seen in FlowableFluid#getHeight.

public FabricFlowableFluidBlock(Settings settings) {
super(settings);
this.fluid = getFluid();
stateIndexProperty = this.fluid.getStateIndexProperty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getStateIndexProperty should be wrapped with an Objects.requireNonNull

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value cannot be null unless mixins/asm are used. Should I still wrap it?

@PepperCode1 PepperCode1 changed the title Add Fluid Extensions Module Fluid Extension API v1 Oct 23, 2020
@PepperCode1 PepperCode1 requested a review from i509VCB October 23, 2020 23:28
@sylv256
Copy link

sylv256 commented Oct 29, 2020

i have [some serious] concerns

  1. where is fluid volume api
  2. does it use millibuckets or millitoffets?

nevermind

@Prospector
Copy link
Contributor

Prospector commented Nov 12, 2020

Imo, this module should just be called fabric-fluid-api-v1 so other future stuff like adding more tags for fluid behavior (such as for swimming, drowning, etc.) can be included in a more general fluid module, much like we have for items (fabric-item-api-v1).

A fluid volume api would be fabric-fluid-volume-api-v1

Add Licenses
Fix some formatting
Rename to Fluid Extension API
Fix license and style
Add suggestions from review
@PepperCode1 PepperCode1 force-pushed the 1.16-fluid-extensions-api branch from e317e1d to 4f06f67 Compare November 25, 2020 04:16
Renamed the entire module and any instance of "fabric-fluid-extension-api" to "fabric-fluid-api"
Removed a comma in the fabric.mod.json of the test mod
@PepperCode1 PepperCode1 changed the title Fluid Extension API v1 Fluid API v1 Nov 25, 2020
@PepperCode1
Copy link
Member Author

I have renamed the module as per Prospector's suggestion.

@i509VCB i509VCB added the priority:low Low priority PRs that don't immediately need to be resolved label Jan 19, 2021
@PepperCode1
Copy link
Member Author

I am unsure about this PR because my original goal with it was to essentially replace vanilla's fluid system (which IMO isn't very good), and this PR accomplishes this quite well. I am now realizing though, that forcing users to use a single fluid and the custom fluid block class takes away control, and that this PR might not wholly fit into Fabric API. In the Discord API channel, it was discussed that a unified fluid class does not fit into Fabric API and that the FluidBlock class should be mixed into instead of replaced, but I am really not sure how to improve the system only partially.

@OroArmor OroArmor mentioned this pull request Mar 31, 2021
@ghost ghost mentioned this pull request Oct 22, 2021
23 tasks
@Technici4n Technici4n closed this Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new module Pull requests that introduce new modules priority:low Low priority PRs that don't immediately need to be resolved reviews needed This PR needs more reviews test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants