diff --git a/src/main/java/com/falsepattern/chunk/api/ArrayUtil.java b/src/main/java/com/falsepattern/chunk/api/ArrayUtil.java index 04c7897..36faedf 100644 --- a/src/main/java/com/falsepattern/chunk/api/ArrayUtil.java +++ b/src/main/java/com/falsepattern/chunk/api/ArrayUtil.java @@ -22,7 +22,7 @@ package com.falsepattern.chunk.api; -import com.falsepattern.lib.StableAPI; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Contract; import net.minecraft.world.chunk.NibbleArray; @@ -33,11 +33,13 @@ import java.util.Arrays; * This is an API class covered by the additional permissions in the license. *
* Miscellaneous utilities for in-place array transfer (where possible).
+ * @version 0.5.0
+ * @since 0.5.0
*/
-@StableAPI(since = "0.5.0")
+@ApiStatus.NonExtendable
+@SuppressWarnings("DuplicatedCode")
public class ArrayUtil {
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -52,7 +54,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -67,7 +68,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -82,7 +82,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -97,7 +96,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -112,7 +110,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -127,7 +124,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -142,7 +138,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -157,7 +152,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
@@ -172,7 +166,6 @@ public class ArrayUtil {
return dst;
}
- @StableAPI.Expose
@Contract(value = "null, _ -> null;" +
"!null, null -> new;",
mutates = "param2")
diff --git a/src/main/java/com/falsepattern/chunk/api/DataManager.java b/src/main/java/com/falsepattern/chunk/api/DataManager.java
index de80215..45c75b6 100644
--- a/src/main/java/com/falsepattern/chunk/api/DataManager.java
+++ b/src/main/java/com/falsepattern/chunk/api/DataManager.java
@@ -22,7 +22,6 @@
package com.falsepattern.chunk.api;
-import com.falsepattern.lib.StableAPI;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,20 +50,17 @@ import java.nio.ByteBuffer;
* @see DataRegistry
* @since 0.5.0
*/
-@StableAPI(since = "0.5.0")
public interface DataManager {
/**
* @return The domain of this manager. Usually the modid of the mod that owns this manager.
*/
- @StableAPI.Expose
@Contract(pure = true)
String domain();
/**
* @return The id of this manager. Usually the name of the manager. Unique per domain.
*/
- @StableAPI.Expose
@Contract(pure = true)
String id();
@@ -72,10 +68,8 @@ public interface DataManager {
* Implement this interface if you want to synchronize your data with the client.
*
* @author FalsePattern
- * @version 0.5.0
* @since 0.5.0
*/
- @StableAPI(since = "0.5.0")
interface PacketDataManager extends DataManager {
/**
* @return The maximum amount of bytes your data can take up in a packet.
@@ -83,7 +77,6 @@ public interface DataManager {
* @implSpec This is used to determine the size of the packet compression/decompression buffer.
* Only called ONCE, during registration!
*/
- @StableAPI.Expose
@Contract(pure = true)
int maxPacketSize();
@@ -93,7 +86,6 @@ public interface DataManager {
* @param chunk The chunk to serialize.
*/
@Contract(mutates = "param4")
- @StableAPI.Expose
void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer);
/**
@@ -103,7 +95,6 @@ public interface DataManager {
* @param buffer The packet buffer to read from.
*/
@Contract(mutates = "param1,param4")
- @StableAPI.Expose
void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer);
}
@@ -115,28 +106,23 @@ public interface DataManager {
* @version 0.6.0
* @since 0.6.0
*/
- @StableAPI(since = "0.6.0")
interface BlockPacketDataManager extends DataManager {
@Contract(mutates = "param1")
- @StableAPI.Expose
void writeBlockToPacket(Chunk chunk, int x, int y, int z, S23PacketBlockChange packet);
@Contract(mutates = "param1,param5")
- @StableAPI.Expose
void readBlockFromPacket(Chunk chunk, int x, int y, int z, S23PacketBlockChange packet);
/**
* Serializes your block data into a buffer.
*/
@Contract(mutates = "param2")
- @StableAPI.Expose
void writeBlockPacketToBuffer(S23PacketBlockChange packet, PacketBuffer buffer) throws IOException;
/**
* Deserializes your block data from a buffer.
*/
@Contract(mutates = "param1,param2")
- @StableAPI.Expose
void readBlockPacketFromBuffer(S23PacketBlockChange packet, PacketBuffer buffer) throws IOException;
}
@@ -148,12 +134,10 @@ public interface DataManager {
* @version 0.5.0
* @since 0.5.0
*/
- @StableAPI(since = "0.5.0")
interface StorageDataManager extends DataManager {
/**
* @return The current version of the data manager
*/
- @StableAPI.Expose
@Contract(pure = true)
@NotNull String version();
@@ -161,7 +145,6 @@ public interface DataManager {
* @return The message to show to users when a world is opened with this mod for the first time.
* Return null to show no message, and treat the manager as fully compatible with vanilla.
*/
- @StableAPI.Expose
@Contract(pure = true)
@Nullable String newInstallDescription();
@@ -169,7 +152,6 @@ public interface DataManager {
* @return The message to show to users when this manager is removed, AND they try to load the world (stored in the
* world's NBT during previous saves)
*/
- @StableAPI.Expose
@Contract(pure = true)
@NotNull String uninstallMessage();
@@ -179,7 +161,6 @@ public interface DataManager {
* @return A warning message to show to the user when upgrading.\
* If null, the manager is treated as fully compatible with the old version, and no warning is shown.
*/
- @StableAPI.Expose
@Contract(pure = true)
@Nullable String versionChangeMessage(String priorVersion);
}
@@ -191,7 +172,6 @@ public interface DataManager {
* @version 0.5.0
* @since 0.5.0
*/
- @StableAPI(since = "0.5.0")
interface ChunkDataManager extends StorageDataManager {
/**
* If false, the given nbt compound will be a freshly created object that gets inserted into the actual
@@ -201,7 +181,6 @@ public interface DataManager {
*
* @implNote This is used internally for reimplementing the vanilla logic. Only change this if you know what you're doing.
*/
- @StableAPI.Expose
@Contract(pure = true)
default boolean chunkPrivilegedAccess() {
return false;
@@ -211,7 +190,6 @@ public interface DataManager {
* Serializes your data into an NBT tag. This is used when saving the chunk to disk.
*/
@Contract(mutates = "param2")
- @StableAPI.Expose
void writeChunkToNBT(Chunk chunk, NBTTagCompound nbt);
@@ -222,7 +200,6 @@ public interface DataManager {
* In this case, you should initialize the data to a sane default.
*/
@Contract(mutates = "param1")
- @StableAPI.Expose
void readChunkFromNBT(Chunk chunk, NBTTagCompound nbt);
/**
@@ -232,7 +209,6 @@ public interface DataManager {
* @param to The chunk to copy data to.
*/
@Contract(mutates = "param2")
- @StableAPI.Expose
void cloneChunk(Chunk from, Chunk to);
}
@@ -244,7 +220,6 @@ public interface DataManager {
* @version 0.5.0
* @since 0.5.0
*/
- @StableAPI(since = "0.5.0")
interface SubChunkDataManager extends StorageDataManager {
/**
* If false, the given nbt compound will be a freshly created object that gets inserted into the actual
@@ -254,7 +229,6 @@ public interface DataManager {
*
* @implNote This is used internally for reimplementing the vanilla logic. Only change this if you know what you're doing.
*/
- @StableAPI.Expose
@Contract(pure = true)
default boolean subChunkPrivilegedAccess() {
return false;
@@ -264,7 +238,6 @@ public interface DataManager {
* Serializes your data into an NBT tag. This is used when saving the chunk to disk.
*/
@Contract(mutates = "param3")
- @StableAPI.Expose
void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunk, NBTTagCompound nbt);
/**
@@ -274,7 +247,6 @@ public interface DataManager {
* In this case, you should initialize the data to a sane default.
*/
@Contract(mutates = "param2")
- @StableAPI.Expose
void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunk, NBTTagCompound nbt);
/**
@@ -285,7 +257,6 @@ public interface DataManager {
* @param to The subChunk to copy data to.
*/
@Contract(mutates = "param3")
- @StableAPI.Expose
void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage from, ExtendedBlockStorage to);
}
}
diff --git a/src/main/java/com/falsepattern/chunk/api/DataRegistry.java b/src/main/java/com/falsepattern/chunk/api/DataRegistry.java
index 5928715..e4a6e8a 100644
--- a/src/main/java/com/falsepattern/chunk/api/DataRegistry.java
+++ b/src/main/java/com/falsepattern/chunk/api/DataRegistry.java
@@ -23,7 +23,7 @@
package com.falsepattern.chunk.api;
import com.falsepattern.chunk.internal.DataRegistryImpl;
-import com.falsepattern.lib.StableAPI;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Unmodifiable;
@@ -42,7 +42,7 @@ import java.util.Set;
* @see DataManager
* @since 0.5.0
*/
-@StableAPI(since = "0.5.0")
+@ApiStatus.NonExtendable
public class DataRegistry {
/**
* Registers a ChunkDataManager. Only do this during the init phase.
@@ -52,7 +52,6 @@ public class DataRegistry {
* @throws IllegalStateException If the registration stage is over.
* @throws IllegalArgumentException If the manager has a duplicate id.
*/
- @StableAPI.Expose
public static void registerDataManager(DataManager manager) throws IllegalStateException, IllegalArgumentException {
DataRegistryImpl.registerDataManager(manager);
}
@@ -64,7 +63,6 @@ public class DataRegistry {
*
* @throws IllegalStateException If the disable stage is over.
*/
- @StableAPI.Expose
public static void disableDataManager(String domain, String id) throws IllegalStateException {
DataRegistryImpl.disableDataManager(domain, id);
}
@@ -74,7 +72,6 @@ public class DataRegistry {
* The id of a manager is its domain and id separated by a colon. (domain:id)
*/
@Contract(pure = true)
- @StableAPI.Expose
public static @Unmodifiable Set
* This package contains the classes that you will use to interact with the ChunkAPI library.
*
* @author FalsePattern
- * @version 0.5.0
+ * @version 0.6.0
* @since 0.5.0
*/
-package com.falsepattern.chunk.api;
\ No newline at end of file
+package com.falsepattern.chunk.api;
diff --git a/src/main/java/com/falsepattern/chunk/internal/core/package-info.java b/src/main/java/com/falsepattern/chunk/internal/core/package-info.java
new file mode 100644
index 0000000..d979235
--- /dev/null
+++ b/src/main/java/com/falsepattern/chunk/internal/core/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * ChunkAPI
+ *
+ * Copyright (C) 2023-2025 FalsePattern, The MEGA Team, LegacyModdingMC contributors
+ * All Rights Reserved
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, only version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see