Skip to content

Commit 4eb8ba0

Browse files
committed
Rename level and leveldata modules according to Mojmap
1 parent 9214ea6 commit 4eb8ba0

58 files changed

Lines changed: 705 additions & 475 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class IncrementingIntComponent implements IntComponent, ServerTickingComponent {
152152
```
153153

154154
*Serverside ticking is implemented for all providers.
155-
Clientside ticking is only implemented for entities, block entities, worlds, and scoreboards/teams.*
155+
Clientside ticking is only implemented for entities, block entities, levels, and scoreboards/teams.*
156156

157157
If you want your component to **be notified of its provider being loaded and unloaded**, typically for advanced setup or cleanup,
158158
you can add the [`ServerLoadAwareComponent`](./cardinal-components-base/src/main/java/org/ladysnake/cca/api/v3/component/load/ServerLoadAwareComponent.java)
@@ -169,7 +169,7 @@ class IncrementingIntComponent implements IntComponent, ServerLoadAwareComponent
169169
}
170170
```
171171

172-
*Serverside load and unload is implemented for entities, block entities, chunks, worlds, and scoreboards.
172+
*Serverside load and unload is implemented for entities, block entities, chunks, levels, and scoreboards.
173173
Clientside load and unload is only implemented for entities, block entities, and chunks. This is an experimental feature,
174174
any feedback welcome.*
175175

@@ -204,15 +204,15 @@ The next step is to choose an identifier for your component, and to declare it a
204204

205205
Components can be provided by objects of various classes, depending on which modules you installed.
206206
The most common providers are [entities](https://ladysnake.org/wiki/cardinal-components-api/modules/entity),
207-
[worlds](https://ladysnake.org/wiki/cardinal-components-api/modules/world)
207+
[levels](https://ladysnake.org/wiki/cardinal-components-api/modules/world) (previously called `world`)
208208
and [chunks](https://ladysnake.org/wiki/cardinal-components-api/modules/chunk),
209209
but more are available.
210210
To interact with them, you need to **register a component key**, using `ComponentRegistryV3#getOrCreate`;
211211
the resulting `ComponentKey` instance has the query methods you need. You will also need to **attach your
212-
component** to some providers (here, to players and worlds):
212+
component** to some providers (here, to players and levels):
213213

214214
```java
215-
public final class MyComponents implements EntityComponentInitializer, WorldComponentInitializer {
215+
public final class MyComponents implements EntityComponentInitializer, LevelComponentInitializer {
216216
public static final ComponentKey<IntComponent> MAGIK =
217217
ComponentRegistryV3.INSTANCE.getOrCreate(Identifier.of("mymod:magik"), IntComponent.class);
218218

@@ -223,9 +223,9 @@ public final class MyComponents implements EntityComponentInitializer, WorldComp
223223
}
224224

225225
@Override
226-
public void registerWorldComponentFactories(WorldComponentFactoryRegistry registry) {
227-
// Add the component to every World instance
228-
registry.register(MAGIK, world -> new RandomIntComponent());
226+
public void registerLevelComponentFactories(LevelComponentFactoryRegistry registry) {
227+
// Add the component to every Level instance
228+
registry.register(MAGIK, level -> new RandomIntComponent());
229229
}
230230
}
231231
```

cardinal-components-base/src/main/resources/fabric.mod.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
"fabric-api-base": ">=0.1.2"
2828
},
2929
"breaks": {
30-
"cardinal-components-block": "<6.0.0-beta.2",
31-
"cardinal-components-chunk": "<6.0.0-beta.2",
32-
"cardinal-components-entity": "<6.0.0-beta.2",
33-
"cardinal-components-level": "<6.0.0-beta.2",
34-
"cardinal-components-scoreboard": "<6.0.0-beta.2",
35-
"cardinal-components-world": "<6.0.0-beta.2"
30+
"cardinal-components-block": "<8.0.0-",
31+
"cardinal-components-chunk": "<8.0.0-",
32+
"cardinal-components-entity": "<8.0.0-",
33+
"cardinal-components-level": "<8.0.0-",
34+
"cardinal-components-scoreboard": "<8.0.0-",
35+
"cardinal-components-world": "<8.0.0-"
3636
},
3737
"authors": [
3838
{

cardinal-components-world/build.gradle.kts renamed to cardinal-components-level/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,19 @@ dependencies {
66
localRuntime(fabricApi.module("fabric-gametest-api-v1", project.properties["fabric_api_version"].toString()))
77
testmodImplementation(rootProject.project(":cardinal-components-base").sourceSets.testmod.get().output)
88
}
9+
10+
extensions.configure(PublishingExtension::class.java) {
11+
publications {
12+
create("relocationWorld", MavenPublication::class.java) {
13+
artifactId = "cardinal-components-world"
14+
pom {
15+
distributionManagement {
16+
relocation {
17+
artifactId = "cardinal-components-level"
18+
message = "Module renamed to match Mojang official names"
19+
}
20+
}
21+
}
22+
}
23+
}
24+
}

cardinal-components-level/src/main/java/org/ladysnake/cca/api/v3/level/LevelComponentFactoryRegistry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
import org.ladysnake.cca.api.v8.component.CardinalComponent;
2929

3030
/**
31-
* @since 2.4.0
31+
* @deprecated renamed to {@code LevelDataComponentFactoryRegistry} in the module {@code cardinal-components-leveldata}
3232
*/
33+
@Deprecated(since = "8.0.0", forRemoval = true)
3334
public interface LevelComponentFactoryRegistry {
3435
/**
3536
* Registers a {@link ComponentFactory} for {@link LevelData}.

cardinal-components-level/src/main/java/org/ladysnake/cca/api/v3/level/LevelComponentInitializer.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,12 @@
2222
*/
2323
package org.ladysnake.cca.api.v3.level;
2424

25-
import net.fabricmc.api.ModInitializer;
26-
import net.minecraft.world.level.storage.LevelData;
2725
import org.ladysnake.cca.internal.base.ComponentRegistrationInitializer;
2826

2927
/**
30-
* Entrypoint getting invoked to register <em>static</em> item component factories.
31-
*
32-
* <p>The entrypoint is exposed as either {@code "cardinal-components"} or {@code "cardinal-components-level"} in the mod json and runs for any environment.
33-
* It usually executes right during {@linkplain ModInitializer mod init}, or before the first {@linkplain LevelData save properties object} gets loaded, whichever comes first.
34-
*
35-
* @since 2.4.0
28+
* @deprecated renamed to {@code LevelDataComponentInitializer} in the module {@code cardinal-components-leveldata}
3629
*/
30+
@Deprecated(since = "8.0.0", forRemoval = true)
3731
public interface LevelComponentInitializer extends ComponentRegistrationInitializer {
38-
/**
39-
* Called to register component factories for statically declared component types.
40-
*
41-
* <p><strong>The passed registry must not be held onto!</strong> Static component factories
42-
* must not be registered outside of this method.
43-
*
44-
* @param registry a {@link LevelComponentFactoryRegistry} for <em>statically declared</em> components
45-
*/
46-
void registerLevelComponentFactories(LevelComponentFactoryRegistry registry);
32+
void registerLevelDataComponentFactories(LevelComponentFactoryRegistry registry);
4733
}

cardinal-components-level/src/main/java/org/ladysnake/cca/api/v3/level/LevelComponents.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
import java.util.NoSuchElementException;
3636

3737
/**
38-
* Static helper methods for components attached to {@link LevelData}
38+
* @deprecated renamed to {@code LevelDataComponents} in the module {@code cardinal-components-leveldata}
3939
*/
40+
@Deprecated(since = "8.0.0", forRemoval = true)
4041
public final class LevelComponents {
4142
/**
4243
* Attempts to synchronize the component attached to the main {@link LevelData} of the given {@link MinecraftServer}.

cardinal-components-world/src/main/java/org/ladysnake/cca/api/v3/world/WorldComponentFactoryRegistry.java renamed to cardinal-components-level/src/main/java/org/ladysnake/cca/api/v8/level/LevelComponentFactoryRegistry.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
23-
package org.ladysnake.cca.api.v3.world;
23+
package org.ladysnake.cca.api.v8.level;
2424

2525
import net.minecraft.resources.ResourceKey;
2626
import net.minecraft.world.level.Level;
@@ -29,11 +29,11 @@
2929
import org.ladysnake.cca.api.v8.component.CardinalComponent;
3030

3131
/**
32-
* @since 2.4.0
32+
* @since 8.0.0
3333
*/
34-
public interface WorldComponentFactoryRegistry {
34+
public interface LevelComponentFactoryRegistry {
3535
/**
36-
* Registers a {@link ComponentFactory} for all {@linkplain Level worlds}.
36+
* Registers a {@link ComponentFactory} for all {@linkplain Level levels}.
3737
*
3838
* <p>If the component's actual implementation has different capabilities to {@code C}
3939
* (typically if it is ticking and {@code C} is not), one should use the {@linkplain #register(ComponentKey, Class, ComponentFactory) dedicated overload}.
@@ -43,14 +43,14 @@ public interface WorldComponentFactoryRegistry {
4343
<C extends CardinalComponent> void register(ComponentKey<C> type, ComponentFactory<Level, ? extends C> factory);
4444

4545
/**
46-
* Registers a {@link ComponentFactory} for all {@link Level worlds}, specifying which implementation of the component interface is used.
46+
* Registers a {@link ComponentFactory} for all {@link Level levels}, specifying which implementation of the component interface is used.
4747
*
4848
* @param factory the factory to use to create components of the given type
4949
*/
5050
<C extends CardinalComponent> void register(ComponentKey<? super C> type, Class<C> impl, ComponentFactory<Level, ? extends C> factory);
5151

5252
/**
53-
* Registers a {@link ComponentFactory} only for {@linkplain Level worlds} with the given {@code dimensionId}.
53+
* Registers a {@link ComponentFactory} only for {@linkplain Level levels} with the given {@code dimensionId}.
5454
*
5555
* <p>If the component's actual implementation has different capabilities to {@code C}
5656
* (typically if it is ticking and {@code C} is not), one should use the {@linkplain #registerFor(ResourceKey, ComponentKey, Class, ComponentFactory) dedicated overload}.
@@ -61,7 +61,7 @@ public interface WorldComponentFactoryRegistry {
6161
<C extends CardinalComponent> void registerFor(ResourceKey<Level> dimensionId, ComponentKey<C> type, ComponentFactory<Level, ? extends C> factory);
6262

6363
/**
64-
* Registers a {@link ComponentFactory} only for {@linkplain Level worlds} with the given {@code dimensionId},
64+
* Registers a {@link ComponentFactory} only for {@linkplain Level levels} with the given {@code dimensionId},
6565
* specifying which implementation of the component interface is used.
6666
*
6767
* @param factory the factory to use to create components of the given type

cardinal-components-world/src/main/java/org/ladysnake/cca/api/v3/world/WorldComponentInitializer.java renamed to cardinal-components-level/src/main/java/org/ladysnake/cca/api/v8/level/LevelComponentInitializer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
23-
package org.ladysnake.cca.api.v3.world;
23+
package org.ladysnake.cca.api.v8.level;
2424

2525
import net.fabricmc.api.ModInitializer;
2626
import net.minecraft.world.level.Level;
2727
import org.ladysnake.cca.internal.base.ComponentRegistrationInitializer;
2828

2929
/**
30-
* Entrypoint getting invoked to register <em>static</em> world component factories.
30+
* Entrypoint getting invoked to register <em>static</em> level component factories.
3131
*
32-
* <p>The entrypoint is exposed as either {@code "cardinal-components"} or {@code "cardinal-components-world"} in the mod json and runs for any environment.
32+
* <p>The entrypoint is exposed as either {@code "cardinal-components"} or {@code "cardinal-components-level"} in the mod json and runs for any environment.
3333
* It usually executes during {@linkplain ModInitializer mod init}, or right before the first {@link Level} instance is created, whichever comes first.
3434
*
35-
* @since 2.4.0
35+
* @since 8.0.0
3636
*/
37-
public interface WorldComponentInitializer extends ComponentRegistrationInitializer {
38-
void registerWorldComponentFactories(WorldComponentFactoryRegistry registry);
37+
public interface LevelComponentInitializer extends ComponentRegistrationInitializer {
38+
void registerLevelComponentFactories(LevelComponentFactoryRegistry registry);
3939
}

cardinal-components-world/src/main/java/org/ladysnake/cca/api/v3/world/WorldSyncCallback.java renamed to cardinal-components-level/src/main/java/org/ladysnake/cca/api/v8/level/LevelSyncCallback.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,26 @@
2020
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
2121
* OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
23-
package org.ladysnake.cca.api.v3.world;
23+
package org.ladysnake.cca.api.v8.level;
2424

2525
import net.fabricmc.fabric.api.event.Event;
2626
import net.fabricmc.fabric.api.event.EventFactory;
2727
import net.minecraft.server.level.ServerLevel;
2828
import net.minecraft.server.level.ServerPlayer;
2929

3030
/**
31-
* Callback interface to receive world synchronization events.
31+
* Callback interface to receive level synchronization events.
3232
*/
3333
@FunctionalInterface
34-
public interface WorldSyncCallback {
35-
Event<WorldSyncCallback> EVENT = EventFactory.createArrayBacked(WorldSyncCallback.class, (p, e) -> {}, listeners -> (player, world) -> {
36-
for (WorldSyncCallback callback : listeners) {
37-
callback.onPlayerStartTracking(player, world);
34+
public interface LevelSyncCallback {
35+
Event<LevelSyncCallback> EVENT = EventFactory.createArrayBacked(LevelSyncCallback.class, (p, e) -> {}, listeners -> (player, level) -> {
36+
for (LevelSyncCallback callback : listeners) {
37+
callback.onPlayerStartTracking(player, level);
3838
}
3939
});
4040

4141
/**
42-
* Called when a player starts tracking a world (eg. by joining it).
42+
* Called when a player starts tracking a level (eg. by joining it).
4343
*/
44-
void onPlayerStartTracking(ServerPlayer player, ServerLevel world);
44+
void onPlayerStartTracking(ServerPlayer player, ServerLevel level);
4545
}

cardinal-components-world/src/main/java/org/ladysnake/cca/api/v3/world/package-info.java renamed to cardinal-components-level/src/main/java/org/ladysnake/cca/api/v8/level/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
@MethodsReturnNonnullByDefault
2424
@ParametersAreNonnullByDefault
25-
package org.ladysnake.cca.api.v3.world;
25+
package org.ladysnake.cca.api.v8.level;
2626

2727
import org.ladysnake.cca.api.v3.util.MethodsReturnNonnullByDefault;
2828

0 commit comments

Comments
 (0)