Move to LGPLv3

This commit is contained in:
FalsePattern committed 2025-06-01 12:18:18 +02:00
1 parent 86f08f28d0
commit c8d01204a0
50 files changed
+2165 -1966

No files matched your search

@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.api;
@@ -45,10 +42,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static boolean[] copyArray(boolean[] src, boolean[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -58,10 +57,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static byte[] copyArray(byte[] src, byte[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -71,10 +72,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static char[] copyArray(char[] src, char[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -84,10 +87,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static short[] copyArray(short[] src, short[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -97,10 +102,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static int[] copyArray(int[] src, int[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -110,10 +117,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static long[] copyArray(long[] src, long[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -123,10 +132,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static float[] copyArray(float[] src, float[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -136,10 +147,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static double[] copyArray(double[] src, double[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -149,10 +162,12 @@ public class ArrayUtil {
"!null, null -> new;",
mutates = "param2")
public static <T> T[] copyArray(T[] src, T[] dst) {
if (src == null)
if (src == null) {
return null;
if (dst == null || src.length != dst.length)
}
if (dst == null || src.length != dst.length) {
return Arrays.copyOf(src, src.length);
}
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.api;
@@ -46,13 +43,13 @@ import java.nio.ByteBuffer;
* managers. For the actual networking and data storage, see the internal interfaces of this interface.
* Note: This interface does nothing by itself, you also need to implement one or more of the internal interfaces.
*
* @since 0.5.0
* @author FalsePattern
* @version 0.5.0
* @see PacketDataManager
* @see ChunkDataManager
* @see SubChunkDataManager
* @see DataRegistry
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
public interface DataManager {
@@ -74,9 +71,9 @@ public interface DataManager {
/**
* Implement this interface if you want to synchronize your data with the client.
*
* @since 0.5.0
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
interface PacketDataManager extends DataManager {
@@ -114,9 +111,9 @@ public interface DataManager {
* Implement this interface if you additionally want to synchronize your data on single and multi-block updates,
* not just chunk updates.
*
* @since 0.6.0
* @author FalsePattern
* @version 0.6.0
* @since 0.6.0
*/
@StableAPI(since = "0.6.0")
interface BlockPacketDataManager extends DataManager {
@@ -146,9 +143,10 @@ public interface DataManager {
/**
* The common superinterface for RootDataManager and SubChunkDataManager.
* Contains version information and messages for users attempting to upgrade/remove versions.
* @since 0.5.0
*
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
interface StorageDataManager extends DataManager {
@@ -157,17 +155,15 @@ public interface DataManager {
*/
@StableAPI.Expose
@Contract(pure = true)
@NotNull
String version();
@NotNull String version();
/**
* @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.
* Return null to show no message, and treat the manager as fully compatible with vanilla.
*/
@StableAPI.Expose
@Contract(pure = true)
@Nullable
String newInstallDescription();
@Nullable String newInstallDescription();
/**
* @return The message to show to users when this manager is removed, AND they try to load the world (stored in the
@@ -175,26 +171,25 @@ public interface DataManager {
*/
@StableAPI.Expose
@Contract(pure = true)
@NotNull
String uninstallMessage();
@NotNull String uninstallMessage();
/**
* @param priorVersion The version of the manager this world was saved with.
*
* @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.
* 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);
@Nullable String versionChangeMessage(String priorVersion);
}
/**
* Implement this interface if you want to save your data to disk. This is called once per chunk, hence "root"
*
* @since 0.5.0
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
interface ChunkDataManager extends StorageDataManager {
@@ -232,8 +227,9 @@ public interface DataManager {
/**
* Directly copies data from one chunk to another chunk.
*
* @param from The chunk to copy data from.
* @param to The chunk to copy data to.
* @param to The chunk to copy data to.
*/
@Contract(mutates = "param2")
@StableAPI.Expose
@@ -244,9 +240,9 @@ public interface DataManager {
* Implement this interface if you want to save your subChunk data to disk. This is called once per
* ExtendedBlockStorage per chunk. (16 times per chunk)
*
* @since 0.5.0
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
interface SubChunkDataManager extends StorageDataManager {
@@ -283,9 +279,10 @@ public interface DataManager {
/**
* Directly copies data from one subChunk to another.
*
* @param fromChunk The owner of the subChunk to copy data from.
* @param from The subChunk to copy data from.
* @param to The subChunk to copy data to.
* @param from The subChunk to copy data from.
* @param to The subChunk to copy data to.
*/
@Contract(mutates = "param3")
@StableAPI.Expose
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.api;
@@ -40,10 +37,10 @@ import java.util.Set;
* <p>
* This class is used to register ChunkDataManagers, as well as dispatch clone requests.
*
* @since 0.5.0
* @see DataManager
* @author FalsePattern
* @version 0.5.0
* @see DataManager
* @since 0.5.0
*/
@StableAPI(since = "0.5.0")
public class DataRegistry {
@@ -56,8 +53,7 @@ public class DataRegistry {
* @throws IllegalArgumentException If the manager has a duplicate id.
*/
@StableAPI.Expose
public static void registerDataManager(DataManager manager)
throws IllegalStateException, IllegalArgumentException {
public static void registerDataManager(DataManager manager) throws IllegalStateException, IllegalArgumentException {
DataRegistryImpl.registerDataManager(manager);
}
@@ -86,8 +82,9 @@ public class DataRegistry {
/**
* Copies chunk-level data from a source chunk to a target chunk.
* DOES NOT copy data contained inside its ExtendedBlockStorage instances!!
*
* @param from The chunk to read the data from
* @param to The chunk to write the data to
* @param to The chunk to write the data to
*/
@Contract(mutates = "param2")
@StableAPI.Expose(since = "0.5.0")
@@ -97,9 +94,10 @@ public class DataRegistry {
/**
* Copies data from a source subChunk to a target subChunk.
*
* @param fromChunk The chunk that owns the *from* subChunk. Used by data managers for getting metadata about the world (skylight presence, etc.)
* @param from The subChunk to read the data from
* @param to The subChunk to write the data to
* @param from The subChunk to read the data from
* @param to The subChunk to write the data to
*/
@Contract(mutates = "param3")
@StableAPI.Expose(since = "0.5.0")
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
@@ -28,8 +25,8 @@
* <p>
* This package contains the classes that you will use to interact with the ChunkAPI library.
*
* @since 0.5.0
* @author FalsePattern
* @version 0.5.0
* @since 0.5.0
*/
package com.falsepattern.chunk.api;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal;
@@ -69,11 +66,9 @@ public class DataRegistryImpl {
public final DataManager.PacketDataManager manager;
}
public static void registerDataManager(DataManager manager)
throws IllegalStateException, IllegalArgumentException {
public static void registerDataManager(DataManager manager) throws IllegalStateException, IllegalArgumentException {
if (Loader.instance().getLoaderState() != LoaderState.INITIALIZATION) {
throw new IllegalStateException("ChunkDataManager registration is not allowed at this time! " +
"Please register your ChunkDataManager in the init phase.");
throw new IllegalStateException("ChunkDataManager registration is not allowed at this time! Please register your ChunkDataManager in the init phase.");
}
var id = manager.domain() + ":" + manager.id();
if (managers.contains(id)) {
@@ -109,11 +104,10 @@ public class DataRegistryImpl {
public static void disableDataManager(String domain, String id) {
if (Loader.instance().getLoaderState() != LoaderState.POSTINITIALIZATION) {
throw new IllegalStateException("ChunkDataManager disabling is not allowed at this time! " +
"Please disable any ChunkDataManagers in the postInit phase.");
throw new IllegalStateException("ChunkDataManager disabling is not allowed at this time! Please disable any ChunkDataManagers in the postInit phase.");
}
Common.LOG.debug("Disabling ChunkDataManager " + id + " in domain " + domain +
". See the stacktrace for the source of this event.\nThis is NOT an error.", new Throwable());
Common.LOG.debug("Disabling ChunkDataManager " + id + " in domain " + domain + ". See the stacktrace for the source of this event.\nThis is NOT an error.",
new Throwable());
val manager = domain + ":" + id;
//Remove the manager from the list of managers, if it exists
if (managers.remove(manager)) {
@@ -191,20 +185,20 @@ public class DataRegistryImpl {
}
public static void writeBlockToPacket(Chunk chunk, int x, int y, int z, S23PacketBlockChange packet) {
for (val manager: blockPacketManagers.values()) {
for (val manager : blockPacketManagers.values()) {
manager.writeBlockToPacket(chunk, x, y, z, packet);
}
}
public static void readBlockFromPacket(Chunk chunk, int x, int y, int z, S23PacketBlockChange packet) {
for (val manager: blockPacketManagers.values()) {
for (val manager : blockPacketManagers.values()) {
manager.readBlockFromPacket(chunk, x, y, z, packet);
}
}
public static void writeBlockPacketToBuffer(S23PacketBlockChange packet, PacketBuffer buffer) throws IOException {
buffer.writeInt(blockPacketManagers.size());
for (val pair: blockPacketManagers.entrySet()) {
for (val pair : blockPacketManagers.entrySet()) {
val id = pair.getKey();
val manager = pair.getValue();
buffer.writeStringToBuffer(id);
@@ -271,15 +265,13 @@ public class DataRegistryImpl {
public static void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunk, NBTTagCompound nbt) {
for (val manager : subChunkNBTManagers.values()) {
manager.writeSubChunkToNBT(chunk, subChunk,
createManagerNBT(manager.subChunkPrivilegedAccess(), nbt, manager));
manager.writeSubChunkToNBT(chunk, subChunk, createManagerNBT(manager.subChunkPrivilegedAccess(), nbt, manager));
}
}
public static void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunk, NBTTagCompound nbt) {
for (val manager : subChunkNBTManagers.values()) {
manager.readSubChunkFromNBT(chunk, subChunk,
getManagerNBT(manager.subChunkPrivilegedAccess(), nbt, manager));
manager.readSubChunkFromNBT(chunk, subChunk, getManagerNBT(manager.subChunkPrivilegedAccess(), nbt, manager));
}
}
@@ -296,13 +288,13 @@ public class DataRegistryImpl {
}
public static void cloneChunk(Chunk from, Chunk to) {
for (val manager: chunkNBTManagers.values()) {
for (val manager : chunkNBTManagers.values()) {
manager.cloneChunk(from, to);
}
}
public static void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage from, ExtendedBlockStorage to) {
for (val manager: subChunkNBTManagers.values()) {
for (val manager : subChunkNBTManagers.values()) {
manager.cloneSubChunk(fromChunk, from, to);
}
}
@@ -328,21 +320,25 @@ public class DataRegistryImpl {
}
triggerScreen = true;
}
if (triggerScreen)
if (triggerScreen) {
builder.append("ChunkAPI will attempt to load the world, but it is possible that chunks might get corrupted.\n" +
"Read the following text carefully, and make sure you understand the risks before continuing.\n\n");
if (managerCompat != null)
}
if (managerCompat != null) {
builder.append(managerCompat);
}
if (triggerScreen) {
builder.append("\nA world backup will be automatically created in your saves directory.\n\n");
boolean confirmed = StartupQuery.confirm(builder.toString());
if (!confirmed) StartupQuery.abort();
if (!confirmed) {
StartupQuery.abort();
}
try {
ZipperUtil.backupWorld();
} catch (IOException e) {
StartupQuery.notify("The world backup couldn't be created.\n\n"+e);
StartupQuery.notify("The world backup couldn't be created.\n\n" + e);
StartupQuery.abort();
}
}
@@ -360,13 +356,15 @@ public class DataRegistryImpl {
for (val manager : removedManagers) {
val saveManager = saveManagers.get(manager);
builder.append(manager);
if (saveManager.version != null)
if (saveManager.version != null) {
builder.append(' ').append(saveManager.version);
}
builder.append("\nUninstall information: ");
if (saveManager.uninstallMessage != null)
if (saveManager.uninstallMessage != null) {
builder.append(saveManager.getUninstallMessage());
else
} else {
builder.append("No uninstall information available.");
}
builder.append('\n');
}
}
@@ -378,19 +376,20 @@ public class DataRegistryImpl {
if (!addedManagers.isEmpty()) {
compatWarning = true;
builder.append("\nThe following data managers have been newly added:\n");
for (val manager: addedManagers) {
for (val manager : addedManagers) {
val addedManager = NBTManagers.get(manager);
if (addedManager == null)
if (addedManager == null) {
continue;
builder.append(manager)
.append(' ').append(addedManager.version()).append('\n');
}
builder.append(manager).append(' ').append(addedManager.version()).append('\n');
val installMessage = addedManager.newInstallDescription();
if (installMessage != null)
if (installMessage != null) {
builder.append("Install information: ").append(addedManager.newInstallDescription()).append('\n');
}
}
}
boolean changePrompt = false;
for (val savedManager: saveManagers.entrySet()) {
for (val savedManager : saveManagers.entrySet()) {
val managerName = savedManager.getKey();
if (NBTManagers.containsKey(managerName)) {
val manager = savedManager.getValue();
@@ -402,30 +401,26 @@ public class DataRegistryImpl {
builder.append("\nThe following data managers have changed versions in an incompatible way:\n");
changePrompt = true;
}
builder.append(managerName)
.append(" has changed versions from ")
.append(manager.version)
.append(" to ")
.append(currentManager.version())
.append(".\n");
builder.append(managerName).append(" has changed versions from ").append(manager.version).append(" to ").append(currentManager.version()).append(".\n");
builder.append("Upgrade information: ").append(extraMessage).append('\n');
}
}
}
if (!compatWarning)
if (!compatWarning) {
return null;
return "The following managers have changed:\n" +
builder;
}
return "The following managers have changed:\n" + builder;
}
public static void writeLevelDat(NBTTagCompound tag) {
val managers = new NBTTagCompound();
tag.setTag("managers", managers);
tag.setString("version", Tags.MOD_VERSION);
for (val manager: NBTManagers.entrySet()) {
for (val manager : NBTManagers.entrySet()) {
val name = manager.getKey();
if (name.startsWith("minecraft:"))
if (name.startsWith("minecraft:")) {
continue;
}
val value = manager.getValue();
managers.setTag(name, SaveManagerInfo.fromManager(value).toNBT());
}
@@ -433,11 +428,15 @@ public class DataRegistryImpl {
private static Map<String, SaveManagerInfo> readManagers(NBTTagCompound tag) {
val managers = new HashMap<String, SaveManagerInfo>();
if (!tag.hasKey("managers")) return managers;
if (tag.func_150299_b("managers") != Constants.NBT.TAG_COMPOUND ) return managers;
if (!tag.hasKey("managers")) {
return managers;
}
if (tag.func_150299_b("managers") != Constants.NBT.TAG_COMPOUND) {
return managers;
}
val managerTag = tag.getCompoundTag("managers");
//noinspection unchecked
for (val key : (Set<String>)managerTag.func_150296_c()) {
for (val key : managerTag.func_150296_c()) {
managers.put(key, SaveManagerInfo.fromNBT(managerTag.getCompoundTag(key)));
}
return managers;
@@ -452,10 +451,12 @@ public class DataRegistryImpl {
public NBTTagCompound toNBT() {
val tag = new NBTTagCompound();
if (version != null)
if (version != null) {
tag.setString("version", version);
if (uninstallMessage != null)
}
if (uninstallMessage != null) {
tag.setString("uninstallMessage", uninstallMessage);
}
return tag;
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.core;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.core;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.impl;
@@ -29,10 +26,16 @@ import net.minecraft.world.chunk.Chunk;
public interface CustomPacketBlockChange {
void chunkapi$init(int x, int y, int z, Chunk chunk);
void chunkapi$x(int value);
void chunkapi$y(int value);
void chunkapi$z(int value);
int chunkapi$x();
int chunkapi$y();
int chunkapi$z();
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.impl;
@@ -30,5 +27,6 @@ import net.minecraft.world.chunk.Chunk;
public interface CustomPacketMultiBlockChange {
void chunkapi$init(int count, short[] crammedPositions, Chunk chunk);
S23PacketBlockChange[] chunkapi$subPackets();
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.client.vanilla;
@@ -108,8 +105,7 @@ public abstract class ChunkMixin {
int z = tileentity.zCoord & 15;
Block block = tileentity.getBlockType();
if ((block != getBlock(x, y, z) || tileentity.blockMetadata != this.getBlockMetadata(x, y, z)) &&
tileentity.shouldRefresh(block, getBlock(x, y, z), tileentity.blockMetadata,
this.getBlockMetadata(x, y, z), worldObj, x, y, z)) {
tileentity.shouldRefresh(block, getBlock(x, y, z), tileentity.blockMetadata, this.getBlockMetadata(x, y, z), worldObj, x, y, z)) {
invalidList.add(tileentity);
}
tileentity.updateContainingBlockInfo();
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.client.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -158,8 +155,7 @@ public abstract class AnvilChunkLoaderMixin {
entities.appendTag(entityNBT);
}
} catch (Exception e) {
FMLLog.log(Level.ERROR, e,
"An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
FMLLog.log(Level.ERROR, e, "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
entity.getClass().getName());
}
}
@@ -175,8 +171,7 @@ public abstract class AnvilChunkLoaderMixin {
tileentity.writeToNBT(tileEntityNBT);
tileEntities.appendTag(tileEntityNBT);
} catch (Exception e) {
FMLLog.log(Level.ERROR, e,
"A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
FMLLog.log(Level.ERROR, e, "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
tileentity.getClass().getName());
}
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -31,7 +28,6 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
import net.minecraft.server.management.PlayerManager;
import net.minecraft.world.chunk.Chunk;
@@ -47,7 +43,7 @@ public abstract class PlayerInstanceMixin {
require = 1)
private S22PacketMultiBlockChange hijackPacket(int count, short[] positions, Chunk chunk) {
val packet = new S22PacketMultiBlockChange();
((CustomPacketMultiBlockChange)packet).chunkapi$init(count, positions, chunk);
((CustomPacketMultiBlockChange) packet).chunkapi$init(count, positions, chunk);
return packet;
}
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -28,8 +25,6 @@ package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
import com.falsepattern.chunk.internal.DataRegistryImpl;
import com.falsepattern.chunk.internal.impl.CustomPacketBlockChange;
import com.falsepattern.chunk.internal.impl.CustomPacketMultiBlockChange;
import io.netty.buffer.AbstractByteBuf;
import io.netty.buffer.Unpooled;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -39,12 +34,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import cpw.mods.fml.common.network.ByteBufUtils;
import java.io.IOException;
@@ -63,8 +56,7 @@ public abstract class S22PacketMultiBlockChangeMixin implements CustomPacketMult
unsafe = true),
require = 1)
private void suppressConstructor(int p_i45181_1_, short[] crammedPositions, Chunk chunk, CallbackInfo ci) {
throw new IllegalStateException(
"S22PacketMultiBlockChange constructor is not supported by ChunkAPI. Please report this to FalsePattern!");
throw new IllegalStateException("S22PacketMultiBlockChange constructor is not supported by ChunkAPI. Please report this to FalsePattern!");
}
@Override
@@ -123,9 +115,7 @@ public abstract class S22PacketMultiBlockChangeMixin implements CustomPacketMult
data.writeVarIntToBuffer(subPackets.length);
for (val subPacket : subPackets) {
val cSub = (CustomPacketBlockChange) subPacket;
int pos = ((cSub.chunkapi$x() & 0xf) << 12) |
((cSub.chunkapi$z() & 0xf) << 8) |
(cSub.chunkapi$y() & 0xff);
int pos = ((cSub.chunkapi$x() & 0xf) << 12) | ((cSub.chunkapi$z() & 0xf) << 8) | (cSub.chunkapi$y() & 0xff);
data.writeShort(pos);
DataRegistryImpl.writeBlockPacketToBuffer(subPacket, data);
}
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -28,7 +25,6 @@ package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
import com.falsepattern.chunk.internal.BlockPosUtil;
import com.falsepattern.chunk.internal.DataRegistryImpl;
import com.falsepattern.chunk.internal.impl.CustomPacketBlockChange;
import lombok.SneakyThrows;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -57,9 +53,11 @@ public abstract class S23PacketBlockChangeMixin implements CustomPacketBlockChan
remap = false)
private int zCoord;
@Shadow public Block field_148883_d;
@Shadow
public Block field_148883_d;
@Shadow public int field_148884_e;
@Shadow
public int field_148884_e;
@Override
public void chunkapi$init(int x, int y, int z, Chunk chunk) {
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.plugin;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.plugin;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.mixin.plugin;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -34,8 +31,7 @@ import net.minecraft.world.chunk.Chunk;
import java.nio.ByteBuffer;
public class BiomeManager extends VanillaManager
implements DataManager.PacketDataManager, DataManager.ChunkDataManager {
public class BiomeManager extends VanillaManager implements DataManager.PacketDataManager, DataManager.ChunkDataManager {
public static final int BYTES_PER_CHUNK = 256;
@Override
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -43,11 +40,7 @@ import java.nio.ByteBuffer;
import static com.falsepattern.chunk.internal.Common.BLOCKS_PER_SUBCHUNK;
import static com.falsepattern.chunk.internal.Common.SUBCHUNKS_PER_CHUNK;
public class BlockIDManager extends VanillaManager
implements
DataManager.PacketDataManager,
DataManager.BlockPacketDataManager,
DataManager.SubChunkDataManager {
public class BlockIDManager extends VanillaManager implements DataManager.PacketDataManager, DataManager.BlockPacketDataManager, DataManager.SubChunkDataManager {
private static final int LSB_BYTES_PER_SUBCHUNK = BLOCKS_PER_SUBCHUNK;
private static final int MSB_BYTES_PER_SUBCHUNK = BLOCKS_PER_SUBCHUNK / 2;
private static final int HEADER_SIZE = 2;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -37,9 +34,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import java.io.IOException;
public class MetadataManager extends NibbleManager implements
DataManager.BlockPacketDataManager,
DataManager.SubChunkDataManager {
public class MetadataManager extends NibbleManager implements DataManager.BlockPacketDataManager, DataManager.SubChunkDataManager {
@Override
protected NibbleArray getNibbleArray(ExtendedBlockStorage subChunk) {
return subChunk.getMetadataArray();
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;
@@ -1,26 +1,23 @@
/*
* ChunkAPI
*
* Copyright (C) 2023-2025 FalsePattern
* 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.
* 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 Affero General Public License as published by
* 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 Affero General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This program comes with additional permissions according to Section 7 of the
* GNU Affero General Public License. See the full LICENSE file for details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.chunk.internal.vanilla;