mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-21 12:07:38 +01:00
22w14a
This commit is contained in:
parent
bd71833f18
commit
dfa778942c
@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "com.viaversion"
|
||||
version = "4.3.0-22w13a-SNAPSHOT"
|
||||
version = "4.3.0-22w14a-SNAPSHOT"
|
||||
description = "Allow older clients to join newer server versions."
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,17 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
};
|
||||
}
|
||||
|
||||
public PacketHandler getSpawnTrackerWithDataHandler1_19(EntityType fallingBlockType) {
|
||||
return wrapper -> {
|
||||
// Check against the UNMAPPED entity type
|
||||
EntityType entityType = setOldEntityId(wrapper);
|
||||
if (entityType == fallingBlockType) {
|
||||
int blockState = wrapper.get(Type.VAR_INT, 2);
|
||||
wrapper.set(Type.VAR_INT, 2, protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void registerSpawnTracker(ClientboundPacketType packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
@ -79,7 +90,13 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
});
|
||||
}
|
||||
|
||||
private EntityType setOldEntityId(PacketWrapper wrapper) throws Exception {
|
||||
/**
|
||||
* Sets the mapped entity id and returns the unmapped entity type.
|
||||
*
|
||||
* @param wrapper packet wrapper
|
||||
* @return unmapped (!) entity type
|
||||
*/
|
||||
protected EntityType setOldEntityId(PacketWrapper wrapper) throws Exception {
|
||||
int typeId = wrapper.get(Type.VAR_INT, 1);
|
||||
EntityType entityType = typeFromId(typeId);
|
||||
tracker(wrapper.user()).addEntity(wrapper.get(Type.VAR_INT, 0), entityType);
|
||||
|
@ -71,10 +71,47 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
entityRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_19.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_19.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_19.NAMED_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_19.STOP_SOUND);
|
||||
registerClientbound(ClientboundPackets1_19.SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // Sound id
|
||||
map(Type.VAR_INT); // Source
|
||||
map(Type.INT); // X
|
||||
map(Type.INT); // Y
|
||||
map(Type.INT); // Z
|
||||
map(Type.FLOAT); // Volume
|
||||
map(Type.FLOAT); // Pitch
|
||||
read(Type.LONG); // Seed
|
||||
handler(soundRewriter.getSoundHandler());
|
||||
}
|
||||
});
|
||||
registerClientbound(ClientboundPackets1_19.ENTITY_SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // Sound id
|
||||
map(Type.VAR_INT); // Source
|
||||
map(Type.VAR_INT); // Entity id
|
||||
map(Type.FLOAT); // Volume
|
||||
map(Type.FLOAT); // Pitch
|
||||
read(Type.LONG); // Seed
|
||||
handler(soundRewriter.getSoundHandler());
|
||||
}
|
||||
});
|
||||
registerClientbound(ClientboundPackets1_19.NAMED_SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.STRING); // Sound name
|
||||
map(Type.VAR_INT); // Source
|
||||
map(Type.INT); // X
|
||||
map(Type.INT); // Y
|
||||
map(Type.INT); // Z
|
||||
map(Type.FLOAT); // Volume
|
||||
map(Type.FLOAT); // Pitch
|
||||
read(Type.LONG); // Seed
|
||||
handler(soundRewriter.getNamedSoundHandler());
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this).registerGeneric(ClientboundPackets1_19.TAGS);
|
||||
|
||||
|
@ -33,6 +33,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||
|
||||
public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19> {
|
||||
@ -43,14 +44,42 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerTrackerWithData(ClientboundPackets1_19.SPAWN_ENTITY, Entity1_19Types.FALLING_BLOCK);
|
||||
registerSpawnTracker(ClientboundPackets1_19.SPAWN_MOB);
|
||||
registerTracker(ClientboundPackets1_19.SPAWN_EXPERIENCE_ORB, Entity1_19Types.EXPERIENCE_ORB);
|
||||
registerTracker(ClientboundPackets1_19.SPAWN_PAINTING, Entity1_19Types.PAINTING);
|
||||
registerTracker(ClientboundPackets1_19.SPAWN_PLAYER, Entity1_19Types.PLAYER);
|
||||
registerMetadataRewriter(ClientboundPackets1_19.ENTITY_METADATA, Types1_19.METADATA_LIST, Types1_18.METADATA_LIST);
|
||||
registerRemoveEntities(ClientboundPackets1_19.REMOVE_ENTITIES);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_19.SPAWN_ENTITY, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity id
|
||||
map(Type.UUID); // 1 - Entity UUID
|
||||
map(Type.VAR_INT); // 2 - Entity Type
|
||||
map(Type.DOUBLE); // 3 - X
|
||||
map(Type.DOUBLE); // 4 - Y
|
||||
map(Type.DOUBLE); // 5 - Z
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
map(Type.BYTE); // 7 - Yaw
|
||||
handler(wrapper -> {
|
||||
final byte headYaw = wrapper.read(Type.BYTE);
|
||||
int data = wrapper.read(Type.VAR_INT);
|
||||
final EntityType entityType = setOldEntityId(wrapper);
|
||||
// Hope this is right
|
||||
if (entityType.isOrHasParent(Entity1_19Types.LIVINGENTITY)) {
|
||||
wrapper.write(Type.BYTE, headYaw);
|
||||
wrapper.setPacketType(ClientboundPackets1_18.SPAWN_MOB);
|
||||
return;
|
||||
}
|
||||
|
||||
if (entityType == Entity1_19Types.FALLING_BLOCK) {
|
||||
data = protocol.getMappingData().getNewBlockStateId(data);
|
||||
}
|
||||
wrapper.write(Type.INT, data);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_19.ENTITY_EFFECT, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -84,6 +113,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
||||
map(Type.VAR_INT); // Chunk radius
|
||||
map(Type.VAR_INT); // Read simulation distance
|
||||
handler(worldDataTrackerHandler(1));
|
||||
handler(playerTrackerHandler());
|
||||
handler(wrapper -> {
|
||||
final CompoundTag registry = wrapper.get(Type.NBT, 0);
|
||||
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
|
||||
@ -112,7 +142,9 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
filter().handler((event, meta) -> {
|
||||
meta.setMetaType(Types1_18.META_TYPES.byId(meta.metaType().typeId()));
|
||||
if (meta.metaType().typeId() <= Types1_18.META_TYPES.poseType.typeId()) {
|
||||
meta.setMetaType(Types1_18.META_TYPES.byId(meta.metaType().typeId()));
|
||||
}
|
||||
|
||||
final MetaType type = meta.metaType();
|
||||
if (type == Types1_18.META_TYPES.particleType) {
|
||||
@ -151,6 +183,9 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
});
|
||||
|
||||
filter().type(Entity1_19Types.PLAYER).removeIndex(19); // Last death location;
|
||||
filter().type(Entity1_19Types.CAT).index(19).handler((event, meta) -> meta.setMetaType(Types1_18.META_TYPES.varIntType));
|
||||
|
||||
filter().type(Entity1_19Types.FROG).cancel(16); // Age
|
||||
filter().type(Entity1_19Types.FROG).cancel(17); // Variant
|
||||
filter().type(Entity1_19Types.FROG).cancel(18); // Tongue target
|
||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "4.3.0-22w13a-SNAPSHOT"
|
||||
viaver = "4.3.0-22w14a-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
10
gradlew
vendored
10
gradlew
vendored
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -32,10 +32,10 @@
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user