mirror of
https://github.com/LegacyModdingMC/ChunkAPI.git
synced 2026-10-27 14:53:37 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18f7d15f3a | ||
|
|
039017a286 | ||
|
|
40d27c7ee6 | ||
|
|
d7b4afe9c3 | ||
|
|
1ba33b64a0 | ||
|
|
a3165a0cca | ||
|
|
3c4ffe502c | ||
|
|
68f297faba | ||
|
|
02f2321339 |
No files matched your search
@@ -112,7 +112,17 @@ Manager data:
|
||||
| 4 | int | (m) Manager data length |
|
||||
| m | byte[m] | Manager data |
|
||||
|
||||
## Strict No LLM / No AI Policy
|
||||
|
||||
No LLMs for issues.
|
||||
|
||||
No LLMs for patches / pull requests.
|
||||
|
||||
No LLMs for comments on the bug tracker, including translation.
|
||||
|
||||
English is encouraged, but not required. You are welcome to post in your native
|
||||
language and rely on others to have their own translation tools of choice to
|
||||
interpret your words.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
@@ -413,11 +413,14 @@ public class DataRegistryImpl {
|
||||
StartupQuery.abort();
|
||||
}
|
||||
|
||||
try {
|
||||
ZipperUtil.backupWorld();
|
||||
} catch (IOException e) {
|
||||
StartupQuery.notify("The world backup couldn't be created.\n\n" + e);
|
||||
StartupQuery.abort();
|
||||
String skip = System.getProperty("fml.doNotBackup");
|
||||
if (skip == null || !"true".equals(skip)) {
|
||||
try {
|
||||
ZipperUtil.backupWorld();
|
||||
} catch (IOException e) {
|
||||
StartupQuery.notify("The world backup couldn't be created.\n\n" + e);
|
||||
StartupQuery.abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.falsepattern.chunk.internal.mixin.mixins.common.base;
|
||||
|
||||
import com.falsepattern.chunk.internal.mixin.helpers.LockHelper;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
@Mixin(S26PacketMapChunkBulk.class)
|
||||
public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(aliases = "field_149268_i",
|
||||
remap = false)
|
||||
private static byte[] inflaterBuffer;
|
||||
@Shadow(aliases = "field_149266_a",
|
||||
remap = false)
|
||||
private int[] xPositions;
|
||||
@Shadow(aliases = "field_149264_b",
|
||||
remap = false)
|
||||
private int[] zPositions;
|
||||
@Shadow(aliases = "field_149265_c",
|
||||
remap = false)
|
||||
private int[] subChunkMasks;
|
||||
@Shadow(aliases = "field_149262_d",
|
||||
remap = false)
|
||||
private int[] subChunkMSBMasks;
|
||||
@Shadow(aliases = "field_149261_g",
|
||||
remap = false)
|
||||
private int deflatedSize;
|
||||
@Shadow(aliases = "field_149267_h",
|
||||
remap = false)
|
||||
private boolean skylight;
|
||||
@Shadow(aliases = "field_149260_f",
|
||||
remap = false)
|
||||
private byte[][] datas;
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Replace functionality
|
||||
*/
|
||||
@Overwrite
|
||||
public void readPacketData(PacketBuffer data) throws IOException {
|
||||
short chunkCount = data.readShort();
|
||||
val sizes = new int[chunkCount];
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
sizes[i] = data.readInt();
|
||||
}
|
||||
deflatedSize = data.readInt();
|
||||
skylight = data.readBoolean();
|
||||
xPositions = new int[chunkCount];
|
||||
zPositions = new int[chunkCount];
|
||||
subChunkMasks = new int[chunkCount];
|
||||
subChunkMSBMasks = new int[chunkCount];
|
||||
datas = new byte[chunkCount][];
|
||||
|
||||
while (!LockHelper.bufferLockS26PacketMapChunkBulk.tryLock()) {
|
||||
Thread.yield();
|
||||
}
|
||||
byte[] buf;
|
||||
try {
|
||||
if (inflaterBuffer.length < deflatedSize) {
|
||||
inflaterBuffer = new byte[deflatedSize];
|
||||
}
|
||||
|
||||
data.readBytes(inflaterBuffer, 0, deflatedSize);
|
||||
buf = new byte[S21PacketChunkData.func_149275_c() * chunkCount];
|
||||
Inflater inflater = new Inflater();
|
||||
inflater.setInput(inflaterBuffer, 0, deflatedSize);
|
||||
|
||||
try {
|
||||
inflater.inflate(buf);
|
||||
} catch (DataFormatException dataformatexception) {
|
||||
throw new IOException("Bad compressed data format");
|
||||
} finally {
|
||||
inflater.end();
|
||||
}
|
||||
} finally {
|
||||
LockHelper.bufferLockS26PacketMapChunkBulk.unlock();
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < chunkCount; ++i) {
|
||||
val size = sizes[i];
|
||||
xPositions[i] = data.readInt();
|
||||
zPositions[i] = data.readInt();
|
||||
subChunkMasks[i] = data.readUnsignedShort();
|
||||
|
||||
datas[i] = new byte[size];
|
||||
System.arraycopy(buf, pos, datas[i], 0, size);
|
||||
pos += size;
|
||||
}
|
||||
}
|
||||
}
|
||||
+71
@@ -23,16 +23,26 @@
|
||||
|
||||
package com.falsepattern.chunk.internal.mixin.mixins.common.thermos;
|
||||
|
||||
import com.falsepattern.chunk.internal.mixin.helpers.LockHelper;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
|
||||
@Mixin(S26PacketMapChunkBulk.class)
|
||||
public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(aliases = "field_149268_i",
|
||||
remap = false)
|
||||
private byte[] inflaterBuffer;
|
||||
@Shadow(aliases = "field_149263_e",
|
||||
remap = false)
|
||||
private byte[] deflatedData;
|
||||
@@ -45,6 +55,9 @@ public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(aliases = "field_149265_c",
|
||||
remap = false)
|
||||
private int[] subChunkMasks;
|
||||
@Shadow(aliases = "field_149262_d",
|
||||
remap = false)
|
||||
private int[] subChunkMSBMasks;
|
||||
@Shadow(aliases = "field_149261_g",
|
||||
remap = false)
|
||||
private int deflatedSize;
|
||||
@@ -57,6 +70,64 @@ public abstract class S26PacketMapChunkBulkMixin {
|
||||
|
||||
@Shadow(remap = false)
|
||||
protected abstract void compress();
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Replace functionality
|
||||
*/
|
||||
@Overwrite
|
||||
public void readPacketData(PacketBuffer data) throws IOException {
|
||||
short chunkCount = data.readShort();
|
||||
val sizes = new int[chunkCount];
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
sizes[i] = data.readInt();
|
||||
}
|
||||
deflatedSize = data.readInt();
|
||||
skylight = data.readBoolean();
|
||||
xPositions = new int[chunkCount];
|
||||
zPositions = new int[chunkCount];
|
||||
subChunkMasks = new int[chunkCount];
|
||||
subChunkMSBMasks = new int[chunkCount];
|
||||
datas = new byte[chunkCount][];
|
||||
|
||||
while (!LockHelper.bufferLockS26PacketMapChunkBulk.tryLock()) {
|
||||
Thread.yield();
|
||||
}
|
||||
byte[] buf;
|
||||
try {
|
||||
if (inflaterBuffer.length < deflatedSize) {
|
||||
inflaterBuffer = new byte[deflatedSize];
|
||||
}
|
||||
|
||||
data.readBytes(inflaterBuffer, 0, deflatedSize);
|
||||
buf = new byte[S21PacketChunkData.func_149275_c() * chunkCount];
|
||||
Inflater inflater = new Inflater();
|
||||
inflater.setInput(inflaterBuffer, 0, deflatedSize);
|
||||
|
||||
try {
|
||||
inflater.inflate(buf);
|
||||
} catch (DataFormatException dataformatexception) {
|
||||
throw new IOException("Bad compressed data format");
|
||||
} finally {
|
||||
inflater.end();
|
||||
}
|
||||
} finally {
|
||||
LockHelper.bufferLockS26PacketMapChunkBulk.unlock();
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < chunkCount; ++i) {
|
||||
val size = sizes[i];
|
||||
xPositions[i] = data.readInt();
|
||||
zPositions[i] = data.readInt();
|
||||
subChunkMasks[i] = data.readUnsignedShort();
|
||||
|
||||
datas[i] = new byte[size];
|
||||
System.arraycopy(buf, pos, datas[i], 0, size);
|
||||
pos += size;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
|
||||
+70
@@ -22,17 +22,26 @@
|
||||
|
||||
package com.falsepattern.chunk.internal.mixin.mixins.common.vanilla;
|
||||
|
||||
import com.falsepattern.chunk.internal.mixin.helpers.LockHelper;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
@Mixin(S26PacketMapChunkBulk.class)
|
||||
public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(aliases = "field_149268_i",
|
||||
remap = false)
|
||||
private static byte[] inflaterBuffer;
|
||||
@Shadow(aliases = "field_149263_e",
|
||||
remap = false)
|
||||
private byte[] deflatedData;
|
||||
@@ -47,6 +56,9 @@ public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(aliases = "field_149265_c",
|
||||
remap = false)
|
||||
private int[] subChunkMasks;
|
||||
@Shadow(aliases = "field_149262_d",
|
||||
remap = false)
|
||||
private int[] subChunkMSBMasks;
|
||||
@Shadow(aliases = "field_149261_g",
|
||||
remap = false)
|
||||
private int deflatedSize;
|
||||
@@ -60,6 +72,64 @@ public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow(remap = false)
|
||||
protected abstract void deflate();
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Replace functionality
|
||||
*/
|
||||
@Overwrite
|
||||
public void readPacketData(PacketBuffer data) throws IOException {
|
||||
short chunkCount = data.readShort();
|
||||
val sizes = new int[chunkCount];
|
||||
for (int i = 0; i < chunkCount; i++) {
|
||||
sizes[i] = data.readInt();
|
||||
}
|
||||
deflatedSize = data.readInt();
|
||||
skylight = data.readBoolean();
|
||||
xPositions = new int[chunkCount];
|
||||
zPositions = new int[chunkCount];
|
||||
subChunkMasks = new int[chunkCount];
|
||||
subChunkMSBMasks = new int[chunkCount];
|
||||
datas = new byte[chunkCount][];
|
||||
|
||||
while (!LockHelper.bufferLockS26PacketMapChunkBulk.tryLock()) {
|
||||
Thread.yield();
|
||||
}
|
||||
byte[] buf;
|
||||
try {
|
||||
if (inflaterBuffer.length < deflatedSize) {
|
||||
inflaterBuffer = new byte[deflatedSize];
|
||||
}
|
||||
|
||||
data.readBytes(inflaterBuffer, 0, deflatedSize);
|
||||
buf = new byte[S21PacketChunkData.func_149275_c() * chunkCount];
|
||||
Inflater inflater = new Inflater();
|
||||
inflater.setInput(inflaterBuffer, 0, deflatedSize);
|
||||
|
||||
try {
|
||||
inflater.inflate(buf);
|
||||
} catch (DataFormatException dataformatexception) {
|
||||
throw new IOException("Bad compressed data format");
|
||||
} finally {
|
||||
inflater.end();
|
||||
}
|
||||
} finally {
|
||||
LockHelper.bufferLockS26PacketMapChunkBulk.unlock();
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < chunkCount; ++i) {
|
||||
val size = sizes[i];
|
||||
xPositions[i] = data.readInt();
|
||||
zPositions[i] = data.readInt();
|
||||
subChunkMasks[i] = data.readUnsignedShort();
|
||||
|
||||
datas[i] = new byte[size];
|
||||
System.arraycopy(buf, pos, datas[i], 0, size);
|
||||
pos += size;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Replace functionality
|
||||
|
||||
@@ -122,7 +122,7 @@ public enum Mixin implements IMixins {
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("thermos.Thermos");
|
||||
Class.forName("thermos.ThermosClassTransformer");
|
||||
return true;
|
||||
}
|
||||
catch(ClassNotFoundException ignored) {
|
||||
|
||||
Reference in new issue
Block a user