mirror of
https://github.com/LegacyModdingMC/ChunkAPI.git
synced 2026-11-16 10:35:00 +00:00
The Great Naming Scheme Cleanup. Breaking change.
- Replaced "EBS" with "subchunk" - Replaced "section" with "subchunk" - Removed the Chunk* prefix from most classes - Data manager names much more descriptive and less verbose Yes, this contradicts the backwards compatibility requirements set forth in the FalsePatternLib StableAPI interface, however, we're still in beta, and only our mods use this library as far as I'm aware, so it's fine to make changes like this for now.
This commit is contained in:
19 files changed
+250
-265
No files matched your search
@@ -7,7 +7,7 @@
|
||||
|
||||
package com.falsepattern.chunk.internal.vanilla;
|
||||
|
||||
import com.falsepattern.chunk.api.ChunkDataManager;
|
||||
import com.falsepattern.chunk.api.DataManager;
|
||||
import com.falsepattern.chunk.internal.Common;
|
||||
import lombok.val;
|
||||
|
||||
@@ -17,37 +17,37 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public abstract class NibbleManager extends VanillaManager implements ChunkDataManager.PacketDataManager {
|
||||
public static final int BYTES_PER_EBS = Common.BLOCKS_PER_EBS / 2;
|
||||
public abstract class NibbleManager extends VanillaManager implements DataManager.PacketDataManager {
|
||||
public static final int BYTES_PER_SUBCHUNK = Common.BLOCKS_PER_SUBCHUNK / 2;
|
||||
|
||||
protected abstract NibbleArray getNibbleArray(ExtendedBlockStorage ebs);
|
||||
protected abstract NibbleArray getNibbleArray(ExtendedBlockStorage subchunk);
|
||||
|
||||
@Override
|
||||
public int maxPacketSize() {
|
||||
return Common.EBS_PER_CHUNK * BYTES_PER_EBS;
|
||||
return Common.SUBCHUNKS_PER_CHUNK * BYTES_PER_SUBCHUNK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val ebsArray = chunk.getBlockStorageArray();
|
||||
for (int i = 0; i < ebsArray.length; i++) {
|
||||
if ((ebsMask & (1 << i)) != 0) {
|
||||
val ebs = ebsArray[i];
|
||||
if (ebs != null) {
|
||||
data.put(getNibbleArray(ebs).data, 0, BYTES_PER_EBS);
|
||||
public void writeToBuffer(Chunk chunk, int subchunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val subchunks = chunk.getBlockStorageArray();
|
||||
for (int i = 0; i < subchunks.length; i++) {
|
||||
if ((subchunkMask & (1 << i)) != 0) {
|
||||
val subchunk = subchunks[i];
|
||||
if (subchunk != null) {
|
||||
data.put(getNibbleArray(subchunk).data, 0, BYTES_PER_SUBCHUNK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val ebsArray = chunk.getBlockStorageArray();
|
||||
for (int i = 0; i < ebsArray.length; i++) {
|
||||
if ((ebsMask & (1 << i)) != 0) {
|
||||
val ebs = ebsArray[i];
|
||||
if (ebs != null) {
|
||||
buffer.get(getNibbleArray(ebs).data, 0, BYTES_PER_EBS);
|
||||
public void readFromBuffer(Chunk chunk, int subchunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val subchunks = chunk.getBlockStorageArray();
|
||||
for (int i = 0; i < subchunks.length; i++) {
|
||||
if ((subchunkMask & (1 << i)) != 0) {
|
||||
val subchunk = subchunks[i];
|
||||
if (subchunk != null) {
|
||||
buffer.get(getNibbleArray(subchunk).data, 0, BYTES_PER_SUBCHUNK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user