20w49a (almost)

Missing: Translating the 2 new particles with data
This commit is contained in:
KennyTV 2020-12-03 12:55:58 +01:00
parent 92cec1f798
commit ad4092b8f6
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
18 changed files with 329 additions and 72 deletions

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-all</artifactId>

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-bukkit</artifactId>

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-bungee</artifactId>

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-core</artifactId>

View File

@ -21,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class EntityTracker extends StoredObject {
private final Map<BackwardsProtocol, ProtocolEntityTracker> trackers = new ConcurrentHashMap<>();
private int currentWorldSectionHeight = 16;
public EntityTracker(UserConnection user) {
super(user);
@ -35,6 +36,18 @@ public class EntityTracker extends StoredObject {
return trackers.get(protocol);
}
public Map<BackwardsProtocol, ProtocolEntityTracker> getTrackers() {
return trackers;
}
public int getCurrentWorldSectionHeight() {
return currentWorldSectionHeight;
}
public void setCurrentWorldSectionHeight(int currentWorldSectionHeight) {
this.currentWorldSectionHeight = currentWorldSectionHeight;
}
public static class ProtocolEntityTracker {
private final Map<Integer, StoredEntity> entityMap = new ConcurrentHashMap<>();

View File

@ -26,6 +26,9 @@ import us.myles.ViaVersion.exception.CancelException;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import us.myles.viaversion.libs.fastutil.ints.Int2IntMap;
import us.myles.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
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.Tag;
import java.util.ArrayList;
import java.util.Comparator;
@ -257,6 +260,20 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
return wrapper -> addTrackedEntity(wrapper, (int) wrapper.get(intType, 0), entityType);
}
protected PacketHandler getWorldDataTracker(int nbtIndex) {
return wrapper -> {
CompoundTag registryData = wrapper.get(Type.NBT, nbtIndex);
Tag height = registryData.get("height");
if (!(height instanceof IntTag)) {
ViaBackwards.getPlatform().getLogger().warning("Height missing in dimension data: " + registryData);
return;
}
int blockHeight = ((IntTag) height).getValue();
wrapper.user().get(EntityTracker.class).setCurrentWorldSectionHeight(blockHeight >> 4);
};
}
protected PacketHandler getDimensionHandler(int index) {
return wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);

View File

@ -13,6 +13,7 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.remapper.ValueTransformer;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
@ -168,7 +169,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
}
});
new TagRewriter(this, null).register(ClientboundPackets1_13.TAGS);
new TagRewriter(this, null).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
new StatisticsRewriter(this, null).register(ClientboundPackets1_13.STATISTICS);
}

View File

@ -12,6 +12,7 @@ import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.packets.EntityPackets
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
@ -77,7 +78,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
}
});
new TagRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.TAGS);
new TagRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
new StatisticsRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.STATISTICS);
}

View File

@ -11,6 +11,7 @@ import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.packets.EntityPackets
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.storage.PlayerSneakStorage;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
@ -112,7 +113,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
}
});
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16.TAGS);
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
new StatisticsRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16.STATISTICS);

View File

@ -11,6 +11,7 @@ import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
@ -107,7 +108,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
}
});
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.TAGS);
new TagRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
new StatisticsRewriter(this, entityPackets::getOldEntityId).register(ClientboundPackets1_16_2.STATISTICS);
}

View File

@ -8,20 +8,22 @@ import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPack
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets.EntityPackets1_17;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
import us.myles.ViaVersion.api.rewriters.TagRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_17, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true);
private BlockItemPackets1_17 blockItemPackets;
public Protocol1_16_4To1_17() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
}
@Override
@ -34,15 +36,30 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
new EntityPackets1_17(this).register();
SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_16_2.NAMED_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_16_2.STOP_SOUND);
soundRewriter.registerSound(ClientboundPackets1_17.SOUND);
soundRewriter.registerSound(ClientboundPackets1_17.ENTITY_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
new TagRewriter(this, null).register(ClientboundPackets1_16_2.TAGS);
new StatisticsRewriter(this, null).register(ClientboundPackets1_16_2.STATISTICS);
TagRewriter tagRewriter = new TagRewriter(this, null);
registerOutgoing(ClientboundPackets1_17.TAGS, new PacketRemapper() {
@Override
public void registerMap() {
handler(tagRewriter.getHandler(RegistryType.ENTITY));
handler(wrapper -> {
// Goodbye Game Event tags
int length = wrapper.read(Type.VAR_INT);
for (int i = 0; i < length; i++) {
wrapper.read(Type.STRING);
wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
}
});
}
});
registerOutgoing(ClientboundPackets1_16_2.RESOURCE_PACK, new PacketRemapper() {
new StatisticsRewriter(this, null).register(ClientboundPackets1_17.STATISTICS);
registerOutgoing(ClientboundPackets1_17.RESOURCE_PACK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -53,7 +70,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
}
});
registerOutgoing(ClientboundPackets1_16_2.MAP_DATA, new PacketRemapper() {
registerOutgoing(ClientboundPackets1_17.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
@ -69,6 +86,8 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
});
}
});
cancelOutgoing(ClientboundPackets1_17.ADD_VIBRATION_SIGNAL);
}
@Override

View File

@ -1,19 +1,25 @@
package nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.packets;
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
import nl.matsv.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
import us.myles.ViaVersion.api.rewriters.ItemRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
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.List;
public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.ItemRewriter<Protocol1_16_4To1_17> {
public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol, TranslatableRewriter translatableRewriter) {
@ -25,47 +31,125 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
ItemRewriter itemRewriter = new ItemRewriter(protocol, this::handleItemToClient, this::handleItemToServer);
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
new RecipeRewriter1_16(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
new RecipeRewriter1_16(protocol, this::handleItemToClient).registerDefaultHandler(ClientboundPackets1_17.DECLARE_RECIPES);
itemRewriter.registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
itemRewriter.registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
itemRewriter.registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
itemRewriter.registerSetCooldown(ClientboundPackets1_17.COOLDOWN);
itemRewriter.registerWindowItems(ClientboundPackets1_17.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
itemRewriter.registerSetSlot(ClientboundPackets1_17.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerEntityEquipmentArray(ClientboundPackets1_17.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerTradeList(ClientboundPackets1_17.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerAdvancements(ClientboundPackets1_17.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16_2.ACKNOWLEDGE_PLAYER_DIGGING);
blockRewriter.registerBlockAction(ClientboundPackets1_16_2.BLOCK_ACTION);
blockRewriter.registerBlockChange(ClientboundPackets1_16_2.BLOCK_CHANGE);
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE);
blockRewriter.registerEffect(ClientboundPackets1_16_2.EFFECT, 1010, 2001);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_17.ACKNOWLEDGE_PLAYER_DIGGING);
blockRewriter.registerBlockAction(ClientboundPackets1_17.BLOCK_ACTION);
blockRewriter.registerEffect(ClientboundPackets1_17.EFFECT, 1010, 2001);
// Some chunk sections will be lost ¯\_()_/¯
protocol.registerOutgoing(ClientboundPackets1_16_2.UPDATE_LIGHT, new PacketRemapper() {
itemRewriter.registerClickWindow(ServerboundPackets1_16_2.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.BOOLEAN);
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
}
});
wrapper.write(Type.VAR_INT, wrapper.read(Type.VAR_LONG).intValue()); // Sky mask
wrapper.write(Type.VAR_INT, wrapper.read(Type.VAR_LONG).intValue()); // Block mask
wrapper.write(Type.VAR_INT, wrapper.read(Type.VAR_LONG).intValue()); // Empty sky mask
wrapper.write(Type.VAR_INT, wrapper.read(Type.VAR_LONG).intValue()); // Empty block mask
//TODO vibration, dust_color_transition data
itemRewriter.registerSpawnParticle(ClientboundPackets1_17.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
//TODO possibly have to check: player digging, block break animation, block entity data, block action,
// The Great Shrunkening
// Some chunk sections will be lost ¯\_()_/¯
protocol.registerOutgoing(ClientboundPackets1_17.UPDATE_LIGHT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // X
map(Type.VAR_INT); // Z
map(Type.BOOLEAN); // Trust edges
handler(wrapper -> {
int skyLightMask = cutLongArrayMask(wrapper.read(Type.LONG_ARRAY_PRIMITIVE));
int blockLightMask = cutLongArrayMask(wrapper.read(Type.LONG_ARRAY_PRIMITIVE));
wrapper.write(Type.VAR_INT, skyLightMask); // Sky light mask
wrapper.write(Type.VAR_INT, blockLightMask); // Block light mask
wrapper.write(Type.VAR_INT, cutLongArrayMask(wrapper.read(Type.LONG_ARRAY_PRIMITIVE)));// Empty sky light mask
wrapper.write(Type.VAR_INT, cutLongArrayMask(wrapper.read(Type.LONG_ARRAY_PRIMITIVE))); // Empty block light mask
writeLightArrays(wrapper, skyLightMask);
writeLightArrays(wrapper, blockLightMask);
});
}
private int cutLongArrayMask(long[] mask) {
if (mask.length == 0) return 0;
// Only keep the first 18 bits (16 sections + one above and below)
long l = mask[0];
return (int) (l & 0x3ffff);
}
private void writeLightArrays(PacketWrapper wrapper, int bitMask) throws Exception {
wrapper.read(Type.VAR_INT); // Length - throw it away
List<byte[]> light = new ArrayList<>();
for (int i = 0; i <= 17; i++) {
if (isSet(bitMask, i)) {
light.add(wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
}
}
for (byte[] bytes : light) {
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, bytes);
}
}
private boolean isSet(int mask, int i) {
return (mask & (1 << i)) != 0;
}
});
protocol.registerOutgoing(ClientboundPackets1_17.MULTI_BLOCK_CHANGE, new PacketRemapper() {
public void registerMap() {
map(Type.LONG); // Chunk pos
map(Type.BOOLEAN); // Suppress light updates
this.handler((wrapper) -> {
// Cancel if above the 256 block limit
int chunkY = (int) (wrapper.get(Type.LONG, 0) << 44 >> 44);
if (chunkY > 15) {
wrapper.cancel();
return;
}
BlockChangeRecord[] records = wrapper.passthrough(Type.VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY);
for (BlockChangeRecord record : records) {
record.setBlockId(protocol.getMappingData().getNewBlockStateId(record.getBlockId()));
}
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.CHUNK_DATA, new PacketRemapper() {
protocol.registerOutgoing(ClientboundPackets1_17.BLOCK_CHANGE, new PacketRemapper() {
public void registerMap() {
map(Type.POSITION1_14);
map(Type.VAR_INT);
handler((wrapper) -> {
if (wrapper.get(Type.POSITION1_14, 0).getY() >= 256) {
wrapper.cancel();
return;
}
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(wrapper.get(Type.VAR_INT, 0)));
});
}
});
protocol.registerOutgoing(ClientboundPackets1_17.CHUNK_DATA, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
Chunk chunk = wrapper.read(new Chunk1_17Type());
int currentWorldSectionHeight = wrapper.user().get(EntityTracker.class).getCurrentWorldSectionHeight();
Chunk chunk = wrapper.read(new Chunk1_17Type(currentWorldSectionHeight));
wrapper.write(new Chunk1_16_2Type(), chunk);
for (int i = 0; i < chunk.getSections().length; i++) {
for (int i = 0; i < 16; i++) { // Only need to process the first 16 sections
ChunkSection section = chunk.getSections()[i];
if (section == null) continue;
for (int j = 0; j < section.getPaletteSize(); j++) {
@ -76,14 +160,5 @@ public class BlockItemPackets1_17 extends nl.matsv.viabackwards.api.rewriters.It
});
}
});
itemRewriter.registerClickWindow(ServerboundPackets1_16_2.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
itemRewriter.registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
protocol.registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
}
});
}
}

View File

@ -12,7 +12,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.Particle;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
import us.myles.viaversion.libs.gson.JsonElement;
public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
@ -23,18 +23,38 @@ public class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
@Override
protected void registerPackets() {
registerSpawnTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_16_2.SPAWN_MOB);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EntityType.EXPERIENCE_ORB);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
registerExtraTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST);
protocol.registerOutgoing(ClientboundPackets1_16_2.JOIN_GAME, new PacketRemapper() {
registerSpawnTrackerWithData(ClientboundPackets1_17.SPAWN_ENTITY, Entity1_16_2Types.EntityType.FALLING_BLOCK);
registerSpawnTracker(ClientboundPackets1_17.SPAWN_MOB);
registerExtraTracker(ClientboundPackets1_17.SPAWN_EXPERIENCE_ORB, Entity1_16_2Types.EntityType.EXPERIENCE_ORB);
registerExtraTracker(ClientboundPackets1_17.SPAWN_PAINTING, Entity1_16_2Types.EntityType.PAINTING);
registerExtraTracker(ClientboundPackets1_17.SPAWN_PLAYER, Entity1_16_2Types.EntityType.PLAYER);
registerEntityDestroy(ClientboundPackets1_17.DESTROY_ENTITIES);
registerMetadataRewriter(ClientboundPackets1_17.ENTITY_METADATA, Types1_14.METADATA_LIST);
protocol.registerOutgoing(ClientboundPackets1_17.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Entity ID
map(Type.BOOLEAN); // Hardcore
map(Type.UNSIGNED_BYTE); // Gamemode
map(Type.BYTE); // Previous Gamemode
map(Type.STRING_ARRAY); // Worlds
map(Type.NBT); // Dimension registry
map(Type.NBT); // Current dimension data
handler(wrapper -> {
byte previousGamemode = wrapper.get(Type.BYTE, 0);
if (previousGamemode == -1) { // "Unset" gamemode removed
wrapper.set(Type.BYTE, 0, (byte) 0);
}
});
handler(getTrackerHandler(Entity1_16_2Types.EntityType.PLAYER, Type.INT));
handler(getWorldDataTracker(1));
}
});
protocol.registerOutgoing(ClientboundPackets1_17.RESPAWN, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.NBT); // Dimension data
handler(getWorldDataTracker(0));
}
});
}

View File

@ -570,7 +570,103 @@
"minecraft:pointed_dripstone[thickness=base,vertical_direction=up,waterlogged=false]": "minecraft:end_rod[facing=up]",
"minecraft:pointed_dripstone[thickness=base,vertical_direction=down,waterlogged=true]": "minecraft:end_rod[facing=down]",
"minecraft:pointed_dripstone[thickness=base,vertical_direction=down,waterlogged=false]": "minecraft:end_rod[facing=down]",
"minecraft:dripstone_block": "minecraft:granite"
"minecraft:dripstone_block": "minecraft:granite",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=0,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=1,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=2,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=3,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=4,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=5,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=6,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=7,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=8,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=9,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=10,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=11,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=12,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=13,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=14,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=inactive,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=inactive,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=active,waterlogged=true]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=active,waterlogged=false]": "minecraft:prismarine_brick_slab[type=bottom,waterlogged=false]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=cooldown,waterlogged=true]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=true]",
"minecraft:sculk_sensor[power=15,sculk_sensor_phase=cooldown,waterlogged=false]": "minecraft:dark_prismarine_slab[type=bottom,waterlogged=false]"
},
"items": {
"minecraft:dirt_path": {
@ -828,6 +924,10 @@
"minecraft:pointed_dripstone": {
"id": "minecraft:dead_bush",
"name": "1.17 Pointed Dripstone"
},
"minecraft:sculk_sensor": {
"id": "minecraft:dark_prismarine_slab",
"name": "1.17 Sculk Sensor"
}
},
"sounds": {
@ -896,7 +996,14 @@
"block.pointed_dripstone.drip_lava": "",
"block.pointed_dripstone.drip_water": "",
"block.pointed_dripstone.drip_lava_into_cauldron": "",
"block.pointed_dripstone.drip_water_into_cauldron": ""
"block.pointed_dripstone.drip_water_into_cauldron": "",
"block.sculk_sensor.clicking": "",
"block.sculk_sensor.clicking_stop": "",
"block.sculk_sensor.break": "",
"block.sculk_sensor.fall": "",
"block.sculk_sensor.hit": "",
"block.sculk_sensor.place": "",
"block.sculk_sensor.step": ""
},
"particles": {
"small_flame": "flame",
@ -904,6 +1011,8 @@
"dripping_dripstone_lava": "dripping_lava",
"falling_dripstone_lava": "falling_lava",
"dripping_dripstone_water": "dripping_water",
"falling_dripstone_water": "falling_water"
"falling_dripstone_water": "falling_water",
"vibration": "",
"dust_color_transition": ""
}
}

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-fabric</artifactId>

View File

@ -16,7 +16,7 @@
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-parent</artifactId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</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-20w45a</version>
<version>3.3.0-20w49a</version>
<scope>provided</scope>
</dependency>

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-sponge</artifactId>

View File

@ -16,7 +16,7 @@
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-20w46a</version>
<version>3.3.0-20w49a</version>
</parent>
<artifactId>viabackwards-velocity</artifactId>