Implement AnvilChunkLoader coupling

This commit is contained in:
FalsePattern committed 2023-03-30 17:17:11 +02:00
1 parent b91c4e7342
commit e4618cf3b8
13 files changed
+477 -92

No files matched your search

@@ -1,9 +1,13 @@
package com.falsepattern.chunk.internal.vanilla;
import com.falsepattern.chunk.api.ChunkDataManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
public class BlocklightManager extends NibbleManager {
public class BlocklightManager extends NibbleManager implements ChunkDataManager.SectionNBTDataManager {
@Override
protected NibbleArray getNibbleArray(ExtendedBlockStorage ebs) {
return ebs.getBlocklightArray();
@@ -13,4 +17,19 @@ public class BlocklightManager extends NibbleManager {
public String id() {
return "blocklight";
}
@Override
public boolean sectionPrivilegedAccess() {
return true;
}
@Override
public void writeSectionToNBT(Chunk chunk, ExtendedBlockStorage ebs, NBTTagCompound section) {
section.setByteArray("BlockLight", ebs.getBlocklightArray().data);
}
@Override
public void readSectionFromNBT(Chunk chunk, ExtendedBlockStorage ebs, NBTTagCompound section) {
ebs.setBlocklightArray(new NibbleArray(section.getByteArray("BlockLight"), 4));
}
}