mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-12 16:37:49 +00:00
The Big Rename (ebs, section -> subChunk)
This commit is contained in:
25 files changed
+168
-168
No files matched your search
@@ -34,8 +34,8 @@ public class ExtendedConstants {
|
||||
|
||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerSubChunk = (nibblesPerSubChunk + 1) / 2;
|
||||
|
||||
//BiomeIDs
|
||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||
|
||||
@@ -27,8 +27,8 @@ public class VanillaConstants {
|
||||
|
||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
|
||||
public static final int bytesPerSubChunk = (nibblesPerSubChunk + 1) / 2;
|
||||
|
||||
//BiomeIDs
|
||||
public static final int biomeIDCount = 1 << bitsPerBiome;
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.falsepattern.chunk.api.ArrayUtil;
|
||||
import com.falsepattern.chunk.api.DataManager;
|
||||
import com.falsepattern.endlessids.Hooks;
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -33,17 +33,17 @@ public class BiomeManager implements DataManager.PacketDataManager, DataManager.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||
data.asShortBuffer().put(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||
data.asShortBuffer().put(((ChunkBiomeHook)chunk).getBiomeShortArray());
|
||||
data.position(data.position() + maxPacketSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
var arr = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
var arr = ((ChunkBiomeHook)chunk).getBiomeShortArray();
|
||||
if (arr == null) {
|
||||
arr = new short[16 * 16];
|
||||
((IChunkMixin)chunk).setBiomeShortArray(arr);
|
||||
((ChunkBiomeHook)chunk).setBiomeShortArray(arr);
|
||||
}
|
||||
buffer.asShortBuffer().get(arr);
|
||||
buffer.position(buffer.position() + maxPacketSize());
|
||||
@@ -56,16 +56,16 @@ public class BiomeManager implements DataManager.PacketDataManager, DataManager.
|
||||
|
||||
@Override
|
||||
public void writeChunkToNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||
byte[] arr = Hooks.shortToByteArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
byte[] arr = Hooks.shortToByteArray(((ChunkBiomeHook)chunk).getBiomeShortArray());
|
||||
nbt.setByteArray("Biomes16v2", arr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readChunkFromNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||
var data = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
var data = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
if (data == null) {
|
||||
data = new short[16 * 16];
|
||||
((IChunkMixin)chunk).setBiomeShortArray(data);
|
||||
((ChunkBiomeHook)chunk).setBiomeShortArray(data);
|
||||
}
|
||||
if (nbt.hasKey("Biomes16v2", 7)) {
|
||||
Hooks.byteToShortArray(nbt.getByteArray("Biomes16v2"), 0, data, 0, data.length * 2);
|
||||
@@ -79,8 +79,8 @@ public class BiomeManager implements DataManager.PacketDataManager, DataManager.
|
||||
|
||||
@Override
|
||||
public void cloneChunk(Chunk fromVanilla, Chunk toVanilla) {
|
||||
val from = (IChunkMixin) fromVanilla;
|
||||
val to = (IChunkMixin) toVanilla;
|
||||
val from = (ChunkBiomeHook) fromVanilla;
|
||||
val to = (ChunkBiomeHook) toVanilla;
|
||||
|
||||
to.setBiomeShortArray(ArrayUtil.copyArray(from.getBiomeShortArray(), to.getBiomeShortArray()));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.falsepattern.endlessids.managers;
|
||||
import com.falsepattern.chunk.api.ArrayUtil;
|
||||
import com.falsepattern.chunk.api.DataManager;
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -34,35 +34,35 @@ public class BlockIDManager implements DataManager.PacketDataManager, DataManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val ebsList = chunk.getBlockStorageArray();
|
||||
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val subChunkList = chunk.getBlockStorageArray();
|
||||
int storageFlags = 0;
|
||||
val start = data.position() + 4;
|
||||
data.position(start);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||
|
||||
storageFlags |= ebs.getEBSMSBMask() << (i * 2);
|
||||
storageFlags |= subChunk.getBlockMask() << (i * 2);
|
||||
|
||||
val b1 = ebs.getB1();
|
||||
val b1 = subChunk.getB1();
|
||||
data.put(b1);
|
||||
|
||||
val b2Low = ebs.getB2Low();
|
||||
val b2Low = subChunk.getB2Low();
|
||||
if (b2Low == null) {
|
||||
continue;
|
||||
}
|
||||
data.put(b2Low.data);
|
||||
|
||||
val b2High = ebs.getB2High();
|
||||
val b2High = subChunk.getB2High();
|
||||
if (b2High == null) {
|
||||
continue;
|
||||
}
|
||||
data.put(b2High.data);
|
||||
|
||||
val b3 = ebs.getB3();
|
||||
val b3 = subChunk.getB3();
|
||||
if (b3 != null) {
|
||||
data.put(b3);
|
||||
}
|
||||
@@ -71,45 +71,45 @@ public class BlockIDManager implements DataManager.PacketDataManager, DataManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val ebsList = chunk.getBlockStorageArray();
|
||||
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val subChunkList = chunk.getBlockStorageArray();
|
||||
val storageFlags = buffer.getInt();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||
val b1 = ebs.getB1();
|
||||
val b1 = subChunk.getB1();
|
||||
buffer.get(b1);
|
||||
if (storageFlag == 0b00) {
|
||||
ebs.setB2Low(null);
|
||||
ebs.setB2High(null);
|
||||
ebs.setB3(null);
|
||||
subChunk.setB2Low(null);
|
||||
subChunk.setB2High(null);
|
||||
subChunk.setB3(null);
|
||||
continue;
|
||||
}
|
||||
var b2Low = ebs.getB2Low();
|
||||
var b2Low = subChunk.getB2Low();
|
||||
if (b2Low == null) {
|
||||
b2Low = ebs.createB2Low();
|
||||
b2Low = subChunk.createB2Low();
|
||||
}
|
||||
buffer.get(b2Low.data);
|
||||
if (storageFlag == 0b01) {
|
||||
ebs.setB2High(null);
|
||||
ebs.setB3(null);
|
||||
subChunk.setB2High(null);
|
||||
subChunk.setB3(null);
|
||||
continue;
|
||||
}
|
||||
var b2High = ebs.getB2High();
|
||||
var b2High = subChunk.getB2High();
|
||||
if (b2High == null) {
|
||||
b2High = ebs.createB2High();
|
||||
b2High = subChunk.createB2High();
|
||||
}
|
||||
buffer.get(b2High.data);
|
||||
if (storageFlag == 0b10) {
|
||||
ebs.setB3(null);
|
||||
subChunk.setB3(null);
|
||||
continue;
|
||||
}
|
||||
var b3 = ebs.getB3();
|
||||
var b3 = subChunk.getB3();
|
||||
if (b3 == null) {
|
||||
b3 = ebs.createB3();
|
||||
b3 = subChunk.createB3();
|
||||
}
|
||||
buffer.get(b3);
|
||||
}
|
||||
@@ -122,27 +122,27 @@ public class BlockIDManager implements DataManager.PacketDataManager, DataManage
|
||||
|
||||
|
||||
@Override
|
||||
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||
val b1 = ebs.getB1();
|
||||
val b2Low = ebs.getB2Low();
|
||||
val b2High = ebs.getB2High();
|
||||
val b3 = ebs.getB3();
|
||||
section.setByteArray("Blocks", b1);
|
||||
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||
val b1 = subChunk.getB1();
|
||||
val b2Low = subChunk.getB2Low();
|
||||
val b2High = subChunk.getB2High();
|
||||
val b3 = subChunk.getB3();
|
||||
nbt.setByteArray("Blocks", b1);
|
||||
if (b2Low != null) {
|
||||
section.setByteArray("Add", b2Low.data);
|
||||
nbt.setByteArray("Add", b2Low.data);
|
||||
}
|
||||
if (b2High != null) {
|
||||
section.setByteArray("BlocksB2Hi", b2High.data);
|
||||
nbt.setByteArray("BlocksB2Hi", b2High.data);
|
||||
}
|
||||
if (b3 != null) {
|
||||
section.setByteArray("BlocksB3", b3);
|
||||
nbt.setByteArray("BlocksB3", b3);
|
||||
}
|
||||
}
|
||||
|
||||
//NotEnoughIDs world compatibility
|
||||
public static void readSectionFromNBTNotEnoughIDsDFU(IExtendedBlockStorageMixin ebs, NBTTagCompound section) {
|
||||
val data = section.getByteArray("Blocks16");
|
||||
public static void readSectionFromNBTNotEnoughIDsDFU(SubChunkBlockHook subChunk, NBTTagCompound nbt) {
|
||||
val data = nbt.getByteArray("Blocks16");
|
||||
val dataShort = new short[data.length >>> 1];
|
||||
ByteBuffer.wrap(data).asShortBuffer().get(dataShort);
|
||||
val b1 = new byte[dataShort.length];
|
||||
@@ -156,34 +156,34 @@ public class BlockIDManager implements DataManager.PacketDataManager, DataManage
|
||||
b2L[nI] |= ((s & 0x0F00) >>> 8) << mI;
|
||||
b2H[nI] |= ((s & 0xF000) >>> 12) << mI;
|
||||
}
|
||||
ebs.setB1(b1);
|
||||
ebs.setB2Low(new NibbleArray(b2L, 4));
|
||||
ebs.setB2High(new NibbleArray(b2H, 4));
|
||||
subChunk.setB1(b1);
|
||||
subChunk.setB2Low(new NibbleArray(b2L, 4));
|
||||
subChunk.setB2High(new NibbleArray(b2H, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||
if (section.hasKey("Blocks16")) {
|
||||
readSectionFromNBTNotEnoughIDsDFU(ebs, section);
|
||||
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||
if (nbt.hasKey("Blocks16")) {
|
||||
readSectionFromNBTNotEnoughIDsDFU(subChunk, nbt);
|
||||
return;
|
||||
}
|
||||
assert section.hasKey("Blocks");
|
||||
val b1 = section.getByteArray("Blocks");
|
||||
final byte[] b2Low = section.hasKey("Add") ? section.getByteArray("Add") : null;
|
||||
final byte[] b2High = section.hasKey("BlocksB2Hi") ? section.getByteArray("BlocksB2Hi") : null;
|
||||
final byte[] b3 = section.hasKey("BlocksB3") ? section.getByteArray("BlocksB3") : null;
|
||||
assert nbt.hasKey("Blocks");
|
||||
val b1 = nbt.getByteArray("Blocks");
|
||||
final byte[] b2Low = nbt.hasKey("Add") ? nbt.getByteArray("Add") : null;
|
||||
final byte[] b2High = nbt.hasKey("BlocksB2Hi") ? nbt.getByteArray("BlocksB2Hi") : null;
|
||||
final byte[] b3 = nbt.hasKey("BlocksB3") ? nbt.getByteArray("BlocksB3") : null;
|
||||
|
||||
ebs.setB1(b1);
|
||||
ebs.setB2Low(b2Low == null ? null : new NibbleArray(b2Low, 4));
|
||||
ebs.setB2High(b2High == null ? null : new NibbleArray(b2High, 4));
|
||||
ebs.setB3(b3);
|
||||
subChunk.setB1(b1);
|
||||
subChunk.setB2Low(b2Low == null ? null : new NibbleArray(b2Low, 4));
|
||||
subChunk.setB2High(b2High == null ? null : new NibbleArray(b2High, 4));
|
||||
subChunk.setB3(b3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage fromVanilla, ExtendedBlockStorage toVanilla) {
|
||||
val from = (IExtendedBlockStorageMixin) fromVanilla;
|
||||
val to = (IExtendedBlockStorageMixin) toVanilla;
|
||||
val from = (SubChunkBlockHook) fromVanilla;
|
||||
val to = (SubChunkBlockHook) toVanilla;
|
||||
|
||||
to.setB1(ArrayUtil.copyArray(from.getB1(), to.getB1()));
|
||||
to.setB2Low(ArrayUtil.copyArray(from.getB2Low(), to.getB2Low()));
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.falsepattern.endlessids.managers;
|
||||
import com.falsepattern.chunk.api.ArrayUtil;
|
||||
import com.falsepattern.chunk.api.DataManager;
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -34,29 +34,29 @@ public class BlockMetaManager implements DataManager.PacketDataManager, DataMana
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val ebsList = chunk.getBlockStorageArray();
|
||||
public void writeToBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer data) {
|
||||
val subChunkList = chunk.getBlockStorageArray();
|
||||
int storageFlags = 0;
|
||||
val start = data.position() + 4;
|
||||
data.position(start);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||
|
||||
storageFlags |= ebs.getEBSMask() << (i * 2);
|
||||
storageFlags |= subChunk.getMetadataMask() << (i * 2);
|
||||
|
||||
val m1Low = ebs.getM1Low();
|
||||
val m1Low = subChunk.getM1Low();
|
||||
data.put(m1Low.data);
|
||||
|
||||
val m1High = ebs.getM1High();
|
||||
val m1High = subChunk.getM1High();
|
||||
if (m1High == null) {
|
||||
continue;
|
||||
}
|
||||
data.put(m1High.data);
|
||||
|
||||
val m2 = ebs.getM2();
|
||||
val m2 = subChunk.getM2();
|
||||
if (m2 != null) {
|
||||
data.put(m2);
|
||||
}
|
||||
@@ -65,34 +65,34 @@ public class BlockMetaManager implements DataManager.PacketDataManager, DataMana
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val ebsList = chunk.getBlockStorageArray();
|
||||
public void readFromBuffer(Chunk chunk, int subChunkMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||
val subChunkList = chunk.getBlockStorageArray();
|
||||
val storageFlags = buffer.getInt();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||
if ((subChunkMask & (1 << i)) == 0 || subChunkList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||
val subChunk = (SubChunkBlockHook) subChunkList[i];
|
||||
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||
val m1Low = ebs.getM1Low();
|
||||
val m1Low = subChunk.getM1Low();
|
||||
buffer.get(m1Low.data);
|
||||
if (storageFlag == 0b01) {
|
||||
ebs.setM1High(null);
|
||||
ebs.setM2(null);
|
||||
subChunk.setM1High(null);
|
||||
subChunk.setM2(null);
|
||||
continue;
|
||||
}
|
||||
var m1High = ebs.getM1High();
|
||||
var m1High = subChunk.getM1High();
|
||||
if (m1High == null) {
|
||||
m1High = ebs.createM1High();
|
||||
m1High = subChunk.createM1High();
|
||||
}
|
||||
buffer.get(m1High.data);
|
||||
if (storageFlag == 0b10) {
|
||||
ebs.setM2(null);
|
||||
subChunk.setM2(null);
|
||||
continue;
|
||||
}
|
||||
var m2 = ebs.getM2();
|
||||
var m2 = subChunk.getM2();
|
||||
if (m2 == null) {
|
||||
m2 = ebs.createM2();
|
||||
m2 = subChunk.createM2();
|
||||
}
|
||||
buffer.get(m2);
|
||||
}
|
||||
@@ -104,37 +104,37 @@ public class BlockMetaManager implements DataManager.PacketDataManager, DataMana
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||
val m1Low = ebs.getM1Low();
|
||||
val m1High = ebs.getM1High();
|
||||
val m2 = ebs.getM2();
|
||||
section.setByteArray("Data", m1Low.data);
|
||||
public void writeSubChunkToNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||
val m1Low = subChunk.getM1Low();
|
||||
val m1High = subChunk.getM1High();
|
||||
val m2 = subChunk.getM2();
|
||||
nbt.setByteArray("Data", m1Low.data);
|
||||
if (m1High != null) {
|
||||
section.setByteArray("Data1High", m1High.data);
|
||||
nbt.setByteArray("Data1High", m1High.data);
|
||||
}
|
||||
if (m2 != null) {
|
||||
section.setByteArray("Data2", m2);
|
||||
nbt.setByteArray("Data2", m2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||
assert section.hasKey("Data");
|
||||
val m1Low = section.getByteArray("Data");
|
||||
final byte[] m1High = section.hasKey("Data1High") ? section.getByteArray("Data1High") : null;
|
||||
final byte[] m2 = section.hasKey("Data2") ? section.getByteArray("Data2") : null;
|
||||
public void readSubChunkFromNBT(Chunk chunk, ExtendedBlockStorage subChunkVanilla, NBTTagCompound nbt) {
|
||||
val subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||
assert nbt.hasKey("Data");
|
||||
val m1Low = nbt.getByteArray("Data");
|
||||
final byte[] m1High = nbt.hasKey("Data1High") ? nbt.getByteArray("Data1High") : null;
|
||||
final byte[] m2 = nbt.hasKey("Data2") ? nbt.getByteArray("Data2") : null;
|
||||
|
||||
ebs.setM1Low(new NibbleArray(m1Low, 4));
|
||||
ebs.setM1High(m1High == null ? null : new NibbleArray(m1High, 4));
|
||||
ebs.setM2(m2);
|
||||
subChunk.setM1Low(new NibbleArray(m1Low, 4));
|
||||
subChunk.setM1High(m1High == null ? null : new NibbleArray(m1High, 4));
|
||||
subChunk.setM2(m2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cloneSubChunk(Chunk fromChunk, ExtendedBlockStorage fromVanilla, ExtendedBlockStorage toVanilla) {
|
||||
val from = (IExtendedBlockStorageMixin) fromVanilla;
|
||||
val to = (IExtendedBlockStorageMixin) toVanilla;
|
||||
val from = (SubChunkBlockHook) fromVanilla;
|
||||
val to = (SubChunkBlockHook) toVanilla;
|
||||
|
||||
to.setM1Low(ArrayUtil.copyArray(from.getM1Low(), to.getM1Low()));
|
||||
to.setM1High(ArrayUtil.copyArray(from.getM1High(), to.getM1High()));
|
||||
|
||||
@@ -11,7 +11,7 @@ import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLA
|
||||
|
||||
public class BiomePatchHelper {
|
||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
|
||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
||||
@@ -20,7 +20,7 @@ public class BiomePatchHelper {
|
||||
}
|
||||
|
||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
|
||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
public interface IChunkMixin {
|
||||
public interface ChunkBiomeHook {
|
||||
short[] getBiomeShortArray();
|
||||
|
||||
void setBiomeShortArray(short[] data);
|
||||
+3
-3
@@ -2,7 +2,7 @@ package com.falsepattern.endlessids.mixin.helpers;
|
||||
|
||||
import net.minecraft.world.chunk.NibbleArray;
|
||||
|
||||
public interface IExtendedBlockStorageMixin {
|
||||
public interface SubChunkBlockHook {
|
||||
byte[] getB1();
|
||||
|
||||
void setB1(byte[] data);
|
||||
@@ -25,9 +25,9 @@ public interface IExtendedBlockStorageMixin {
|
||||
|
||||
byte[] createB3();
|
||||
|
||||
int getEBSMask();
|
||||
int getMetadataMask();
|
||||
|
||||
int getEBSMSBMask();
|
||||
int getBlockMask();
|
||||
|
||||
int getID(int x, int y, int z);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||
import hunternif.mc.atlas.core.BiomeDetectorBase;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -41,7 +41,7 @@ public abstract class BiomeDetectorBaseMixin {
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||
return ShortUtil.unsignedShortToIntArray(((ChunkBiomeHook) chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||
import hunternif.mc.atlas.core.BiomeDetectorNether;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -30,7 +30,7 @@ public abstract class BiomeDetectorNetherMixin {
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||
return ShortUtil.unsignedShortToIntArray(((ChunkBiomeHook) chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.biomewand;
|
||||
|
||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.spacechase0.minecraft.biomewand.BiomeWandMod;
|
||||
import com.spacechase0.minecraft.biomewand.item.BiomeWandItem;
|
||||
import com.spacechase0.minecraft.spacecore.util.TranslateUtils;
|
||||
@@ -42,7 +42,7 @@ public abstract class BiomeWandItemMixin {
|
||||
int relBlockX = blockX & 15;
|
||||
int relBlockZ = blockZ & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
short biome = ((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||
short biome = ((ChunkBiomeHook) chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||
tag.setShort("sampledBiomeS", biome);
|
||||
} else {
|
||||
short biome = tag.getShort("sampledBiomeS");
|
||||
@@ -52,7 +52,7 @@ public abstract class BiomeWandItemMixin {
|
||||
int relBlockX = ix & 15;
|
||||
int relBlockZ = iz & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||
((ChunkBiomeHook) chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||
chunk.isModified = true;
|
||||
BiomeWandMod.proxy.updateRendererAt(ix, iz);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.compactmachines;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.falsepattern.endlessids.mixin.stubpackage.org.dave.CompactMachines.tileentity.TileEntityMachine;
|
||||
import org.dave.CompactMachines.handler.ConfigurationHandler;
|
||||
import org.dave.CompactMachines.machines.tools.CubeTools;
|
||||
@@ -27,7 +27,7 @@ public abstract class CubeToolsMixin {
|
||||
WorldServer machineWorld = MinecraftServer.getServer().worldServerForDimension(ConfigurationHandler.dimensionId);
|
||||
Chunk chunk = machineWorld.getChunkFromBlockCoords(coords * ConfigurationHandler.cubeDistance, 0);
|
||||
if (chunk != null && chunk.isChunkLoaded) {
|
||||
short[] biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
short[] biomeArray = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
for (int x = 0; x < 15; ++x) {
|
||||
for (int z = 0; z < 15; ++z) {
|
||||
biomeArray[z << 4 | x] = (short) biome.biomeID;
|
||||
@@ -43,8 +43,8 @@ public abstract class CubeToolsMixin {
|
||||
*/
|
||||
@Overwrite
|
||||
public static BiomeGenBase getMachineBiome(TileEntityMachine machine) {
|
||||
short[] biomeArray = ((IChunkMixin) machine.getWorldObj()
|
||||
.getChunkFromBlockCoords(machine.xCoord,
|
||||
short[] biomeArray = ((ChunkBiomeHook) machine.getWorldObj()
|
||||
.getChunkFromBlockCoords(machine.xCoord,
|
||||
machine.zCoord)).getBiomeShortArray();
|
||||
int biomeId = biomeArray[(machine.zCoord & 15) << 4 | machine.xCoord & 15];
|
||||
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length &&
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Libraries.World.ReikaChunkHelper;
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -20,7 +20,7 @@ public abstract class ReikaChunkHelperMixin {
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static void customSet(Chunk chunk, byte[] p_76616_1_) {
|
||||
((IChunkMixin) chunk).setBiomeShortArray(biomeArray);
|
||||
((ChunkBiomeHook) chunk).setBiomeShortArray(biomeArray);
|
||||
biomeArray = null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class ReikaChunkHelperMixin {
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static byte[] customGet(Chunk chunk) {
|
||||
biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
biomeArray = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -2,7 +2,7 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi;
|
||||
|
||||
import Reika.DragonAPI.Libraries.World.ReikaWorldHelper;
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -45,7 +45,7 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||
require = 1)
|
||||
private static void customLogicSetBiome(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
((ChunkBiomeHook) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
|
||||
@Inject(method = "setBiomeAndBlocksForXZ",
|
||||
@@ -55,7 +55,7 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void captureIndexSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
fromBiomeID = ((IChunkMixin) ch).getBiomeShortArray()[index];
|
||||
fromBiomeID = ((ChunkBiomeHook) ch).getBiomeShortArray()[index];
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "setBiomeAndBlocksForXZ",
|
||||
@@ -72,6 +72,6 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void customLogicSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index, BiomeGenBase from) {
|
||||
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
((ChunkBiomeHook) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.enderlicious;
|
||||
|
||||
import DelirusCrux.Enderlicious.Dimension.EndChunkProvider;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -39,7 +39,7 @@ public abstract class EndChunkProviderMixin {
|
||||
remap = true,
|
||||
require = 1)
|
||||
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
for (int k = 0; k < chunkBiomes.length; ++k) {
|
||||
if (Math.abs(xx) < 160 && Math.abs(zz) < 160) {
|
||||
chunkBiomes[k] = 9;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.extrautilities;
|
||||
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -45,7 +45,7 @@ public abstract class ChunkProviderEndOfTimeMixin {
|
||||
require = 1)
|
||||
private void setBiomesTweaked3(byte[] bytes, byte b) {
|
||||
try {
|
||||
Arrays.fill(((IChunkMixin) chunk).getBiomeShortArray(), (short) id);
|
||||
Arrays.fill(((ChunkBiomeHook) chunk).getBiomeShortArray(), (short) id);
|
||||
} finally {
|
||||
chunk = null;
|
||||
id = -1;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.ir3;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import jp.plusplus.ir2.IR2;
|
||||
import jp.plusplus.ir2.blocks.BlockCore;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -62,7 +62,7 @@ public abstract class IR2Mixin {
|
||||
}
|
||||
}
|
||||
|
||||
short[] bIds = ((IChunkMixin)event.world.getChunkFromBlockCoords(event.worldX, event.worldZ)).getBiomeShortArray();
|
||||
short[] bIds = ((ChunkBiomeHook)event.world.getChunkFromBlockCoords(event.worldX, event.worldZ)).getBiomeShortArray();
|
||||
|
||||
for(int k = 0; k < bIds.length; ++k) {
|
||||
if (bIds[k] == BiomeGenBase.ocean.biomeID || bIds[k] == BiomeGenBase.deepOcean.biomeID) {
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.nomadictents;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import com.yurtmod.dimension.TentChunkProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -23,6 +23,6 @@ public abstract class TentChunkProviderMixin {
|
||||
private void setBiomesTweaked(Chunk chunk, byte[] p_76616_1_) {
|
||||
short[] biomeMap = new short[256];
|
||||
Arrays.fill(biomeMap, (short) BiomeGenBase.ocean.biomeID);
|
||||
((IChunkMixin) chunk).setBiomeShortArray(biomeMap);
|
||||
((ChunkBiomeHook) chunk).setBiomeShortArray(biomeMap);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.randomthings;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import lumien.randomthings.Items.ItemBiomeCapsule;
|
||||
import lumien.randomthings.Items.ItemBiomePainter;
|
||||
import lumien.randomthings.Items.ModItems;
|
||||
@@ -40,10 +40,10 @@ public abstract class ItemBiomePainterMixin {
|
||||
if (charges > 0 || par2EntityPlayer.capabilities.isCreativeMode) {
|
||||
Chunk c = par3World.getChunkFromBlockCoords(par4, par6);
|
||||
int biomeID = is.getItemDamage() - 1;
|
||||
short[] biomeArray = ((IChunkMixin) c).getBiomeShortArray(); //changed
|
||||
short[] biomeArray = ((ChunkBiomeHook) c).getBiomeShortArray(); //changed
|
||||
if ((biomeArray[(par6 & 15) << 4 | par4 & 15] & 255) != biomeID) {
|
||||
biomeArray[(par6 & 15) << 4 | par4 & 15] = (short) (biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin) c).setBiomeShortArray(biomeArray); //changed
|
||||
((ChunkBiomeHook) c).setBiomeShortArray(biomeArray); //changed
|
||||
if (!par2EntityPlayer.capabilities.isCreativeMode) {
|
||||
nbt.setInteger("charges", charges - 1);
|
||||
par2EntityPlayer.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.randomthings;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import lumien.randomthings.Items.ItemBiomeCapsule;
|
||||
import lumien.randomthings.Network.Messages.MessagePaintBiome;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -49,9 +49,9 @@ public abstract class MessagePaintBiomeMixin {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null && player.worldObj.provider.dimensionId == this.dimensionID) {
|
||||
Chunk c = player.worldObj.getChunkFromBlockCoords(this.posX, this.posZ);
|
||||
short[] biomeArray = ((IChunkMixin) c).getBiomeShortArray(); //changed
|
||||
short[] biomeArray = ((ChunkBiomeHook) c).getBiomeShortArray(); //changed
|
||||
biomeArray[(this.posZ & 15) << 4 | this.posX & 15] = (short) (this.biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin) c).setBiomeShortArray(biomeArray); //changed
|
||||
((ChunkBiomeHook) c).setBiomeShortArray(biomeArray); //changed
|
||||
Minecraft.getMinecraft().thePlayer.worldObj.markBlocksDirtyVertical(this.posX, this.posZ, 0,
|
||||
player.worldObj.getActualHeight());
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(this.biomeID);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.restructured;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import org.blockartistry.mod.Restructured.world.BiomeHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
@@ -21,7 +21,7 @@ public abstract class BiomeHelperMixin {
|
||||
*/
|
||||
@Overwrite
|
||||
public static BiomeGenBase chunkBiomeSurvey(World world, Chunk chunk, Random rand) {
|
||||
short[] biomes = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
short[] biomes = ((ChunkBiomeHook)chunk).getBiomeShortArray();
|
||||
int[] counts = new int[biomes.length];
|
||||
int highIndex = BiomeGenBase.plains.biomeID;
|
||||
int highCount = -1;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.biome.thaumcraft;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
@@ -24,7 +24,7 @@ public abstract class UtilsMixin {
|
||||
public static void setBiomeAt(World world, int x, int z, BiomeGenBase biome) {
|
||||
if (biome != null) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
short[] array = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
short[] array = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
array[(z & 15) << 4 | x & 15] = (short) (biome.biomeID);
|
||||
if (!world.isRemote) {
|
||||
PacketHandler.INSTANCE.sendToAllAround(new PacketBiomeChange(x, z, (short) biome.biomeID),
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.vanilla;
|
||||
import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -23,7 +23,7 @@ import java.util.Arrays;
|
||||
|
||||
@Mixin(value = Chunk.class,
|
||||
priority = 900)
|
||||
public abstract class ChunkMixin implements IChunkMixin {
|
||||
public abstract class ChunkMixin implements ChunkBiomeHook {
|
||||
@Shadow
|
||||
@Final
|
||||
public int xPosition;
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.ubc;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||
import exterminatorJeff.undergroundBiomes.worldGen.BiomeUndergroundDecorator;
|
||||
import lombok.val;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
||||
remap = false)
|
||||
public abstract class BiomeUndergroundDecoratorMixin {
|
||||
private static NibbleArray fakeArray;
|
||||
private IExtendedBlockStorageMixin ebs;
|
||||
private SubChunkBlockHook subChunk;
|
||||
|
||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||
"replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
||||
@@ -24,10 +24,10 @@ public abstract class BiomeUndergroundDecoratorMixin {
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B",
|
||||
remap = true),
|
||||
require = 2)
|
||||
private byte[] returnLSB(ExtendedBlockStorage instance) {
|
||||
IExtendedBlockStorageMixin iebs = (IExtendedBlockStorageMixin) instance;
|
||||
ebs = iebs;
|
||||
return iebs.getB1();
|
||||
private byte[] returnLSB(ExtendedBlockStorage subChunkVanilla) {
|
||||
SubChunkBlockHook subChunk = (SubChunkBlockHook) subChunkVanilla;
|
||||
this.subChunk = subChunk;
|
||||
return subChunk.getB1();
|
||||
}
|
||||
|
||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||
@@ -47,8 +47,8 @@ public abstract class BiomeUndergroundDecoratorMixin {
|
||||
remap = true),
|
||||
require = 2)
|
||||
private int returnRestOfID(NibbleArray instance, int x, int y, int z) {
|
||||
val id = ebs.getID(x, y, z) >>> 8;
|
||||
ebs = null;
|
||||
val id = subChunk.getID(x, y, z) >>> 8;
|
||||
subChunk = null;
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@ import com.falsepattern.endlessids.EndlessIDs;
|
||||
import com.falsepattern.endlessids.Hooks;
|
||||
import com.falsepattern.endlessids.Tags;
|
||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import com.falsepattern.endlessids.mixin.helpers.SubChunkBlockHook;
|
||||
import lombok.val;
|
||||
import lombok.var;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.world.chunk.NibbleArray;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
@Mixin(ExtendedBlockStorage.class)
|
||||
public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorageMixin {
|
||||
public abstract class ExtendedBlockStorageMixin implements SubChunkBlockHook {
|
||||
@Shadow
|
||||
private int blockRefCount;
|
||||
@Shadow
|
||||
@@ -272,7 +272,7 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEBSMSBMask() {
|
||||
public int getBlockMask() {
|
||||
if (blockMSBArray == null) {
|
||||
return 0b00;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEBSMask() {
|
||||
public int getMetadataMask() {
|
||||
if (m1High == null) {
|
||||
return 0b01;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user