Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
Merge branch 'dev' into abstraction
# Conflicts: # bukkit/pom.xml # bungee/pom.xml # common/pom.xml # common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/Protocol1_15To1_14_4.java # common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/packets/EntityPackets.java # common/src/main/java/us/myles/ViaVersion/protocols/protocol1_15to1_14_4/types/Chunk1_15Type.java # jar/pom.xml # pom.xml # sponge-legacy/pom.xml # sponge/pom.xml # velocity/pom.xml
Dieser Commit ist enthalten in:
Commit
9174ad854c
@ -39,11 +39,11 @@ public class Entity1_15Types {
|
||||
LLAMA_SPIT(40, ENTITY),
|
||||
TNT(59, ENTITY),
|
||||
SHULKER_BULLET(64, ENTITY),
|
||||
FISHING_BOBBER(111, ENTITY),
|
||||
FISHING_BOBBER(102, ENTITY),
|
||||
|
||||
LIVINGENTITY(-1, ENTITY),
|
||||
ARMOR_STAND(1, LIVINGENTITY),
|
||||
PLAYER(110, LIVINGENTITY),
|
||||
PLAYER(101, LIVINGENTITY),
|
||||
|
||||
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
||||
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
|
||||
|
@ -17,6 +17,8 @@ public interface Chunk {
|
||||
|
||||
int[] getBiomeData();
|
||||
|
||||
void setBiomeData(int[] biomeData);
|
||||
|
||||
CompoundTag getHeightMap();
|
||||
|
||||
void setHeightMap(CompoundTag heightMap);
|
||||
|
@ -77,7 +77,7 @@ public class ProtocolVersion {
|
||||
register(v1_14_2 = new ProtocolVersion(485, "1.14.2"));
|
||||
register(v1_14_3 = new ProtocolVersion(490, "1.14.3"));
|
||||
register(v1_14_4 = new ProtocolVersion(498, "1.14.4"));
|
||||
register(v1_15 = new ProtocolVersion(565, "1.15"));
|
||||
register(v1_15 = new ProtocolVersion(571, "1.15"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,7 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
||||
registerOutgoing(State.PLAY, 0x08, 0x09);
|
||||
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x0C, 0x0D);
|
||||
registerOutgoing(State.PLAY, 0x0D, 0x0E);
|
||||
registerOutgoing(State.PLAY, 0x0E, 0x0F);
|
||||
registerOutgoing(State.PLAY, 0x10, 0x11);
|
||||
@ -201,6 +202,7 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
||||
registerOutgoing(State.PLAY, 0x34, 0x35);
|
||||
registerOutgoing(State.PLAY, 0x35, 0x36);
|
||||
registerOutgoing(State.PLAY, 0x36, 0x37);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x38, 0x39);
|
||||
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
||||
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
||||
|
@ -83,6 +83,26 @@ public class WorldPackets {
|
||||
Chunk chunk = wrapper.read(new Chunk1_14Type(clientWorld));
|
||||
wrapper.write(new Chunk1_15Type(clientWorld), chunk);
|
||||
|
||||
if (chunk.isGroundUp()) {
|
||||
int[] biomeData = chunk.getBiomeData();
|
||||
int[] newBiomeData = new int[1024];
|
||||
// Now in 4x4x4 areas - take the biome of each "middle"
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
int x = (j << 2) + 2;
|
||||
int z = (i << 2) + 2;
|
||||
int oldIndex = (z << 4 | x);
|
||||
newBiomeData[i << 2 | j] = biomeData[oldIndex];
|
||||
}
|
||||
}
|
||||
// ... and copy it to the new y layers
|
||||
for (int i = 1; i < 64; ++i) {
|
||||
System.arraycopy(newBiomeData, 0, newBiomeData, i * 16, 16);
|
||||
}
|
||||
|
||||
chunk.setBiomeData(newBiomeData);
|
||||
}
|
||||
|
||||
for (int s = 0; s < 16; s++) {
|
||||
ChunkSection section = chunk.getSections()[s];
|
||||
if (section == null) continue;
|
||||
@ -125,9 +145,9 @@ public class WorldPackets {
|
||||
public void registerMap() {
|
||||
map(Type.INT); // 0 - Particle ID
|
||||
map(Type.BOOLEAN); // 1 - Long Distance
|
||||
map(Type.FLOAT); // 2 - X
|
||||
map(Type.FLOAT); // 3 - Y
|
||||
map(Type.FLOAT); // 4 - Z
|
||||
map(Type.FLOAT, Type.DOUBLE); // 2 - X
|
||||
map(Type.FLOAT, Type.DOUBLE); // 3 - Y
|
||||
map(Type.FLOAT, Type.DOUBLE); // 4 - Z
|
||||
map(Type.FLOAT); // 5 - Offset X
|
||||
map(Type.FLOAT); // 6 - Offset Y
|
||||
map(Type.FLOAT); // 7 - Offset Z
|
||||
|
@ -32,12 +32,10 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
||||
int primaryBitmask = Type.VAR_INT.read(input);
|
||||
CompoundTag heightMap = Type.NBT.read(input);
|
||||
|
||||
int[] biomeData = groundUp ? new int[256] : null;
|
||||
int[] biomeData = groundUp ? new int[1024] : null;
|
||||
if (groundUp) {
|
||||
//TODO Why 1024 ints?
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
//biomeData[i] = input.readInt();
|
||||
input.readInt();
|
||||
biomeData[i] = input.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,13 +83,9 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
||||
|
||||
// Write biome data
|
||||
if (chunk.isBiomeData()) {
|
||||
//TODO Why 1024 ints?
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
output.writeInt(0);
|
||||
for (int value : chunk.getBiomeData()) {
|
||||
output.writeInt(value);
|
||||
}
|
||||
/*for (int value : chunk.getBiomeData()) {
|
||||
output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :)
|
||||
}*/
|
||||
}
|
||||
|
||||
ByteBuf buf = output.alloc().buffer();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren