Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 13:30:14 +01:00
21w37a works™️
Co-authored-by: Gerrygames <gecam59@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
87ad6bd2b1
Commit
deb11bf1a9
@ -28,6 +28,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||
@ -42,6 +43,8 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_18To1_17_1.class, MAPPINGS::load);
|
||||
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
|
@ -37,6 +37,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||
import com.viaversion.viaversion.util.MathUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
@ -104,7 +105,10 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
|
||||
final Chunk oldChunk = wrapper.read(new Chunk1_18Type(tracker.currentWorldSectionHeight()));
|
||||
final Chunk1_18Type chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(),
|
||||
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()),
|
||||
MathUtil.ceilLog2(tracker.biomesSent()));
|
||||
final Chunk oldChunk = wrapper.read(chunkType);
|
||||
final int[] biomeData = new int[oldChunk.getSections().length * 64];
|
||||
final ChunkSection[] sections = oldChunk.getSections();
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
@ -127,7 +131,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
|
||||
|
||||
final List<CompoundTag> blockEntityTags = new ArrayList<>(oldChunk.blockEntities().size());
|
||||
for (final BlockEntity blockEntity : oldChunk.blockEntities()) {
|
||||
final CompoundTag tag = blockEntity.tag();
|
||||
final CompoundTag tag = blockEntity.tag() != null ? blockEntity.tag() : new CompoundTag();
|
||||
final String id = protocol.getMappingData().blockEntities().get(blockEntity.typeId());
|
||||
if (id == null) {
|
||||
// Shrug
|
||||
|
@ -77,6 +77,9 @@ public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18
|
||||
biomeCompound.put("depth", new FloatTag(0.125F));
|
||||
biomeCompound.put("scale", new FloatTag(0.05F));
|
||||
}
|
||||
|
||||
// Track amount of biomes sent
|
||||
tracker(wrapper.user()).setBiomesSent(biomes.size());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren