Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Change Chunk#getBiomeData() to int[]
Dieser Commit ist enthalten in:
Ursprung
83ba55dda5
Commit
c5c7d36bd1
@ -14,7 +14,7 @@ public class BaseChunk implements Chunk {
|
|||||||
protected boolean groundUp;
|
protected boolean groundUp;
|
||||||
protected int bitmask;
|
protected int bitmask;
|
||||||
protected ChunkSection[] sections;
|
protected ChunkSection[] sections;
|
||||||
protected byte[] biomeData;
|
protected int[] biomeData;
|
||||||
protected List<CompoundTag> blockEntities;
|
protected List<CompoundTag> blockEntities;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,7 +15,7 @@ public interface Chunk {
|
|||||||
|
|
||||||
ChunkSection[] getSections();
|
ChunkSection[] getSections();
|
||||||
|
|
||||||
byte[] getBiomeData();
|
int[] getBiomeData();
|
||||||
|
|
||||||
List<CompoundTag> getBlockEntities();
|
List<CompoundTag> getBlockEntities();
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ public class Chunk1_8 extends BaseChunk {
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean unloadPacket = false;
|
private boolean unloadPacket = false;
|
||||||
|
|
||||||
public Chunk1_8(int x, int z, boolean groundUp, int bitmask, ChunkSection[] sections, byte[] biomeData, List<CompoundTag> blockEntities) {
|
public Chunk1_8(int x, int z, boolean groundUp, int bitmask, ChunkSection[] sections, int[] biomeData, List<CompoundTag> blockEntities) {
|
||||||
super(x, z, groundUp, bitmask, sections, biomeData, blockEntities);
|
super(x, z, groundUp, bitmask, sections, biomeData, blockEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public class WorldPackets {
|
|||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
int latestBiomeWarn = Integer.MIN_VALUE;
|
int latestBiomeWarn = Integer.MIN_VALUE;
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
int biome = chunk.getBiomeData()[i] & 0xFF;
|
int biome = chunk.getBiomeData()[i];
|
||||||
if (!validBiomes.contains(biome)) {
|
if (!validBiomes.contains(biome)) {
|
||||||
if (biome != 255 // is it generated naturally? *shrug*
|
if (biome != 255 // is it generated naturally? *shrug*
|
||||||
&& latestBiomeWarn != biome) {
|
&& latestBiomeWarn != biome) {
|
||||||
|
@ -52,11 +52,10 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] biomeData = groundUp ? new byte[256] : null;
|
int[] biomeData = groundUp ? new int[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
// todo use int in Chunk?
|
biomeData[i] = input.readInt();
|
||||||
biomeData[i] = (byte) input.readInt();;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +98,8 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
for (byte value : chunk.getBiomeData()) {
|
for (int value : chunk.getBiomeData()) {
|
||||||
output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :)
|
output.writeInt(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,11 @@ public class Chunk1_9_3_4Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] biomeData = groundUp ? new byte[256] : null;
|
int[] biomeData = groundUp ? new int[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
input.readBytes(biomeData);
|
for (int i = 0; i < 256; i++) {
|
||||||
|
biomeData[i] = input.readByte() & 0xFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));
|
List<CompoundTag> nbtData = new ArrayList<>(Arrays.asList(Type.NBT_ARRAY.read(input)));
|
||||||
@ -97,7 +99,9 @@ public class Chunk1_9_3_4Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
output.writeBytes(chunk.getBiomeData());
|
for (int biome : chunk.getBiomeData()) {
|
||||||
|
buf.writeByte((byte) biome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Block Entities
|
// Write Block Entities
|
||||||
|
@ -59,9 +59,11 @@ public class Chunk1_9_1_2Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] biomeData = groundUp ? new byte[256] : null;
|
int[] biomeData = groundUp ? new int[256] : null;
|
||||||
if (groundUp) {
|
if (groundUp) {
|
||||||
input.readBytes(biomeData);
|
for (int i = 0; i < 256; i++) {
|
||||||
|
biomeData[i] = input.readByte() & 0xFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseChunk(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, new ArrayList<CompoundTag>());
|
return new BaseChunk(chunkX, chunkZ, groundUp, primaryBitmask, sections, biomeData, new ArrayList<CompoundTag>());
|
||||||
@ -93,7 +95,9 @@ public class Chunk1_9_1_2Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
output.writeBytes(chunk.getBiomeData());
|
for (int biome : chunk.getBiomeData()) {
|
||||||
|
output.writeByte((byte) biome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class Chunk1_9to1_8Type extends PartialType<Chunk, ClientChunks> {
|
|||||||
// Data to be read
|
// Data to be read
|
||||||
BitSet usedSections = new BitSet(16);
|
BitSet usedSections = new BitSet(16);
|
||||||
ChunkSection[] sections = new ChunkSection[16];
|
ChunkSection[] sections = new ChunkSection[16];
|
||||||
byte[] biomeData = null;
|
int[] biomeData = null;
|
||||||
|
|
||||||
// Calculate section count from bitmask
|
// Calculate section count from bitmask
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
@ -112,8 +112,10 @@ public class Chunk1_9to1_8Type extends PartialType<Chunk, ClientChunks> {
|
|||||||
|
|
||||||
// Read biome data
|
// Read biome data
|
||||||
if (bytesLeft >= BIOME_DATA_LENGTH) {
|
if (bytesLeft >= BIOME_DATA_LENGTH) {
|
||||||
biomeData = new byte[BIOME_DATA_LENGTH];
|
biomeData = new int[BIOME_DATA_LENGTH];
|
||||||
input.readBytes(biomeData);
|
for (int i = 0; i < BIOME_DATA_LENGTH; i++){
|
||||||
|
biomeData[i] = input.readByte() & 0xFF;
|
||||||
|
}
|
||||||
bytesLeft -= BIOME_DATA_LENGTH;
|
bytesLeft -= BIOME_DATA_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +158,9 @@ public class Chunk1_9to1_8Type extends PartialType<Chunk, ClientChunks> {
|
|||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.hasBiomeData()) {
|
if (chunk.hasBiomeData()) {
|
||||||
output.writeBytes(chunk.getBiomeData());
|
for (int biome : chunk.getBiomeData()) {
|
||||||
|
buf.writeByte((byte) biome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren