File tree Expand file tree Collapse file tree 3 files changed +88
-0
lines changed
autogenerated/java/net/minestom/server/fluid
main/java/net/minestom/server/fluid Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+ package net .minestom .server .fluid ;
2+
3+ /**
4+ * Code autogenerated, do not edit!
5+ */
6+ @ SuppressWarnings ("unused" )
7+ interface Fluids {
8+ Fluid EMPTY = FluidImpl .get ("minecraft:empty" );
9+
10+ Fluid FLOWING_WATER = FluidImpl .get ("minecraft:flowing_water" );
11+
12+ Fluid WATER = FluidImpl .get ("minecraft:water" );
13+
14+ Fluid FLOWING_LAVA = FluidImpl .get ("minecraft:flowing_lava" );
15+
16+ Fluid LAVA = FluidImpl .get ("minecraft:lava" );
17+ }
Original file line number Diff line number Diff line change 1+ package net .minestom .server .fluid ;
2+
3+ import net .minestom .server .registry .Registry ;
4+ import net .minestom .server .registry .StaticProtocolObject ;
5+ import net .minestom .server .utils .NamespaceID ;
6+ import org .jetbrains .annotations .Contract ;
7+ import org .jetbrains .annotations .NotNull ;
8+ import org .jetbrains .annotations .Nullable ;
9+
10+ import java .util .Collection ;
11+
12+ public sealed interface Fluid extends StaticProtocolObject , Fluids permits FluidImpl {
13+ /**
14+ * Returns the entity registry.
15+ *
16+ * @return the entity registry or null if it was created with a builder
17+ */
18+ @ Contract (pure = true )
19+ @ Nullable
20+ Registry .FluidEntry registry ();
21+
22+ @ Override
23+ @ NotNull
24+ NamespaceID namespace ();
25+
26+ static @ NotNull Collection <@ NotNull Fluid > values () {
27+ return FluidImpl .values ();
28+ }
29+
30+ static @ Nullable Fluid fromNamespaceId (@ NotNull String namespaceID ) {
31+ return FluidImpl .getSafe (namespaceID );
32+ }
33+
34+ static @ Nullable Fluid fromNamespaceId (@ NotNull NamespaceID namespaceID ) {
35+ return fromNamespaceId (namespaceID .asString ());
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ package net .minestom .server .fluid ;
2+
3+ import net .minestom .server .registry .Registry ;
4+ import net .minestom .server .utils .NamespaceID ;
5+ import org .jetbrains .annotations .NotNull ;
6+
7+ import java .util .Collection ;
8+ import java .util .concurrent .atomic .AtomicInteger ;
9+
10+ public record FluidImpl (Registry .FluidEntry registry , NamespaceID namespace , int id ) implements Fluid {
11+
12+ private static final Registry .DynamicContainer <Fluid > CONTAINER = Registry .createDynamicContainer (Registry .Resource .FLUIDS , FluidImpl ::createImpl );
13+ private static final AtomicInteger INDEX = new AtomicInteger ();
14+
15+ private static FluidImpl createImpl (String namespace , Registry .Properties properties ) {
16+ return new FluidImpl (Registry .fluidEntry (namespace , properties ));
17+ }
18+
19+ private FluidImpl (Registry .FluidEntry registry ) {
20+ this (registry , registry .namespace (), INDEX .getAndIncrement ());
21+ }
22+
23+ static Collection <Fluid > values () {
24+ return CONTAINER .values ();
25+ }
26+
27+ public static Fluid get (@ NotNull String namespace ) {
28+ return CONTAINER .get (namespace );
29+ }
30+
31+ static Fluid getSafe (@ NotNull String namespace ) {
32+ return CONTAINER .getSafe (namespace );
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments