clazz) {
32 | this.clazz = clazz;
33 | }
34 |
35 | @Override
36 | public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
37 | final JsonPrimitive object = json.getAsJsonObject().getAsJsonPrimitive("type");
38 | final Key key = context.deserialize(object, Key.class);
39 | final Class extends T> type = Registry.getRegistry(clazz).getType(key);
40 | return context.deserialize(json, type);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/data/Component.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.data;
20 |
21 | import java.lang.annotation.ElementType;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.RetentionPolicy;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Used to annotate classes that provide their own {@link ComponentAccess}.
28 | * If the injector comes across a component annotated with this, it will construct the
29 | * {@link ComponentAccess} instance and add it to the corresponding {@link DataAccess}.
30 | * Only works on classes that are implementations of specified types defined in {@link DataAccess#GENERATOR_TYPES}.
31 | *
32 | * It will also be used when looking for types to create a json schema for.
33 | *
34 | * @author Jake Nijssen
35 | * @since 0.3-Alpha
36 | */
37 | @Retention(RetentionPolicy.RUNTIME)
38 | @Target(ElementType.TYPE)
39 | public @interface Component {
40 |
41 | /**
42 | * The type of the {@link ComponentAccess} implementation.
43 | *
44 | * @return The type of the {@link ComponentAccess} implementation.
45 | */
46 | Class extends ComponentAccess> value();
47 | }
48 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/ArrayType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * The {@link Class} in the {@link java.util.Collection} of the {@link java.lang.reflect.Field} annotated
27 | * by this method, this is used to evaluate which schema to use by the generator.
28 | * This is required due to java type erasure.
29 | *
30 | * @author Jake Nijssen
31 | * @see Java type erasure
32 | * @since 0.3-Alpha
33 | */
34 | @Documented
35 | @Retention(RetentionPolicy.RUNTIME)
36 | @Target(ElementType.FIELD)
37 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
38 | public @interface ArrayType {
39 |
40 | /**
41 | * The class inside the annotated {@link java.util.Collection}.
42 | *
43 | * @return The parameterized class type.
44 | */
45 | Class> value();
46 | }
47 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Description.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * A mandatory annotation on all {@link java.lang.reflect.Field}'s and {@link Class}es that are part
27 | * of the generator. The value inside of this annotation will be shown to the user when hovering over that element.
28 | *
29 | * @author Jake Nijssen
30 | * @since 0.3-Alpha
31 | */
32 | @Documented
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Target({ElementType.FIELD, ElementType.TYPE})
35 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
36 | public @interface Description {
37 |
38 | /**
39 | * The description text to show when hovering.
40 | *
41 | * @return A description about the type/field.
42 | */
43 | String value();
44 | }
45 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Entries.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Forces the {@link String} value of a field or inside a {@link java.util.Collection} to be a reference
27 | * to a datafile of the specified type.
28 | * The names for these files are by {@link com.azortis.orbis.pack.data.DataAccess#getDataEntries(Class)},
29 | * if the specified type is a component type, then it will only produce entries inside a component instance.
30 | *
31 | * @author Jake Nijssen
32 | * @since 0.3-Alpha
33 | */
34 | @Documented
35 | @Retention(RetentionPolicy.RUNTIME)
36 | @Target(ElementType.FIELD)
37 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
38 | public @interface Entries {
39 |
40 | /**
41 | * The type to validate the data file names against.
42 | *
43 | * @return The entries datatype.
44 | */
45 | Class> value();
46 | }
47 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/GlobalDefinition.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Mark classes of which its schema definitions are reused.
27 | * This will tell the schema generator to create a global schema definition file for this {@link Class} type.
28 | *
29 | * Classes annotated with this cannot access component {@link Entries} for any of its fields, as it is unknown
30 | * at schema generation if a global definition is used in a {@link com.azortis.orbis.pack.data.Component} environment or not.
31 | *
32 | * @author Jake Nijssen
33 | * @since 0.3-Alpha
34 | */
35 | @Inherited
36 | @Documented
37 | @Retention(RetentionPolicy.RUNTIME)
38 | @Target(ElementType.TYPE)
39 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
40 | public @interface GlobalDefinition {
41 | /**
42 | * The name of the definitions file, i.e. "Vec3i" will produce "Vec3i.json"
43 | * The name should be unique and cannot clash with other definitions, so use truly unique names.
44 | *
45 | * @return The name of the definitions file.
46 | * @since 0.3-Alpha
47 | */
48 | String value();
49 | }
50 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Ignore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Marks non-transient/static fields to be excluded from the generated json schema.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @Documented
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target(ElementType.FIELD)
34 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
35 | public @interface Ignore {
36 | }
37 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/InheritFields.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 |
22 | import org.apiguardian.api.API;
23 |
24 | import java.lang.annotation.*;
25 |
26 | /**
27 | *
Used to mark a {@link Class} whose fields should be seen as a property
28 | * in the {@link Class} that is extending the annotated {@link Class}.
29 | *
30 | * Note do not use on abstract classes in combination with {@link Typed} this will
31 | * otherwise lead to duplicate properties in the schema.
32 | *
33 | * @author Jake Nijssen
34 | * @since 0.3-Alpha
35 | */
36 | @Documented
37 | @Retention(RetentionPolicy.RUNTIME)
38 | @Target(ElementType.TYPE)
39 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
40 | public @interface InheritFields {
41 | }
42 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Max.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Sets the maximum value an {@link Number} can be of a {@link java.lang.reflect.Field}
27 | * or {@link java.util.Collection} entry.
28 | *
29 | * @author Jake Nijssen
30 | * @since 0.3-Alpha
31 | */
32 | @Documented
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Target(ElementType.FIELD)
35 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
36 | public @interface Max {
37 |
38 | /**
39 | * The maximum value if the annotated type is an integer.
40 | *
41 | * @return The minimum integer value for the field/entry.
42 | */
43 | long value() default Long.MAX_VALUE;
44 |
45 | /**
46 | * The maximum value if the annotated type is a floating point number.
47 | *
48 | * @return The minimum floating point value for the field/entry.
49 | */
50 | double floating() default Double.MAX_VALUE;
51 | }
52 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/MaxItems.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Sets the maximum amount of entries allowed on the annotated {@link java.util.Collection}.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @Documented
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target(ElementType.FIELD)
34 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
35 | public @interface MaxItems {
36 |
37 | /**
38 | * @return The maximum amount of entries required.
39 | */
40 | long value() default Long.MAX_VALUE;
41 | }
42 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Min.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Sets the minimum value an {@link Number} can be of a {@link java.lang.reflect.Field}
27 | * or {@link java.util.Collection} entry.
28 | *
29 | * @author Jake Nijssen
30 | * @since 0.3-Alpha
31 | */
32 | @Documented
33 | @Retention(RetentionPolicy.RUNTIME)
34 | @Target(ElementType.FIELD)
35 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
36 | public @interface Min {
37 |
38 | /**
39 | * The minimum value if the annotated type is an integer.
40 | *
41 | * @return The minimum integer value for the field/entry.
42 | */
43 | long value() default Long.MIN_VALUE;
44 |
45 | /**
46 | * The minimum value if the annotated type is a floating point number.
47 | *
48 | * @return The minimum floating point value for the field/entry.
49 | */
50 | double floating() default Double.MIN_VALUE;
51 | }
52 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/MinItems.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Sets the minimum amount of entries required on the annotated {@link java.util.Collection}.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @Documented
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target(ElementType.FIELD)
34 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
35 | public @interface MinItems {
36 |
37 | /**
38 | * @return The minimum amount of entries required. Cannot be lower than 1.
39 | */
40 | long value() default 1;
41 | }
42 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Required.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Used to mark a {@link java.lang.reflect.Field} as required in the generated json schema.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @Documented
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target(ElementType.FIELD)
34 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
35 | public @interface Required {
36 | }
37 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/SupportAnonymous.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Used by {@link com.azortis.orbis.pack.data.DataAccess#GENERATOR_TYPES} that can be embedded anonymously
27 | * in other config files, this will override the {@link Required} property on the declared field {@link SupportAnonymous#value()}
28 | * meaning that that field won't be required in embedded environments, but still will be in environments where it is a
29 | * standalone file.
30 | *
31 | * @author Jake Nijssen
32 | * @since 0.3-Alpha
33 | */
34 | @Documented
35 | @Retention(RetentionPolicy.RUNTIME)
36 | @Target(ElementType.TYPE)
37 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
38 | public @interface SupportAnonymous {
39 |
40 | /**
41 | * The name of the field to overrule the {@link Required} when in an embedded environment,
42 | * defaults to "name".
43 | *
44 | * @return The field name to overrule.
45 | * @since 0.3-Alpha
46 | */
47 | String value() default "name";
48 | }
49 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Typed.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import com.azortis.orbis.Registry;
22 | import org.apiguardian.api.API;
23 |
24 | import java.lang.annotation.*;
25 |
26 | /**
27 | * Marks a class as typed, meaning it can have different implementations based on the provided
28 | * type {@link net.kyori.adventure.key.Key} field. All classes using this typed based system
29 | * must register a {@link com.azortis.orbis.Registry} for the class using the following method
30 | * {@link com.azortis.orbis.Registry#addRegistry(Class, Registry)}
31 | *
32 | * Note It is recommended to locate the registry statically in the class, and use a static block to
33 | * register the registry.
34 | *
35 | * @author Jake Nijssen
36 | * @since 0.3-Alpha
37 | */
38 | @Documented
39 | @Retention(RetentionPolicy.RUNTIME)
40 | @Target(ElementType.TYPE)
41 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
42 | public @interface Typed {
43 | }
44 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/Unique.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.annotations;
20 |
21 | import org.apiguardian.api.API;
22 |
23 | import java.lang.annotation.*;
24 |
25 | /**
26 | * Forces entries inside a {@link java.util.Collection} to be unique.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @Documented
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Target(ElementType.FIELD)
34 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
35 | public @interface Unique {
36 | }
37 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/annotations/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | /**
20 | * Annotations used to define metadata of {@link java.lang.reflect.Field}'s and
21 | * {@link java.lang.Class}es to validate the values of these fields and classes against the generated
22 | * json schema's
23 | */
24 | package com.azortis.orbis.pack.studio.annotations;
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/pack/studio/schema/EntriesBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.pack.studio.schema;
20 |
21 | import com.azortis.orbis.pack.studio.Project;
22 | import com.azortis.orbis.pack.studio.StudioDataAccess;
23 | import com.google.gson.JsonArray;
24 | import com.google.gson.JsonObject;
25 | import org.jetbrains.annotations.NotNull;
26 | import org.jetbrains.annotations.Nullable;
27 |
28 | import java.io.File;
29 |
30 | public final class EntriesBuilder extends SchemaBuilder {
31 |
32 | private final JsonObject schema = new JsonObject();
33 | private final Class> type;
34 | private final String name;
35 |
36 | EntriesBuilder(@NotNull Project project, @NotNull StudioDataAccess data, @NotNull SchemaManager schemaManager,
37 | @NotNull File schemaFile, @NotNull Class> type, @Nullable String name) {
38 | super(project, data, schemaManager, schemaFile);
39 | this.type = type;
40 | this.name = name;
41 |
42 | // Create initial schema
43 | schema.addProperty("$schema", "http://json-schema.org/draft-07/schema");
44 | schema.addProperty("type", "string");
45 | }
46 |
47 | @Override
48 | protected @NotNull JsonObject generateSchema() {
49 | if (schema.has("enum")) schema.remove("enum");
50 | JsonArray entries = new JsonArray();
51 | if (name == null) {
52 | data.getDataEntries(type).forEach(entries::add);
53 | } else {
54 | // For components make sure to append the component name
55 | data.getDataEntries(type, name).forEach(entries::add);
56 | }
57 | if (entries.isEmpty()) entries.add("NONE");
58 | schema.add("enum", entries);
59 | return schema;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/Axis.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util;
20 |
21 | import org.apiguardian.api.API;
22 | import org.jetbrains.annotations.NotNull;
23 |
24 | /**
25 | * An enum that represents an object that is aligned to a certain axis.
26 | *
27 | * @author Jake Nijssen
28 | * @since 0.3-Alpha
29 | */
30 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
31 | public enum Axis implements Nameable {
32 | /**
33 | * Represents an alignment on the x-axis.
34 | */
35 | X("x"),
36 |
37 | /**
38 | * Represents an alignment on the y-axis.
39 | */
40 | Y("y"),
41 |
42 | /**
43 | * Represents an alignment on the z-axis.
44 | */
45 | Z("z");
46 |
47 | /**
48 | * The serialized name of the axis.
49 | */
50 | private final String name;
51 |
52 | Axis(String name) {
53 | this.name = name;
54 | }
55 |
56 | /**
57 | * Get the String representation of this axis.
58 | *
59 | * @return The string representation of this axis.
60 | * @since 0.3-Alpha
61 | */
62 | @Override
63 | public String toString() {
64 | return this.name;
65 | }
66 |
67 |
68 | /**
69 | * {@inheritDoc}
70 | */
71 | @Override
72 | public @NotNull String serializedName() {
73 | return this.name;
74 | }
75 |
76 |
77 | /**
78 | * Get the axis when the current one is rotated by specified rotation.
79 | *
80 | * @param rotation The rotation to apply.
81 | * @return The rotated axis, same if the current Axis is Y or when the specified rotation is NONE or FLIP.
82 | * @since 0.3-Alpha
83 | */
84 | public @NotNull Axis rotate(@NotNull Rotation rotation) {
85 | if (this == Y || rotation == Rotation.NONE || rotation == Rotation.FLIP) return this;
86 | return switch (this) {
87 | case X -> Z;
88 | case Z -> X;
89 | default -> throw new IllegalStateException("This shouldn't happen.");
90 | };
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/BoundingBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util;
20 |
21 | import org.jetbrains.annotations.NotNull;
22 |
23 | public record BoundingBox(@NotNull BlockPos min, @NotNull BlockPos max) {
24 |
25 | public BoundingBox(@NotNull BlockPos min, @NotNull BlockPos max) {
26 | int minX = Math.min(min.x(), max.x());
27 | int minY = Math.min(min.y(), max.y());
28 | int minZ = Math.min(min.z(), max.z());
29 | this.min = new BlockPos(minX, minY, minZ);
30 |
31 | int maxX = Math.max(min.x(), max.x());
32 | int maxY = Math.max(min.x(), max.x());
33 | int maxZ = Math.max(min.x(), max.x());
34 | this.max = new BlockPos(maxX, maxY, maxZ);
35 | }
36 |
37 | public int minX() {
38 | return min.x();
39 | }
40 |
41 | public int minY() {
42 | return min.y();
43 | }
44 |
45 | public int minZ() {
46 | return min.z();
47 | }
48 |
49 | public int maxX() {
50 | return max.x();
51 | }
52 |
53 | public int maxY() {
54 | return max.y();
55 | }
56 |
57 | public int maxZ() {
58 | return max.z();
59 | }
60 |
61 | public boolean checkBounds(int x, int y, int z) {
62 | return (minX() <= x && x <= maxX()) && (minY() <= y && y <= maxY()) && (minZ() <= z && z <= maxZ());
63 | }
64 |
65 | public boolean checkBounds(@NotNull BlockPos pos) {
66 | return checkBounds(pos.x(), pos.y(), pos.z());
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/Nameable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util;
20 |
21 | import org.apiguardian.api.API;
22 | import org.jetbrains.annotations.Contract;
23 | import org.jetbrains.annotations.NotNull;
24 |
25 | /**
26 | * An interface that marks an object that has a specific serialized name string.
27 | *
28 | * @author Jake Nijssen
29 | * @since 0.3-Alpha
30 | */
31 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
32 | public interface Nameable {
33 |
34 | /**
35 | * Get the serialized name for this object.
36 | *
37 | * @return The serialized name of the object.
38 | * @since 0.3-Alpha
39 | */
40 | @Contract(pure = true)
41 | @API(status = API.Status.STABLE, since = "0.3-Alpha")
42 | @NotNull
43 | String serializedName();
44 | }
45 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/annotations/AbsoluteCoords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.annotations;
20 |
21 | import java.lang.annotation.*;
22 |
23 | /**
24 | * Marks that the {@link Integer} or {@link Double} parameters of the annotated {@link java.lang.reflect.Constructor},
25 | * {@link java.lang.reflect.Method} or record parameters should be absolute coordinates in the world.
26 | *
27 | * @author Jake Nijssen
28 | * @since 0.3-Alpha
29 | */
30 | @Documented
31 | @Retention(RetentionPolicy.SOURCE)
32 | @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD})
33 | public @interface AbsoluteCoords {
34 | }
35 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/annotations/ChunkCoords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.annotations;
20 |
21 | import java.lang.annotation.*;
22 |
23 | /**
24 | * Marks that the {@link Integer} parameters of the annotated {@link java.lang.reflect.Constructor},
25 | * {@link java.lang.reflect.Method} or record parameters should be chunk coordinates.
26 | *
27 | * To get the chunk coordinate from a block coordinate you do: {@code int chunkCoord = blockCoord >> 4;}
28 | *
29 | * @author Jake Nijssen
30 | * @since 0.3-Alpha
31 | */
32 | @Documented
33 | @Retention(RetentionPolicy.SOURCE)
34 | @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD})
35 | public @interface ChunkCoords {
36 | }
37 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/annotations/RelativeCoords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.annotations;
20 |
21 | import java.lang.annotation.*;
22 |
23 | /**
24 | * Marks that the {@link Integer} parameters of the annotated {@link java.lang.reflect.Constructor},
25 | * {@link java.lang.reflect.Method} or record parameters should be relative coords of the given object.
26 | *
27 | * A good example of this are block coordinates inside a {@link com.azortis.orbis.world.ChunkAccess},
28 | * where block coordinates range from 0-15
29 | *
30 | * @author Jake Nijssen
31 | * @since 0.3-Alpha
32 | */
33 | @Documented
34 | @Retention(RetentionPolicy.SOURCE)
35 | @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD})
36 | public @interface RelativeCoords {
37 | }
38 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/annotations/SectionCoords.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.annotations;
20 |
21 | import java.lang.annotation.*;
22 |
23 | /**
24 | * Marks that the {@link Integer} parameters of the annotated {@link java.lang.reflect.Constructor},
25 | * {@link java.lang.reflect.Method} or record parameters should be section coordinates.
26 | *
27 | * Section coordinates are basically zoomed out real coordinates. A good example that uses section
28 | * coordinates are BiomeSections, since biomes are saved in 4x4x4 block sections.
29 | *
30 | * To get the section coord from a block coordinate you do: {@code int sectionCoord = blockCoord >> 2;}
31 | *
32 | * @author Jake Nijssen
33 | * @since 0.3-Alpha
34 | */
35 | @Documented
36 | @Retention(RetentionPolicy.SOURCE)
37 | @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD})
38 | public @interface SectionCoords {
39 | }
40 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/math/Point2i.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.math;
20 |
21 | import org.jetbrains.annotations.Contract;
22 | import org.jetbrains.annotations.NotNull;
23 |
24 | public record Point2i(int x, int z) {
25 |
26 | public static final Point2i ZERO = new Point2i(0, 0);
27 |
28 | @Contract("_ -> new")
29 | public @NotNull Point2i setX(final int x) {
30 | return new Point2i(x, z);
31 | }
32 |
33 | @Contract("_ -> new")
34 | public @NotNull Point2i setZ(final int z) {
35 | return new Point2i(x, z);
36 | }
37 |
38 | @Contract(pure = true)
39 | public double distanceSq(@NotNull Point2i point) {
40 | return Math.pow(x - point.x, 2) + Math.pow(z - point.z, 2);
41 | }
42 |
43 | @Contract(pure = true)
44 | public double distance(@NotNull Point2i point) {
45 | return Math.sqrt(distanceSq(point));
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/math/Point3i.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.math;
20 |
21 | import org.jetbrains.annotations.Contract;
22 | import org.jetbrains.annotations.NotNull;
23 |
24 | public record Point3i(int x, int y, int z) {
25 |
26 | public static final Point3i ZERO = new Point3i(0, 0, 0);
27 |
28 | @Contract("_ -> new")
29 | public @NotNull Point3i setX(final int x) {
30 | return new Point3i(x, y, z);
31 | }
32 |
33 | @Contract("_ -> new")
34 | public @NotNull Point3i setY(final int y) {
35 | return new Point3i(x, y, z);
36 | }
37 |
38 | @Contract("_ -> new")
39 | public @NotNull Point3i setZ(final int z) {
40 | return new Point3i(x, y, z);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/maven/Dependencies.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.maven;
20 |
21 | import javax.annotation.Nonnull;
22 | import java.lang.annotation.Documented;
23 | import java.lang.annotation.ElementType;
24 | import java.lang.annotation.Retention;
25 | import java.lang.annotation.Target;
26 |
27 | /**
28 | * Annotation containing an array of {@link Dependency} for a plugin.
29 | */
30 | @Documented
31 | @Target(ElementType.TYPE)
32 | @Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
33 | public @interface Dependencies {
34 |
35 | /**
36 | * The {@link Dependency}s for the plugin.
37 | *
38 | * @return The {@link Dependency}s for the plugin.
39 | */
40 | @Nonnull
41 | Dependency[] value() default {};
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/maven/Dependency.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.maven;
20 |
21 | import javax.annotation.Nonnull;
22 | import java.lang.annotation.*;
23 |
24 | /**
25 | * Represents a dependency that a plugin requires to function.
26 | */
27 | @Documented
28 | @Repeatable(Dependencies.class)
29 | @Target(ElementType.TYPE)
30 | @Retention(RetentionPolicy.RUNTIME)
31 | public @interface Dependency {
32 | /**
33 | * The group ID of the dependency.
34 | *
35 | * @return The group ID of the dependency.
36 | */
37 | @Nonnull
38 | String group();
39 |
40 | /**
41 | * The artifact ID of the dependency.
42 | *
43 | * @return The artifact ID of the dependency.
44 | */
45 | @Nonnull
46 | String artifact();
47 |
48 | /**
49 | * The version of the dependency.
50 | *
51 | * @return The version of the dependency.
52 | */
53 | @Nonnull
54 | String version();
55 |
56 | /**
57 | * The repository of the dependency.
58 | *
59 | * @return The repository of the dependency.
60 | */
61 | @Nonnull
62 | Repository repository() default @Repository(url = "https://repo.maven.apache.org/maven2/");
63 |
64 | /**
65 | * The type of dependency.
66 | *
67 | * @return The type of dependency.
68 | */
69 | @Nonnull
70 | DependencyType type() default DependencyType.REQUIRED;
71 |
72 | /**
73 | * The type of dependency.
74 | */
75 | enum DependencyType {
76 | /**
77 | * A dependency that is required to function.
78 | */
79 | REQUIRED,
80 | /**
81 | * A dependency that is optional to function.
82 | */
83 | OPTIONAL
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/util/maven/Repository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.util.maven;
20 |
21 | import javax.annotation.Nonnull;
22 | import java.lang.annotation.*;
23 |
24 | /**
25 | * Representation of a repository.
26 | */
27 | @Documented
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Target(ElementType.LOCAL_VARIABLE)
30 | public @interface Repository {
31 |
32 | /**
33 | * The url of the repository.
34 | *
35 | * @return url of the repository
36 | */
37 | @Nonnull
38 | String url();
39 | }
40 |
--------------------------------------------------------------------------------
/orbis-core/src/main/java/com/azortis/orbis/world/WorldAccess.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.world;
20 |
21 | import com.azortis.orbis.entity.Player;
22 | import org.jetbrains.annotations.NotNull;
23 | import org.jetbrains.annotations.Unmodifiable;
24 |
25 | import java.util.Set;
26 | import java.util.concurrent.CompletableFuture;
27 |
28 | /**
29 | * Interface to interact with the platforms world.
30 | */
31 | public interface WorldAccess {
32 |
33 | @NotNull
34 | String name();
35 |
36 | boolean isWorldLoaded();
37 |
38 | int minHeight();
39 |
40 | int maxHeight();
41 |
42 | @Unmodifiable @NotNull Set getPlayers();
43 |
44 | boolean isChunkGenerated(int chunkX, int chunkZ);
45 |
46 | boolean isChunkLoaded(int chunkX, int chunkZ);
47 |
48 | @NotNull @Unmodifiable Set getLoadedChunks();
49 |
50 | @NotNull ChunkAccess getChunk(int chunkX, int chunkZ);
51 |
52 | default @NotNull CompletableFuture getChunkAsync(int chunkX, int chunkZ) {
53 | return CompletableFuture.supplyAsync(() -> getChunk(chunkX, chunkZ));
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/orbis-core/src/test/java/com/azortis/orbis/BlocksTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis;
20 |
21 | import org.junit.jupiter.api.Test;
22 |
23 | public class BlocksTest {
24 |
25 | @Test
26 | public void testBlocks() {
27 | /*Orbis.initialize(new MockPlatform());
28 | assertTrue(BlockRegistry.isLoaded());
29 | assertTrue(ItemRegistry.isLoaded());
30 | assertNotNull(Blocks.ACACIA_DOOR);
31 | assertSame(Properties.NOTE_BLOCK_INSTRUMENT.getValue("HARP"), NoteBlockInstrument.HARP);
32 | assertSame(Blocks.GRASS_BLOCK.defaultState().setValue(Properties.SNOWY, true), BlockRegistry.fromStateId(8));
33 | assertSame(Blocks.STONE.item(), Items.STONE);*/
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/orbis-generators/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | plugins {
20 | java
21 | application
22 | }
23 |
24 | group = "com.azortis"
25 | version = project(":orbis-core").version;
26 |
27 | application {
28 | mainClass.set("com.azortis.orbis.codegen.Generators")
29 | }
30 |
31 | repositories {
32 | mavenCentral()
33 | maven {
34 | url = uri("https://jitpack.io")
35 | }
36 | }
37 |
38 | dependencies {
39 | implementation(project(":orbis-core"))
40 | implementation("com.google.code.gson:gson:2.8.9")
41 | implementation("org.jetbrains:annotations:16.0.1")
42 | implementation("net.kyori:adventure-api:4.9.3")
43 | implementation("com.squareup:javapoet:1.13.0")
44 | implementation("com.google.guava:guava:31.0.1-jre")
45 | implementation("org.apache.logging.log4j:log4j-core:2.14.1")
46 | implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.14.1")
47 | implementation("it.unimi.dsi:fastutil:8.5.6")
48 | }
49 |
50 | java {
51 | toolchain {
52 | languageVersion.set(JavaLanguageVersion.of(17))
53 | }
54 | }
55 |
56 | tasks {
57 | run {
58 | run.get().setArgsString(
59 | "$" + project.rootProject.childProjects["orbis-core"]!!.projectDir.invariantSeparatorsPath +
60 | "/src/generated/java$"
61 | )
62 | }
63 | }
--------------------------------------------------------------------------------
/orbis-generators/src/main/java/com/azortis/orbis/codegen/Generators.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.codegen;
20 |
21 | import com.azortis.orbis.Orbis;
22 | import com.azortis.orbis.codegen.block.BlocksGenerator;
23 | import com.azortis.orbis.codegen.block.PropertiesGenerator;
24 | import org.slf4j.Logger;
25 | import org.slf4j.LoggerFactory;
26 |
27 | import java.io.File;
28 | import java.io.IOException;
29 | import java.io.InputStream;
30 | import java.net.URL;
31 |
32 | public final class Generators {
33 | private static final Logger LOGGER = LoggerFactory.getLogger(Generators.class);
34 | private static final String BASE_ARTIC_DATA_URL = "https://raw.githubusercontent.com/Articdive/ArticData/" +
35 | Orbis.MC_VERSION.replace("_", ".") + "/";
36 |
37 | public static void main(String[] args) {
38 | StringBuilder outputBuilder = new StringBuilder();
39 | for (String arg : args) {
40 | if (arg.startsWith("$") || arg.endsWith("$")) {
41 | outputBuilder.append(arg.replace("$", ""));
42 | }
43 | outputBuilder.append(" ");
44 | }
45 | final File outputFolder = new File(outputBuilder.toString().trim());
46 | new PropertiesGenerator(getInputStream("block_properties.json"), outputFolder).generate();
47 | new BlocksGenerator(getInputStream("blocks.json"), outputFolder).generate();
48 | }
49 |
50 | private static InputStream getInputStream(String fileName) {
51 | try {
52 | return new URL(BASE_ARTIC_DATA_URL + Orbis.MC_VERSION + "_" + fileName).openStream();
53 | } catch (IOException ex) {
54 | LOGGER.error("Failed to create InputStream for " + fileName);
55 | }
56 | return null;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/orbis-generators/src/main/java/com/azortis/orbis/codegen/OrbisCodeGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.codegen;
20 |
21 | import com.google.gson.Gson;
22 | import com.google.gson.GsonBuilder;
23 | import com.squareup.javapoet.JavaFile;
24 | import org.jetbrains.annotations.NotNull;
25 | import org.slf4j.Logger;
26 | import org.slf4j.LoggerFactory;
27 |
28 | import java.io.File;
29 | import java.io.IOException;
30 | import java.io.InputStream;
31 | import java.util.List;
32 | import java.util.Locale;
33 |
34 | public abstract class OrbisCodeGenerator {
35 | protected static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
36 | private static final Logger LOGGER = LoggerFactory.getLogger(OrbisCodeGenerator.class);
37 | protected final InputStream inputStream;
38 | protected final File outputFolder;
39 |
40 | public OrbisCodeGenerator(InputStream inputStream, File outputFolder) {
41 | this.inputStream = inputStream;
42 | this.outputFolder = outputFolder;
43 | }
44 |
45 | public abstract void generate();
46 |
47 | protected void writeFiles(@NotNull List files) {
48 | for (JavaFile javaFile : files) {
49 | try {
50 | javaFile.writeTo(this.outputFolder);
51 | } catch (IOException ex) {
52 | LOGGER.error("An error occurred while trying to write source code to the filesystem.");
53 | }
54 | }
55 | }
56 |
57 | private String toConstant(String namespaceId) {
58 | return namespaceId.replace("minecraft:", "").toUpperCase(Locale.ENGLISH);
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/orbis-paper/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | plugins {
20 | java
21 | id("com.github.johnrengelman.shadow") version "7.1.2"
22 | id("io.papermc.paperweight.userdev") version "1.5.9"
23 | }
24 |
25 | group = "com.azortis"
26 | version = project(":orbis-core").version
27 |
28 | repositories {
29 | mavenCentral()
30 | maven {
31 | url = uri("https://papermc.io/repo/repository/maven-public/")
32 | }
33 | maven {
34 | url = uri("https://libraries.minecraft.net")
35 | }
36 | maven {
37 | url = uri("https://jitpack.io")
38 | }
39 | }
40 |
41 | dependencies {
42 | implementation(project(":orbis-core"))
43 | paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT")
44 |
45 | // Compile
46 | compileOnly("net.kyori:adventure-nbt:4.14.0")
47 | compileOnly("cloud.commandframework:cloud-paper:1.8.4")
48 | compileOnly("cloud.commandframework:cloud-minecraft-extras:1.8.4")
49 | }
50 |
51 | java {
52 | toolchain.languageVersion.set(JavaLanguageVersion.of(17))
53 | }
54 |
55 | tasks {
56 | assemble {
57 | dependsOn(reobfJar)
58 | }
59 | compileJava {
60 | options.encoding = Charsets.UTF_8.name()
61 | options.release.set(17)
62 | }
63 | javadoc {
64 | options.encoding = Charsets.UTF_8.name()
65 | }
66 | processResources {
67 | filteringCharset = Charsets.UTF_8.name()
68 | filesMatching("paper-plugin.yml") {
69 | expand(Pair("version", project.version))
70 | }
71 | }
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/OrbisBootstrap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper;
20 |
21 | import io.papermc.paper.plugin.bootstrap.BootstrapContext;
22 | import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
23 | import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
24 | import org.jetbrains.annotations.NotNull;
25 |
26 | @SuppressWarnings("UnstableApiUsage")
27 | public final class OrbisBootstrap implements PluginBootstrap {
28 |
29 | @Override
30 | public void bootstrap(@NotNull BootstrapContext context) {
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/PaperSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper;
20 |
21 | import com.azortis.orbis.Settings;
22 |
23 | public class PaperSettings extends Settings {
24 |
25 | public PaperSettings(Settings settings) {
26 | super(settings);
27 | }
28 |
29 | public static PaperSettings defaultSettings() {
30 | return new PaperSettings(Settings.defaultSettings());
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/block/entity/PaperBlockEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.block.entity;
20 |
21 | import com.azortis.orbis.block.entity.BlockEntity;
22 | import com.azortis.orbis.util.BlockPos;
23 | import net.kyori.adventure.key.Key;
24 | import net.kyori.adventure.nbt.CompoundBinaryTag;
25 | import net.minecraft.world.level.block.entity.BlockEntityType;
26 | import org.jetbrains.annotations.NotNull;
27 |
28 | import java.util.Objects;
29 |
30 | public class PaperBlockEntity implements BlockEntity {
31 | private final net.minecraft.world.level.block.entity.BlockEntity handle;
32 | private final Key key;
33 | private final BlockPos blockPos;
34 |
35 | @SuppressWarnings("PatternValidation")
36 | public PaperBlockEntity(net.minecraft.world.level.block.entity.BlockEntity handle) {
37 | this.handle = handle;
38 | this.key = Key.key(Objects.requireNonNull(BlockEntityType.getKey(handle.getType())).toString());
39 | this.blockPos = new BlockPos(handle.getBlockPos().getX(), handle.getBlockPos().getY(), handle.getBlockPos().getZ());
40 | }
41 |
42 | @Override
43 | public final @NotNull Key key() {
44 | return key;
45 | }
46 |
47 | @Override
48 | public final int x() {
49 | return blockPos.x();
50 | }
51 |
52 | @Override
53 | public final int y() {
54 | return blockPos.y();
55 | }
56 |
57 | @Override
58 | public final int z() {
59 | return blockPos.z();
60 | }
61 |
62 | @Override
63 | public final @NotNull BlockPos blockPos() {
64 | return blockPos;
65 | }
66 |
67 | @Override
68 | public @NotNull CompoundBinaryTag toNBT() {
69 | return null;
70 | }
71 |
72 | public net.minecraft.world.level.block.entity.BlockEntity getHandle() {
73 | return handle;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/block/entity/PaperCampfireEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.block.entity;
20 |
21 | import net.minecraft.world.level.block.entity.CampfireBlockEntity;
22 |
23 | public class PaperCampfireEntity {
24 | private final CampfireBlockEntity handle;
25 |
26 | public PaperCampfireEntity(CampfireBlockEntity handle) {
27 | this.handle = handle;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/block/entity/PaperMobSpawnerEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.block.entity;
20 |
21 | import com.azortis.orbis.block.entity.MobSpawnerEntity;
22 | import net.minecraft.world.level.BaseSpawner;
23 | import net.minecraft.world.level.block.entity.BlockEntity;
24 | import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
25 |
26 | public class PaperMobSpawnerEntity extends PaperBlockEntity implements MobSpawnerEntity {
27 | private final BaseSpawner spawner;
28 |
29 | public PaperMobSpawnerEntity(BlockEntity handle) {
30 | super(handle);
31 | this.spawner = ((SpawnerBlockEntity) handle).getSpawner();
32 | }
33 |
34 | @Override
35 | public int getDelay() {
36 | return spawner.spawnDelay;
37 | }
38 |
39 | @Override
40 | public void setDelay(int delay) {
41 | spawner.spawnDelay = delay;
42 | }
43 |
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/generator/PaperBiomeProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.generator;
20 |
21 | import net.kyori.adventure.key.Key;
22 | import org.bukkit.block.Biome;
23 | import org.bukkit.generator.BiomeProvider;
24 | import org.bukkit.generator.WorldInfo;
25 | import org.jetbrains.annotations.NotNull;
26 |
27 | import java.util.List;
28 | import java.util.Locale;
29 | import java.util.stream.Collectors;
30 |
31 | public final class PaperBiomeProvider extends BiomeProvider {
32 |
33 | private final PaperChunkGenerator chunkGenerator;
34 |
35 | public PaperBiomeProvider(PaperChunkGenerator chunkGenerator) {
36 | this.chunkGenerator = chunkGenerator;
37 | }
38 |
39 | @Override
40 | public @NotNull Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
41 | return null;
42 | }
43 |
44 | @Override
45 | public @NotNull List getBiomes(@NotNull WorldInfo worldInfo) {
46 | return null;
47 | }
48 |
49 |
50 |
51 | /*@Override
52 | public @NotNull Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
53 | if (chunkGenerator.requiresLoading()) chunkGenerator.load(worldInfo);
54 | return Biome.valueOf(chunkGenerator.getWorld().getDimension().distributor()
55 | .getBiome(x, y, z).derivative().value().toUpperCase(Locale.ROOT));
56 | }
57 |
58 | @Override
59 | public @NotNull List getBiomes(@NotNull WorldInfo worldInfo) {
60 | if (chunkGenerator.requiresLoading()) chunkGenerator.load(worldInfo);
61 | return chunkGenerator.getWorld().getDimension().distributor().biomes()
62 | .stream().map(com.azortis.orbis.generator.biome.Biome::derivative).map(Key::value)
63 | .map(String::toUpperCase).map(Biome::valueOf).collect(Collectors.toList());
64 | }*/
65 | }
66 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/generator/PaperWorldSnapshot.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.generator;
20 |
21 | import com.azortis.orbis.generator.Dimension;
22 | import com.azortis.orbis.generator.framework.Engine;
23 | import com.azortis.orbis.generator.framework.WorldSnapshot;
24 | import com.azortis.orbis.world.World;
25 | import org.jetbrains.annotations.NotNull;
26 |
27 | public final class PaperWorldSnapshot extends WorldSnapshot {
28 |
29 | private final org.bukkit.World handle;
30 |
31 | public PaperWorldSnapshot(@NotNull World world, @NotNull Dimension dimension,
32 | @NotNull Engine engine, @NotNull org.bukkit.World handle) {
33 | super(world, dimension, engine);
34 | this.handle = handle;
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/studio/PaperStudioBiomeProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.studio;
20 |
21 | import com.azortis.orbis.pack.studio.Project;
22 | import net.kyori.adventure.key.Key;
23 | import org.bukkit.block.Biome;
24 | import org.bukkit.generator.BiomeProvider;
25 | import org.bukkit.generator.WorldInfo;
26 | import org.jetbrains.annotations.NotNull;
27 |
28 | import java.util.Collections;
29 | import java.util.List;
30 | import java.util.Locale;
31 | import java.util.stream.Collectors;
32 |
33 | public final class PaperStudioBiomeProvider extends BiomeProvider {
34 |
35 | private final PaperStudioChunkGenerator chunkGenerator;
36 | private final Project project;
37 |
38 | public PaperStudioBiomeProvider(PaperStudioChunkGenerator chunkGenerator, Project project) {
39 | this.chunkGenerator = chunkGenerator;
40 | this.project = project;
41 | }
42 |
43 | @Override
44 | public @NotNull Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
45 | if (chunkGenerator.requiresLoading()) chunkGenerator.load(worldInfo);
46 | if (!project.studioWorld().shouldRender()) return Biome.PLAINS;
47 | return Biome.valueOf(project.studioWorld().getDimension().distributor()
48 | .getBiome(x, y, z).derivative().value().toUpperCase(Locale.ROOT));
49 | }
50 |
51 | @Override
52 | public @NotNull List getBiomes(@NotNull WorldInfo worldInfo) {
53 | if (chunkGenerator.requiresLoading()) chunkGenerator.load(worldInfo);
54 | if (!project.studioWorld().shouldRender()) return Collections.singletonList(Biome.PLAINS);
55 | return project.studioWorld().getDimension().distributor().biomes()
56 | .stream().map(com.azortis.orbis.generator.biome.Biome::derivative).map(Key::value)
57 | .map(String::toUpperCase).map(Biome::valueOf).collect(Collectors.toList());
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/world/PaperChunkAccess.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.world;
20 |
21 | public final class PaperChunkAccess {
22 | }
23 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/world/PaperNativeHeightMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.world;
20 |
21 | import com.azortis.orbis.world.Heightmap;
22 | import net.kyori.adventure.key.Key;
23 | import org.jetbrains.annotations.NotNull;
24 |
25 | public record PaperNativeHeightMap(@NotNull Key type, @NotNull net.minecraft.world.level.levelgen.Heightmap handle,
26 | int chunkX, int chunkZ) implements Heightmap {
27 |
28 | @Override
29 | public boolean isPersistent() {
30 | return false; // These are persisted any way.
31 | }
32 |
33 | @Override
34 | public int getFirstAvailable(int x, int z) {
35 | return handle.getFirstAvailable(x, z);
36 | }
37 |
38 | @Override
39 | public int getHighestTaken(int x, int z) {
40 | return handle.getHighestTaken(x, z);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/java/com/azortis/orbis/paper/world/PaperRegionAccess.java:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2022 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | package com.azortis.orbis.paper.world;
20 |
21 | public final class PaperRegionAccess {
22 | }
23 |
--------------------------------------------------------------------------------
/orbis-paper/src/main/resources/paper-plugin.yml:
--------------------------------------------------------------------------------
1 | name: Orbis
2 | version: '${version}'
3 | api-version: '1.19'
4 | author: YourPalJake
5 | description: Data driven world generation that enhances the gameplay of your server.
6 | main: com.azortis.orbis.paper.OrbisPlugin
7 | bootstrapper: com.azortis.orbis.paper.OrbisBootstrap
--------------------------------------------------------------------------------
/orbis-paper/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | name: Orbis
2 | author: YourPalJake
3 | version: ${version}
4 | api-version: 1.19
5 | main: com.azortis.orbis.paper.OrbisPlugin
6 | load: STARTUP
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * A dynamic data-driven world generator plugin/library for Minecraft servers.
3 | * Copyright (C) 2023 Azortis
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | /*
20 | * This file was generated by the Gradle 'init' task.
21 | */
22 | rootProject.name = "Orbis"
23 | include("orbis-core")
24 | include("orbis-paper")
25 | include("orbis-generators")
26 | include("orbis-cli")
27 |
--------------------------------------------------------------------------------