mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2025-01-02 18:48:06 +01:00
21w37a (probably)
This commit is contained in:
parent
5777f4a117
commit
3054b758df
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
group = "com.viaversion"
|
||||||
version = "4.1.0-SNAPSHOT"
|
version = "4.1.0-21w37a-SNAPSHOT"
|
||||||
description = "Allow older clients to join newer server versions."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public class BackwardsMappings extends MappingDataBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable String getMappedNamedSound(String id) {
|
public @Nullable String getMappedNamedSound(String id) {
|
||||||
if (backwardsItemMappings == null) {
|
if (backwardsSoundMappings == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,61 +18,40 @@
|
|||||||
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18;
|
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18;
|
||||||
|
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BackwardsMappings;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.EntityPackets1_18;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
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_17to1_16_4.ServerboundPackets1_17;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type;
|
|
||||||
|
|
||||||
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
|
public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPackets1_17_1, ClientboundPackets1_17_1, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||||
|
|
||||||
|
private static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||||
|
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
|
||||||
|
private final BlockItemPackets1_18 itemRewriter = new BlockItemPackets1_18(this, null); //TODO translatablerewriter
|
||||||
|
|
||||||
public Protocol1_17_1To1_18() {
|
public Protocol1_17_1To1_18() {
|
||||||
super(ClientboundPackets1_17_1.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
|
super(ClientboundPackets1_17_1.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, new PacketRemapper() {
|
entityRewriter.register();
|
||||||
@Override
|
itemRewriter.register();
|
||||||
public void registerMap() {
|
}
|
||||||
handler(wrapper -> {
|
|
||||||
final EntityTracker tracker = getEntityRewriter().tracker(wrapper.user());
|
|
||||||
final Chunk chunk = wrapper.passthrough(new Chunk1_17Type(tracker.currentWorldSectionHeight()));
|
|
||||||
/*for (int s = 0; s < chunk.getSections().length; s++) {
|
|
||||||
ChunkSection section = chunk.getSections()[s];
|
|
||||||
if (section == null) continue;
|
|
||||||
for (int i = 0; i < section.getPaletteSize(); i++) {
|
|
||||||
int old = section.getPaletteEntry(i);
|
|
||||||
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Create and send light packet first
|
@Override
|
||||||
final PacketWrapper lightPacket = wrapper.create(ClientboundPackets1_17_1.UPDATE_LIGHT);
|
public BackwardsMappings getMappingData() {
|
||||||
lightPacket.write(Type.BOOLEAN, wrapper.read(Type.BOOLEAN)); // Trust edges
|
return MAPPINGS;
|
||||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Sky light mask
|
}
|
||||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Block light mask
|
|
||||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty sky light mask
|
|
||||||
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty block light mask
|
|
||||||
|
|
||||||
final int skyLightLength = wrapper.read(Type.VAR_INT);
|
@Override
|
||||||
lightPacket.write(Type.VAR_INT, skyLightLength);
|
public EntityPackets1_18 getEntityRewriter() {
|
||||||
for (int i = 0; i < skyLightLength; i++) {
|
return entityRewriter;
|
||||||
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final int blockLightLength = wrapper.read(Type.VAR_INT);
|
@Override
|
||||||
lightPacket.write(Type.VAR_INT, blockLightLength);
|
public BlockItemPackets1_18 getItemRewriter() {
|
||||||
for (int i = 0; i < blockLightLength; i++) {
|
return itemRewriter;
|
||||||
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
|
||||||
}
|
|
||||||
|
|
||||||
lightPacket.send(Protocol1_17_1To1_18.class);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||||
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap;
|
||||||
|
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||||
|
|
||||||
|
public final class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings {
|
||||||
|
|
||||||
|
private final Int2ObjectMap<String> blockEntities = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
|
public BackwardsMappings() {
|
||||||
|
super("1.18", "1.17", Protocol1_18To1_17_1.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadVBExtras(final JsonObject oldMappings, final JsonObject newMappings) {
|
||||||
|
for (final Object2IntMap.Entry<String> entry : Protocol1_18To1_17_1.MAPPINGS.blockEntityIds().object2IntEntrySet()) {
|
||||||
|
blockEntities.put(entry.getIntValue(), entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Int2ObjectMap<String> blockEntities() {
|
||||||
|
return blockEntities;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public final class BlockEntityIds {
|
||||||
|
|
||||||
|
private static final int[] IDS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
final int[] ids = com.viaversion.viaversion.protocols.protocol1_18to1_17_1.BlockEntityIds.getIds();
|
||||||
|
IDS = new int[Arrays.stream(ids).max().getAsInt() + 1];
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
IDS[ids[i]] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int mappedId(final int id) {
|
||||||
|
if (id < 0 || id > IDS.length) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return IDS[id];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||||
|
* Copyright (C) 2016-2021 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets;
|
||||||
|
|
||||||
|
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||||
|
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||||
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.Protocol1_17_1To1_18;
|
||||||
|
import com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.data.BlockEntityIds;
|
||||||
|
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.IntTag;
|
||||||
|
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 java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_18> {
|
||||||
|
|
||||||
|
private static final int WIDTH_BITS = 2;
|
||||||
|
private static final int HORIZONTAL_MASK = 3;
|
||||||
|
private static final int BIOMES_PER_CHUNK = 4 * 4 * 4;
|
||||||
|
|
||||||
|
public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol, final TranslatableRewriter translatableRewriter) {
|
||||||
|
super(protocol, translatableRewriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerPackets() {
|
||||||
|
/*final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||||
|
|
||||||
|
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17_1.DECLARE_RECIPES);
|
||||||
|
|
||||||
|
registerSetCooldown(ClientboundPackets1_17_1.COOLDOWN);
|
||||||
|
registerWindowItems(ClientboundPackets1_17_1.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
|
registerSetSlot(ClientboundPackets1_17_1.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerEntityEquipmentArray(ClientboundPackets1_17_1.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerTradeList(ClientboundPackets1_17_1.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerAdvancements(ClientboundPackets1_17_1.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerClickWindow1_17(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
|
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_17_1.ACKNOWLEDGE_PLAYER_DIGGING);
|
||||||
|
blockRewriter.registerBlockAction(ClientboundPackets1_17_1.BLOCK_ACTION);
|
||||||
|
blockRewriter.registerEffect(ClientboundPackets1_17_1.EFFECT, 1010, 2001);
|
||||||
|
blockRewriter.registerBlockChange(ClientboundPackets1_17_1.BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_17_1.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
|
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
protocol.registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerSpawnParticle(ClientboundPackets1_17_1.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);*/
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_17_1.BLOCK_ENTITY_DATA, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.POSITION1_14);
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int id = wrapper.read(Type.VAR_INT);
|
||||||
|
final int mappedId = BlockEntityIds.mappedId(id);
|
||||||
|
if (mappedId == -1) {
|
||||||
|
wrapper.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_17_1.CHUNK_DATA, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
|
||||||
|
final Chunk oldChunk = wrapper.read(new Chunk1_18Type(tracker.currentWorldSectionHeight()));
|
||||||
|
final int[] biomeData = new int[oldChunk.getSections().length * 64];
|
||||||
|
final ChunkSection[] sections = oldChunk.getSections();
|
||||||
|
for (int i = 0; i < sections.length; i++) {
|
||||||
|
final ChunkSection section = sections[i];
|
||||||
|
// Write biome palette into biome array
|
||||||
|
final DataPalette biomePalette = section.palette(PaletteType.BIOMES);
|
||||||
|
for (int biomeIndex = i * BIOMES_PER_CHUNK; biomeIndex < (i * BIOMES_PER_CHUNK) + BIOMES_PER_CHUNK; biomeIndex++) {
|
||||||
|
final int minX = (biomeIndex & HORIZONTAL_MASK) << 2;
|
||||||
|
final int minY = ((biomeIndex >> WIDTH_BITS + WIDTH_BITS) << 2) & 15;
|
||||||
|
final int minZ = (biomeIndex >> WIDTH_BITS & HORIZONTAL_MASK) << 2;
|
||||||
|
biomeData[biomeIndex] = biomePalette.idAt(minX, minY, minZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rewrite ids
|
||||||
|
/*for (int i = 0; i < section.getPaletteSize(); i++) {
|
||||||
|
int old = section.getPaletteEntry(i);
|
||||||
|
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<CompoundTag> blockEntityTags = new ArrayList<>(oldChunk.blockEntities().size());
|
||||||
|
for (final BlockEntity blockEntity : oldChunk.blockEntities()) {
|
||||||
|
final CompoundTag tag = blockEntity.tag();
|
||||||
|
final String id = protocol.getMappingData().blockEntities().get(blockEntity.typeId());
|
||||||
|
if (id == null) {
|
||||||
|
// Shrug
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockEntityTags.add(tag);
|
||||||
|
tag.put("x", new IntTag((oldChunk.getX() << 4) + blockEntity.sectionX()));
|
||||||
|
tag.put("y", new IntTag(blockEntity.y()));
|
||||||
|
tag.put("z", new IntTag((oldChunk.getZ() << 4) + blockEntity.sectionZ()));
|
||||||
|
tag.put("id", new StringTag(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
final Chunk chunk = new BaseChunk(oldChunk.getX(), oldChunk.getZ(), true, false, null,
|
||||||
|
oldChunk.getSections(), biomeData, oldChunk.getHeightMap(), blockEntityTags);
|
||||||
|
wrapper.write(new Chunk1_17Type(tracker.currentWorldSectionHeight()), chunk);
|
||||||
|
|
||||||
|
// Create and send light packet first
|
||||||
|
final PacketWrapper lightPacket = wrapper.create(ClientboundPackets1_17_1.UPDATE_LIGHT);
|
||||||
|
lightPacket.write(Type.VAR_INT, chunk.getX());
|
||||||
|
lightPacket.write(Type.VAR_INT, chunk.getZ());
|
||||||
|
lightPacket.write(Type.BOOLEAN, wrapper.read(Type.BOOLEAN)); // Trust edges
|
||||||
|
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Sky light mask
|
||||||
|
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Block light mask
|
||||||
|
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty sky light mask
|
||||||
|
lightPacket.write(Type.LONG_ARRAY_PRIMITIVE, wrapper.read(Type.LONG_ARRAY_PRIMITIVE)); // Empty block light mask
|
||||||
|
|
||||||
|
final int skyLightLength = wrapper.read(Type.VAR_INT);
|
||||||
|
lightPacket.write(Type.VAR_INT, skyLightLength);
|
||||||
|
for (int i = 0; i < skyLightLength; i++) {
|
||||||
|
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
final int blockLightLength = wrapper.read(Type.VAR_INT);
|
||||||
|
lightPacket.write(Type.VAR_INT, blockLightLength);
|
||||||
|
for (int i = 0; i < blockLightLength; i++) {
|
||||||
|
lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
lightPacket.send(Protocol1_17_1To1_18.class);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -29,9 +29,9 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
|||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
import com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1;
|
||||||
|
|
||||||
public final class EntityPackets1_17 extends EntityRewriter<Protocol1_17_1To1_18> {
|
public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18> {
|
||||||
|
|
||||||
public EntityPackets1_17(Protocol1_17_1To1_18 protocol) {
|
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_17_1To1_18
|
|||||||
handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT));
|
handler(getTrackerHandler(Entity1_17Types.PLAYER, Type.INT));
|
||||||
handler(worldDataTrackerHandler(1));
|
handler(worldDataTrackerHandler(1));
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
CompoundTag registry = wrapper.get(Type.NBT, 0);
|
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||||
CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||||
ListTag biomes = biomeRegistry.get("value");
|
final ListTag biomes = biomeRegistry.get("value");
|
||||||
for (Tag biome : biomes) {
|
for (final Tag biome : biomes) {
|
||||||
CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
|
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element");
|
||||||
// The client just needs something
|
// The client just needs something
|
||||||
biomeCompound.put("depth", new FloatTag(0.125F));
|
biomeCompound.put("depth", new FloatTag(0.125F));
|
||||||
biomeCompound.put("scale", new FloatTag(0.05F));
|
biomeCompound.put("scale", new FloatTag(0.05F));
|
||||||
@ -89,7 +89,7 @@ public final class EntityPackets1_17 extends EntityRewriter<Protocol1_17_1To1_18
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityType typeFromId(int typeId) {
|
public EntityType typeFromId(final int typeId) {
|
||||||
return Entity1_17Types.getTypeFromId(typeId); //TODO
|
return Entity1_17Types.getTypeFromId(typeId); //TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.1.0-SNAPSHOT"
|
viaver = "4.1.0-21w37a-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
Loading…
Reference in New Issue
Block a user