Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
21w17a
Dieser Commit ist enthalten in:
Ursprung
cad358322d
Commit
8e15b6d42b
@ -76,7 +76,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_16_2 = register(751, "1.16.2");
|
public static final ProtocolVersion v1_16_2 = register(751, "1.16.2");
|
||||||
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
|
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
|
||||||
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/5", new VersionRange("1.16", 4, 5));
|
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/5", new VersionRange("1.16", 4, 5));
|
||||||
public static final ProtocolVersion v1_17 = register(755, 23, "1.17");
|
public static final ProtocolVersion v1_17 = register(755, 25, "1.17");
|
||||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||||
|
|
||||||
public static ProtocolVersion register(int version, String name) {
|
public static ProtocolVersion register(int version, String name) {
|
||||||
|
@ -8,7 +8,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
group = "com.viaversion"
|
||||||
version = "4.0.0-21w16a"
|
version = "4.0.0-21w17a"
|
||||||
description = "Allow newer clients to join older server versions."
|
description = "Allow newer clients to join older server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public enum ClientboundPackets1_17 implements ClientboundPacketType {
|
|||||||
FACE_PLAYER, // 0x36
|
FACE_PLAYER, // 0x36
|
||||||
PLAYER_POSITION, // 0x37
|
PLAYER_POSITION, // 0x37
|
||||||
UNLOCK_RECIPES, // 0x38
|
UNLOCK_RECIPES, // 0x38
|
||||||
DESTROY_ENTITIES, // 0x39
|
REMOVE_ENTITY, // 0x39
|
||||||
REMOVE_ENTITY_EFFECT, // 0x3A
|
REMOVE_ENTITY_EFFECT, // 0x3A
|
||||||
RESOURCE_PACK, // 0x3B
|
RESOURCE_PACK, // 0x3B
|
||||||
RESPAWN, // 0x3C
|
RESPAWN, // 0x3C
|
||||||
|
@ -215,7 +215,7 @@ public class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPackets1_1
|
|||||||
"minecraft:snow_step_sound_blocks", "minecraft:inside_step_sound_blocks", "minecraft:occludes_vibration_signals", "minecraft:dripstone_replaceable_blocks",
|
"minecraft:snow_step_sound_blocks", "minecraft:inside_step_sound_blocks", "minecraft:occludes_vibration_signals", "minecraft:dripstone_replaceable_blocks",
|
||||||
"minecraft:cave_vines", "minecraft:moss_replaceable", "minecraft:deepslate_ore_replaceables", "minecraft:lush_ground_replaceable",
|
"minecraft:cave_vines", "minecraft:moss_replaceable", "minecraft:deepslate_ore_replaceables", "minecraft:lush_ground_replaceable",
|
||||||
"minecraft:diamond_ores", "minecraft:iron_ores", "minecraft:lapis_ores", "minecraft:redstone_ores", "minecraft:stone_ore_replaceables",
|
"minecraft:diamond_ores", "minecraft:iron_ores", "minecraft:lapis_ores", "minecraft:redstone_ores", "minecraft:stone_ore_replaceables",
|
||||||
"minecraft:coal_ores", "minecraft:copper_ores", "minecraft:emerald_ores", "minecraft:dirt", "minecraft:snow");
|
"minecraft:coal_ores", "minecraft:copper_ores", "minecraft:emerald_ores", "minecraft:dirt", "minecraft:snow", "minecraft:small_dripleaf_placeable");
|
||||||
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:powder_snow_walkable_mobs", "minecraft:axolotl_always_hostiles", "minecraft:axolotl_tempted_hostiles",
|
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:powder_snow_walkable_mobs", "minecraft:axolotl_always_hostiles", "minecraft:axolotl_tempted_hostiles",
|
||||||
"minecraft:axolotl_hunt_targets", "minecraft:freeze_hurts_extra_types", "minecraft:freeze_immune_entity_types");
|
"minecraft:axolotl_hunt_targets", "minecraft:freeze_hurts_extra_types", "minecraft:freeze_immune_entity_types");
|
||||||
|
|
||||||
|
@ -19,14 +19,17 @@ package com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets;
|
|||||||
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_17;
|
import com.viaversion.viaversion.api.type.types.version.Types1_17;
|
||||||
|
import com.viaversion.viaversion.data.EntityTracker;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.metadata.MetadataRewriter1_17To1_16_4;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.metadata.MetadataRewriter1_17To1_16_4;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.EntityTracker1_17;
|
||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
|
|
||||||
@ -36,7 +39,26 @@ public class EntityPackets {
|
|||||||
metadataRewriter.registerTracker(ClientboundPackets1_16_2.SPAWN_MOB);
|
metadataRewriter.registerTracker(ClientboundPackets1_16_2.SPAWN_MOB);
|
||||||
metadataRewriter.registerTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_17Types.PLAYER);
|
metadataRewriter.registerTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_17Types.PLAYER);
|
||||||
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_17.METADATA_LIST);
|
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_17.METADATA_LIST);
|
||||||
metadataRewriter.registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_16_2.DESTROY_ENTITIES, ClientboundPackets1_17.REMOVE_ENTITY, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
int[] entityIds = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||||
|
wrapper.cancel();
|
||||||
|
|
||||||
|
EntityTracker entityTracker = wrapper.user().get(EntityTracker1_17.class);
|
||||||
|
for (int entityId : entityIds) {
|
||||||
|
entityTracker.removeEntity(entityId);
|
||||||
|
|
||||||
|
// Send individual remove packets
|
||||||
|
PacketWrapper newPacket = wrapper.create(ClientboundPackets1_17.REMOVE_ENTITY);
|
||||||
|
newPacket.write(Type.VAR_INT, entityId);
|
||||||
|
newPacket.send(Protocol1_17To1_16_4.class);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_16_2.ENTITY_PROPERTIES, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_16_2.ENTITY_PROPERTIES, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,6 +135,11 @@ public abstract class MetadataRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sub 1.17 method for entity remove packets.
|
||||||
|
*
|
||||||
|
* @param packetType remove entities packet type
|
||||||
|
*/
|
||||||
public void registerEntityDestroy(ClientboundPacketType packetType) {
|
public void registerEntityDestroy(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
@ -150,6 +155,24 @@ public abstract class MetadataRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.17+ method for entity remove packets.
|
||||||
|
*
|
||||||
|
* @param packetType remove entities packet type
|
||||||
|
*/
|
||||||
|
public void registerRemoveEntity(ClientboundPacketType packetType) {
|
||||||
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // 0 - Entity ids
|
||||||
|
handler(wrapper -> {
|
||||||
|
int entity = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
wrapper.user().get(entityTrackerClass).removeEntity(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void registerMetadataRewriter(ClientboundPacketType packetType, @Nullable Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
public void registerMetadataRewriter(ClientboundPacketType packetType, @Nullable Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren