3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-03 14:18:03 +02:00
Ship it™️ https://i.imgur.com/9R1gYOe.png
Dieser Commit ist enthalten in:
KennyTV 2021-02-10 19:37:28 +01:00
Ursprung 600c843747
Commit ab0406ba77
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
10 geänderte Dateien mit 35 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-all</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-bukkit</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-bungee</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-core</artifactId>

Datei anzeigen

@ -18,6 +18,7 @@ import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_16_4To1_17> {
@ -171,6 +172,8 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
Chunk chunk = wrapper.read(new Chunk1_17Type(currentWorldSectionHeight));
wrapper.write(new Chunk1_16_2Type(), chunk);
chunk.setBiomeData(Arrays.copyOf(chunk.getBiomeData(), 1024));
// Cut down to int mask
chunk.setBitmask(cutLongArrayMask(chunk.getChunkMask().toLongArray()));
chunk.setChunkMask(null);

Datei anzeigen

@ -19,6 +19,8 @@ import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17
import us.myles.viaversion.libs.gson.JsonElement;
import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.IntTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag;
import us.myles.viaversion.libs.opennbt.tag.builtin.Tag;
public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
@ -53,7 +55,16 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
});
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
handler(getWorldDataTracker(1));
handler(wrapper -> warnForExtendedHeight(wrapper.get(Type.NBT, 1)));
handler(wrapper -> {
CompoundTag dimensionRegistry = wrapper.get(Type.NBT, 0).get("minecraft:dimension_type");
ListTag dimensions = dimensionRegistry.get("value");
for (Tag dimension : dimensions) {
CompoundTag dimensionCompound = ((CompoundTag) dimension).get("element");
reduceForExtendedHeight(dimensionCompound, false);
}
reduceForExtendedHeight(wrapper.get(Type.NBT, 1), true);
});
}
});
protocol.registerOutgoing(ClientboundPackets1_17.RESPAWN, new PacketRemapper() {
@ -61,7 +72,7 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
public void registerMap() {
map(Type.NBT); // Dimension data
handler(getWorldDataTracker(0));
handler(wrapper -> warnForExtendedHeight(wrapper.get(Type.NBT, 0)));
handler(wrapper -> reduceForExtendedHeight(wrapper.get(Type.NBT, 0), true));
}
});
@ -149,12 +160,18 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
return Entity1_17Types.getTypeFromId(typeId);
}
private void warnForExtendedHeight(CompoundTag tag) {
private void reduceForExtendedHeight(CompoundTag tag, boolean warn) {
IntTag minY = tag.get("min_y");
IntTag height = tag.get("height");
if (minY.getValue() != 0 || height.getValue() != 256) {
ViaBackwards.getPlatform().getLogger().severe("Custom worlds heights are NOT SUPPORTED for 1.16 players and older and may lead to errors!");
ViaBackwards.getPlatform().getLogger().severe("You have min/max set to " + minY.getValue() + "/" + height.getValue());
IntTag logicalHeight = tag.get("logical_height");
if (minY.getValue() != 0 || height.getValue() > 256 || logicalHeight.getValue() > 256) {
if (warn) {
ViaBackwards.getPlatform().getLogger().severe("Custom worlds heights are NOT SUPPORTED for 1.16 players and older and may lead to errors!");
ViaBackwards.getPlatform().getLogger().severe("You have min/max set to " + minY.getValue() + "/" + height.getValue());
}
height.setValue(Math.min(256, height.getValue()));
logicalHeight.setValue(Math.min(256, logicalHeight.getValue()));
}
}
}

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-fabric</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-parent</artifactId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
<packaging>pom</packaging>
<description>Allow older clients to join newer server versions.</description>
@ -65,7 +65,7 @@
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
<scope>provided</scope>
</dependency>

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-sponge</artifactId>

Datei anzeigen

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w05b</version>
<version>3.3.0-21w06b</version>
</parent>
<artifactId>viabackwards-velocity</artifactId>