Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-20 06:50:10 +01:00
22w16b (probably, also ignoring a possible race condition)
Dieser Commit ist enthalten in:
Ursprung
15c7106430
Commit
8850d5c8ff
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
group = "com.viaversion"
|
||||||
version = "4.3.0-22w15a-SNAPSHOT"
|
version = "4.3.0-22w16b-SNAPSHOT"
|
||||||
description = "Allow older clients to join newer server versions."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
tagRewriter.removeTags("minecraft:cat_variant");
|
tagRewriter.removeTags("minecraft:cat_variant");
|
||||||
tagRewriter.renameTag(RegistryType.BLOCK, "minecraft:wool_carpets", "minecraft:carpets");
|
tagRewriter.renameTag(RegistryType.BLOCK, "minecraft:wool_carpets", "minecraft:carpets");
|
||||||
tagRewriter.renameTag(RegistryType.ITEM, "minecraft:wool_carpets", "minecraft:carpets");
|
tagRewriter.renameTag(RegistryType.ITEM, "minecraft:wool_carpets", "minecraft:carpets");
|
||||||
|
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:occludes_vibration_signals");
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_19.TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_19.TAGS);
|
||||||
|
|
||||||
new StatisticsRewriter(this).register(ClientboundPackets1_19.STATISTICS);
|
new StatisticsRewriter(this).register(ClientboundPackets1_19.STATISTICS);
|
||||||
@ -165,7 +166,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final UserConnection user) {
|
public void init(final UserConnection user) {
|
||||||
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
|
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,11 +19,15 @@ package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.packets;
|
|||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
||||||
|
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage.StoredPainting;
|
||||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||||
|
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.Position;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||||
|
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.Particle;
|
import com.viaversion.viaversion.api.type.types.Particle;
|
||||||
@ -45,7 +49,6 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
registerTracker(ClientboundPackets1_19.SPAWN_EXPERIENCE_ORB, Entity1_19Types.EXPERIENCE_ORB);
|
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);
|
registerTracker(ClientboundPackets1_19.SPAWN_PLAYER, Entity1_19Types.PLAYER);
|
||||||
registerMetadataRewriter(ClientboundPackets1_19.ENTITY_METADATA, Types1_19.METADATA_LIST, Types1_18.METADATA_LIST);
|
registerMetadataRewriter(ClientboundPackets1_19.ENTITY_METADATA, Types1_19.METADATA_LIST, Types1_18.METADATA_LIST);
|
||||||
registerRemoveEntities(ClientboundPackets1_19.REMOVE_ENTITIES);
|
registerRemoveEntities(ClientboundPackets1_19.REMOVE_ENTITIES);
|
||||||
@ -70,6 +73,14 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
wrapper.write(Type.BYTE, headYaw);
|
wrapper.write(Type.BYTE, headYaw);
|
||||||
wrapper.setPacketType(ClientboundPackets1_18.SPAWN_MOB);
|
wrapper.setPacketType(ClientboundPackets1_18.SPAWN_MOB);
|
||||||
return;
|
return;
|
||||||
|
} else if (entityType == Entity1_19Types.PAINTING) {
|
||||||
|
wrapper.cancel();
|
||||||
|
// The entity has been tracked, now we wait for the metadata packet
|
||||||
|
final int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
final StoredEntityData entityData = tracker(wrapper.user()).entityData(entityId);
|
||||||
|
final Position position = new Position(wrapper.get(Type.DOUBLE, 0).intValue(), wrapper.get(Type.DOUBLE, 1).intValue(), wrapper.get(Type.DOUBLE, 2).intValue());
|
||||||
|
entityData.put(new StoredPainting(entityId, wrapper.get(Type.UUID, 0), position, data));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entityType == Entity1_19Types.FALLING_BLOCK) {
|
if (entityType == Entity1_19Types.FALLING_BLOCK) {
|
||||||
@ -183,6 +194,27 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
|
|||||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
filter().type(Entity1_19Types.PAINTING).index(8).handler((event, meta) -> {
|
||||||
|
event.cancel();
|
||||||
|
|
||||||
|
final StoredEntityData entityData = tracker(event.user()).entityDataIfPresent(event.entityId());
|
||||||
|
final StoredPainting storedPainting = entityData.remove(StoredPainting.class);
|
||||||
|
if (storedPainting != null) {
|
||||||
|
final PacketWrapper packet = PacketWrapper.create(ClientboundPackets1_18.SPAWN_PAINTING, event.user());
|
||||||
|
packet.write(Type.VAR_INT, storedPainting.entityId());
|
||||||
|
packet.write(Type.UUID, storedPainting.uuid());
|
||||||
|
packet.write(Type.VAR_INT, meta.value());
|
||||||
|
packet.write(Type.POSITION1_14, storedPainting.position());
|
||||||
|
packet.write(Type.BYTE, storedPainting.direction());
|
||||||
|
try {
|
||||||
|
// TODO Race condition
|
||||||
|
packet.send(Protocol1_18_2To1_19.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
filter().type(Entity1_19Types.PLAYER).removeIndex(19); // Last death location;
|
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.CAT).index(19).handler((event, meta) -> meta.setMetaType(Types1_18.META_TYPES.varIntType));
|
||||||
|
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||||
|
* Copyright (C) 2016-2022 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_18_2to1_19.storage;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.Position;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public final class StoredPainting implements StorableObject {
|
||||||
|
|
||||||
|
private final int entityId;
|
||||||
|
private final UUID uuid;
|
||||||
|
private final Position position;
|
||||||
|
private final byte direction;
|
||||||
|
|
||||||
|
public StoredPainting(final int entityId, final UUID uuid, final Position position, final int direction3d) {
|
||||||
|
this.entityId = entityId;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.position = position;
|
||||||
|
this.direction = to2dDirection(direction3d);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int entityId() {
|
||||||
|
return entityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID uuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Position position() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte direction() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte to2dDirection(int direction) {
|
||||||
|
switch (direction) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
return -1; // No worky
|
||||||
|
case 2:
|
||||||
|
return 2;
|
||||||
|
case 3:
|
||||||
|
return 0;
|
||||||
|
case 4:
|
||||||
|
return 1;
|
||||||
|
case 5:
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid direction: " + direction);
|
||||||
|
}
|
||||||
|
}
|
@ -398,8 +398,13 @@
|
|||||||
"entity.allay.item_given": "",
|
"entity.allay.item_given": "",
|
||||||
"entity.allay.item_taken": "",
|
"entity.allay.item_taken": "",
|
||||||
"entity.parrot.imitate.warden": "",
|
"entity.parrot.imitate.warden": "",
|
||||||
"entity.warden.sonic_boom": "",
|
"entity.warden.sonic_boom": "",
|
||||||
"entity.warden.sonic_charge": ""
|
"entity.warden.sonic_charge": "",
|
||||||
|
"entity.allay.item_thrown": "",
|
||||||
|
"music_disc.5": "",
|
||||||
|
"music.overworld.swamp": "",
|
||||||
|
"music.overworld.jungle_and_forest": "",
|
||||||
|
"music.overworld.old_growth_taiga": ""
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
"minecraft:warden_spawn_egg": {
|
"minecraft:warden_spawn_egg": {
|
||||||
@ -593,6 +598,14 @@
|
|||||||
"minecraft:recovery_compass": {
|
"minecraft:recovery_compass": {
|
||||||
"id": "minecraft:compass",
|
"id": "minecraft:compass",
|
||||||
"name": "1.19 Recovery Compass"
|
"name": "1.19 Recovery Compass"
|
||||||
|
},
|
||||||
|
"minecraft:music_disc_5": {
|
||||||
|
"id": "minecraft:music_disc_13",
|
||||||
|
"name": "1.19 Music Disc 5"
|
||||||
|
},
|
||||||
|
"minecraft:disc_fragment_5": {
|
||||||
|
"id": "minecraft:music_disc_13",
|
||||||
|
"name": "1.19 Disc Fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"particles": {
|
"particles": {
|
||||||
@ -610,6 +623,12 @@
|
|||||||
"enchantments": {
|
"enchantments": {
|
||||||
"minecraft:swift_sneak": "minecraft:soul_speed"
|
"minecraft:swift_sneak": "minecraft:soul_speed"
|
||||||
},
|
},
|
||||||
|
"paintings": {
|
||||||
|
"minecraft:earth": "minecraft:void",
|
||||||
|
"minecraft:fire": "minecraft:void",
|
||||||
|
"minecraft:water": "minecraft:void",
|
||||||
|
"minecraft:wind": "minecraft:void"
|
||||||
|
},
|
||||||
"entitynames": {
|
"entitynames": {
|
||||||
"warden": "Warden",
|
"warden": "Warden",
|
||||||
"frog": "Frog",
|
"frog": "Frog",
|
||||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.3.0-22w14a-SNAPSHOT"
|
viaver = "4.3.0-22w16b-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren