Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Merge branch 'master' into dev
Dieser Commit ist enthalten in:
Commit
54b35ef075
@ -9,13 +9,13 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
public class BaseChunk implements Chunk {
|
public class BaseChunk implements Chunk {
|
||||||
protected int x;
|
protected int x;
|
||||||
protected int z;
|
protected int z;
|
||||||
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
|
||||||
public boolean isBiomeData() {
|
public boolean isBiomeData() {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,15 @@ import us.myles.ViaVersion.api.remapper.ValueTransformer;
|
|||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.PacketBlockConnectionProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.EntityPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.EntityPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockConnectionStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker;
|
||||||
@ -1042,6 +1045,11 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
if (!userConnection.has(ClientWorld.class))
|
if (!userConnection.has(ClientWorld.class))
|
||||||
userConnection.put(new ClientWorld(userConnection));
|
userConnection.put(new ClientWorld(userConnection));
|
||||||
userConnection.put(new BlockStorage(userConnection));
|
userConnection.put(new BlockStorage(userConnection));
|
||||||
|
if (Via.getConfig().isServersideBlockConnections()) {
|
||||||
|
if (Via.getManager().getProviders().get(BlockConnectionProvider.class) instanceof PacketBlockConnectionProvider) {
|
||||||
|
userConnection.put(new BlockConnectionStorage(userConnection));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -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