Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-25 15:50:12 +01:00
23w45a
Dieser Commit ist enthalten in:
Ursprung
5284a581b3
Commit
fb7cd2d9e3
@ -21,6 +21,7 @@ package com.viaversion.viabackwards.api.entities.storage;
|
|||||||
import com.viaversion.viabackwards.ViaBackwards;
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
@ -30,7 +31,7 @@ public class EntityData {
|
|||||||
private final int id;
|
private final int id;
|
||||||
private final int replacementId;
|
private final int replacementId;
|
||||||
private final String key;
|
private final String key;
|
||||||
private NameVisibility nameVisibility = NameVisibility.NONE;
|
private ComponentType componentType = ComponentType.NONE;
|
||||||
private MetaCreator defaultMeta;
|
private MetaCreator defaultMeta;
|
||||||
|
|
||||||
public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, EntityType type, int replacementId) {
|
public EntityData(BackwardsProtocol<?, ?, ?, ?> protocol, EntityType type, int replacementId) {
|
||||||
@ -45,12 +46,17 @@ public class EntityData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EntityData jsonName() {
|
public EntityData jsonName() {
|
||||||
this.nameVisibility = NameVisibility.JSON;
|
this.componentType = ComponentType.JSON;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityData tagName() {
|
||||||
|
this.componentType = ComponentType.TAG;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityData plainName() {
|
public EntityData plainName() {
|
||||||
this.nameVisibility = NameVisibility.PLAIN;
|
this.componentType = ComponentType.PLAIN;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +76,8 @@ public class EntityData {
|
|||||||
/**
|
/**
|
||||||
* @return custom mobname, can be either a String or a JsonElement
|
* @return custom mobname, can be either a String or a JsonElement
|
||||||
*/
|
*/
|
||||||
public @Nullable Object mobName() {
|
public @Nullable Object entityName() {
|
||||||
if (nameVisibility == NameVisibility.NONE) {
|
if (componentType == ComponentType.NONE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +86,12 @@ public class EntityData {
|
|||||||
ViaBackwards.getPlatform().getLogger().warning("Entity name for " + key + " not found in protocol " + protocol.getClass().getSimpleName());
|
ViaBackwards.getPlatform().getLogger().warning("Entity name for " + key + " not found in protocol " + protocol.getClass().getSimpleName());
|
||||||
name = key;
|
name = key;
|
||||||
}
|
}
|
||||||
return nameVisibility == NameVisibility.JSON ? ChatRewriter.legacyTextToJson(name) : name;
|
if (componentType == ComponentType.JSON) {
|
||||||
|
return ChatRewriter.legacyTextToJson(name);
|
||||||
|
} else if (componentType == ComponentType.TAG) {
|
||||||
|
return new StringTag(name);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int replacementId() {
|
public int replacementId() {
|
||||||
@ -115,9 +126,10 @@ public class EntityData {
|
|||||||
void createMeta(WrappedMetadata storage);
|
void createMeta(WrappedMetadata storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum NameVisibility {
|
private enum ComponentType {
|
||||||
PLAIN,
|
PLAIN,
|
||||||
JSON,
|
JSON,
|
||||||
|
TAG,
|
||||||
NONE
|
NONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,21 +76,22 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
|
|||||||
|
|
||||||
// Set the mapped entity name if there is no custom name set already
|
// Set the mapped entity name if there is no custom name set already
|
||||||
final EntityData entityData = entityDataForType(entity.entityType());
|
final EntityData entityData = entityDataForType(entity.entityType());
|
||||||
if (entityData != null && entityData.mobName() != null) {
|
final Object displayNameObject;
|
||||||
|
if (entityData != null && (displayNameObject = entityData.entityName()) != null) {
|
||||||
final Metadata displayName = getMeta(displayNameIndex, metadataList);
|
final Metadata displayName = getMeta(displayNameIndex, metadataList);
|
||||||
if (initialMetadata) {
|
if (initialMetadata) {
|
||||||
if (displayName == null) {
|
if (displayName == null) {
|
||||||
// Add it as new metadata
|
// Add it as new metadata
|
||||||
metadataList.add(new Metadata(displayNameIndex, displayNameMetaType, entityData.mobName()));
|
metadataList.add(new Metadata(displayNameIndex, displayNameMetaType, displayNameObject));
|
||||||
addDisplayVisibilityMeta(metadataList);
|
addDisplayVisibilityMeta(metadataList);
|
||||||
} else if (displayName.getValue() == null || displayName.getValue().toString().isEmpty()) {
|
} else if (displayName.getValue() == null || displayName.getValue().toString().isEmpty()) {
|
||||||
// Overwrite the existing null/empty display name
|
// Overwrite the existing null/empty display name
|
||||||
displayName.setValue(entityData.mobName());
|
displayName.setValue(displayNameObject);
|
||||||
addDisplayVisibilityMeta(metadataList);
|
addDisplayVisibilityMeta(metadataList);
|
||||||
}
|
}
|
||||||
} else if (displayName != null && (displayName.getValue() == null || displayName.getValue().toString().isEmpty())) {
|
} else if (displayName != null && (displayName.getValue() == null || displayName.getValue().toString().isEmpty())) {
|
||||||
// Overwrite null/empty display name
|
// Overwrite null/empty display name
|
||||||
displayName.setValue(entityData.mobName());
|
displayName.setValue(displayNameObject);
|
||||||
addDisplayVisibilityMeta(metadataList);
|
addDisplayVisibilityMeta(metadataList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import com.google.common.collect.Sets;
|
|||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_19_4to1_20.Protocol1_19_4To1_20;
|
import com.viaversion.viabackwards.protocol.protocol1_19_4to1_20.Protocol1_19_4To1_20;
|
||||||
import com.viaversion.viaversion.api.minecraft.Quaternion;
|
import com.viaversion.viaversion.api.minecraft.Quaternion;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
@ -34,7 +34,6 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
|||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||||
import com.viaversion.viaversion.util.Key;
|
import com.viaversion.viaversion.util.Key;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_19_4, Protocol1_19_4To1_20> {
|
public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_19_4, Protocol1_19_4To1_20> {
|
||||||
@ -44,7 +43,7 @@ public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_
|
|||||||
private static final Quaternion Y_FLIPPED_ROTATION = new Quaternion(0, 1, 0, 0);
|
private static final Quaternion Y_FLIPPED_ROTATION = new Quaternion(0, 1, 0, 0);
|
||||||
|
|
||||||
public EntityPackets1_20(final Protocol1_19_4To1_20 protocol) {
|
public EntityPackets1_20(final Protocol1_19_4To1_20 protocol) {
|
||||||
super(protocol);
|
super(protocol, Types1_19_4.META_TYPES.optionalComponentType, Types1_19_4.META_TYPES.booleanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,7 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
|||||||
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.BlockItemPacketRewriter1_20_3;
|
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.BlockItemPacketRewriter1_20_3;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.EntityPacketRewriter1_20_3;
|
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter.EntityPacketRewriter1_20_3;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||||
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.packet.PacketWrapper;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
@ -58,7 +58,8 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
|
|||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
super.registerPackets();
|
super.registerPackets();
|
||||||
|
// TODO VV: 1.20.2<->1.20 item particle rewrite
|
||||||
|
// TODO VB: Entity, new poses, particle
|
||||||
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||||
soundRewriter.registerEntitySound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
soundRewriter.registerEntitySound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||||
@ -282,12 +283,13 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
|
|||||||
|
|
||||||
private void convertOptionalComponent(final PacketWrapper wrapper) throws Exception {
|
private void convertOptionalComponent(final PacketWrapper wrapper) throws Exception {
|
||||||
final Tag tag = wrapper.read(Type.OPTIONAL_TAG);
|
final Tag tag = wrapper.read(Type.OPTIONAL_TAG);
|
||||||
|
translatableRewriter.processTag(tag);
|
||||||
wrapper.write(Type.OPTIONAL_COMPONENT, Protocol1_20_3To1_20_2.tagComponentToJson(tag));
|
wrapper.write(Type.OPTIONAL_COMPONENT, Protocol1_20_3To1_20_2.tagComponentToJson(tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final UserConnection connection) {
|
public void init(final UserConnection connection) {
|
||||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_19_4.PLAYER));
|
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_20_3.PLAYER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,13 +17,17 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter;
|
package com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter;
|
||||||
|
|
||||||
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.Protocol1_20_2To1_20_3;
|
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.Protocol1_20_2To1_20_3;
|
||||||
|
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
|
||||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
|
|
||||||
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_2, Protocol1_20_2To1_20_3> {
|
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_2, Protocol1_20_2To1_20_3> {
|
||||||
@ -50,8 +54,82 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
|
|||||||
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
|
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
|
||||||
registerCreativeInvAction(ServerboundPackets1_20_2.CREATIVE_INVENTORY_ACTION);
|
registerCreativeInvAction(ServerboundPackets1_20_2.CREATIVE_INVENTORY_ACTION);
|
||||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
|
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
|
||||||
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
|
|
||||||
|
|
||||||
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
protocol.registerClientbound(ClientboundPackets1_20_3.SPAWN_PARTICLE, new PacketHandlers() {
|
||||||
|
@Override
|
||||||
|
public void register() {
|
||||||
|
map(Type.VAR_INT); // 0 - Particle ID
|
||||||
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
|
map(Type.DOUBLE); // 2 - X
|
||||||
|
map(Type.DOUBLE); // 3 - Y
|
||||||
|
map(Type.DOUBLE); // 4 - Z
|
||||||
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
|
map(Type.FLOAT); // 8 - Particle Data
|
||||||
|
map(Type.INT); // 9 - Particle Count
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int id = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings();
|
||||||
|
if (id == particleMappings.id("vibration")) {
|
||||||
|
final int positionSourceType = wrapper.read(Type.VAR_INT);
|
||||||
|
if (positionSourceType == 0) {
|
||||||
|
wrapper.write(Type.STRING, "minecraft:block");
|
||||||
|
} else if (positionSourceType == 1) {
|
||||||
|
wrapper.write(Type.STRING, "minecraft:entity");
|
||||||
|
} else {
|
||||||
|
ViaBackwards.getPlatform().getLogger().warning("Unknown position source type: " + positionSourceType);
|
||||||
|
wrapper.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
handler(getSpawnParticleHandler(Type.VAR_INT));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new RecipeRewriter1_20_3<ClientboundPackets1_20_3>(protocol) {
|
||||||
|
@Override
|
||||||
|
public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception {
|
||||||
|
// Move width and height up
|
||||||
|
final String group = wrapper.read(Type.STRING);
|
||||||
|
final int craftingBookCategory = wrapper.read(Type.VAR_INT);
|
||||||
|
|
||||||
|
final int width = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
final int height = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
|
||||||
|
wrapper.write(Type.STRING, group);
|
||||||
|
wrapper.write(Type.VAR_INT, craftingBookCategory);
|
||||||
|
|
||||||
|
final int ingredients = height * width;
|
||||||
|
for (int i = 0; i < ingredients; i++) {
|
||||||
|
handleIngredient(wrapper);
|
||||||
|
}
|
||||||
|
rewrite(wrapper.passthrough(itemType())); // Result
|
||||||
|
wrapper.passthrough(Type.BOOLEAN); // Show notification
|
||||||
|
}
|
||||||
|
}.register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_20_3.EXPLOSION, wrapper -> {
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // X
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // Y
|
||||||
|
wrapper.passthrough(Type.DOUBLE); // Z
|
||||||
|
wrapper.passthrough(Type.FLOAT); // Power
|
||||||
|
final int blocks = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < blocks; i++) {
|
||||||
|
wrapper.passthrough(Type.BYTE); // Relative X
|
||||||
|
wrapper.passthrough(Type.BYTE); // Relative Y
|
||||||
|
wrapper.passthrough(Type.BYTE); // Relative Z
|
||||||
|
}
|
||||||
|
wrapper.passthrough(Type.FLOAT); // Knockback X
|
||||||
|
wrapper.passthrough(Type.FLOAT); // Knockback Y
|
||||||
|
wrapper.passthrough(Type.FLOAT); // Knockback Z
|
||||||
|
|
||||||
|
// TODO Probably needs handling
|
||||||
|
wrapper.read(Type.VAR_INT); // Block interaction type
|
||||||
|
wrapper.read(Type.VAR_INT); // Small explosion particle
|
||||||
|
wrapper.read(Type.VAR_INT); // Large explosion particle
|
||||||
|
wrapper.read(Type.STRING); // Explosion sound
|
||||||
|
wrapper.read(Type.OPTIONAL_FLOAT); // Sound range
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,8 +19,10 @@ package com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.rewriter;
|
|||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.Protocol1_20_2To1_20_3;
|
import com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.Protocol1_20_2To1_20_3;
|
||||||
|
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
@ -34,7 +36,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Clientb
|
|||||||
public final class EntityPacketRewriter1_20_3 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_20_2To1_20_3> {
|
public final class EntityPacketRewriter1_20_3 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_20_2To1_20_3> {
|
||||||
|
|
||||||
public EntityPacketRewriter1_20_3(final Protocol1_20_2To1_20_3 protocol) {
|
public EntityPacketRewriter1_20_3(final Protocol1_20_2To1_20_3 protocol) {
|
||||||
super(protocol);
|
super(protocol, Types1_20_2.META_TYPES.optionalComponentType, Types1_20_2.META_TYPES.booleanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,11 +88,32 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
|||||||
final MetaType type = meta.metaType();
|
final MetaType type = meta.metaType();
|
||||||
if (type == Types1_20_3.META_TYPES.componentType) {
|
if (type == Types1_20_3.META_TYPES.componentType) {
|
||||||
meta.setTypeAndValue(Types1_20_2.META_TYPES.componentType, Protocol1_20_3To1_20_2.tagComponentToJson(meta.value()));
|
meta.setTypeAndValue(Types1_20_2.META_TYPES.componentType, Protocol1_20_3To1_20_2.tagComponentToJson(meta.value()));
|
||||||
|
return;
|
||||||
} else if (type == Types1_20_3.META_TYPES.optionalComponentType) {
|
} else if (type == Types1_20_3.META_TYPES.optionalComponentType) {
|
||||||
meta.setTypeAndValue(Types1_20_2.META_TYPES.optionalComponentType, Protocol1_20_3To1_20_2.tagComponentToJson(meta.value()));
|
meta.setTypeAndValue(Types1_20_2.META_TYPES.optionalComponentType, Protocol1_20_3To1_20_2.tagComponentToJson(meta.value()));
|
||||||
} else {
|
return;
|
||||||
meta.setMetaType(Types1_20_2.META_TYPES.byId(type.typeId()));
|
} else if (type == Types1_20_3.META_TYPES.particleType) {
|
||||||
|
final Particle particle = (Particle) meta.getValue();
|
||||||
|
final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings();
|
||||||
|
if (particle.getId() == particleMappings.id("vibration")) {
|
||||||
|
// Change the type of the position source type argument
|
||||||
|
final int positionSourceType = particle.<Integer>removeArgument(0).getValue();
|
||||||
|
if (positionSourceType == 0) {
|
||||||
|
particle.add(0, Type.STRING, "minecraft:block");
|
||||||
|
} else { // Entity
|
||||||
|
particle.add(0, Type.STRING, "minecraft:entity");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rewriteParticle(particle);
|
||||||
|
} else if (type == Types1_20_3.META_TYPES.poseType) {
|
||||||
|
final int pose = meta.value();
|
||||||
|
if (pose >= 15) {
|
||||||
|
event.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.setMetaType(Types1_20_2.META_TYPES.byId(type.typeId()));
|
||||||
});
|
});
|
||||||
|
|
||||||
registerMetaTypeHandler(
|
registerMetaTypeHandler(
|
||||||
@ -102,16 +125,24 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
|||||||
Types1_20_2.META_TYPES.optionalComponentType
|
Types1_20_2.META_TYPES.optionalComponentType
|
||||||
);
|
);
|
||||||
|
|
||||||
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||||
final int blockState = meta.value();
|
final int blockState = meta.value();
|
||||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||||
});
|
});
|
||||||
|
|
||||||
filter().type(EntityTypes1_19_4.TNT).removeIndex(9); // Block state
|
filter().type(EntityTypes1_20_3.TNT).removeIndex(9); // Block state
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMappingDataLoaded() {
|
||||||
|
mapTypes();
|
||||||
|
|
||||||
|
mapEntityTypeWithData(EntityTypes1_20_3.BREEZE, EntityTypes1_20_3.BLAZE).jsonName();
|
||||||
|
mapEntityTypeWithData(EntityTypes1_20_3.WIND_CHARGE, EntityTypes1_20_3.LLAMA_SPIT).jsonName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityType typeFromId(final int type) {
|
public EntityType typeFromId(final int type) {
|
||||||
return EntityTypes1_19_4.getTypeFromId(type);
|
return EntityTypes1_20_3.getTypeFromId(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,7 +34,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
|
|||||||
public final class EntityPacketRewriter1_20_2 extends EntityRewriter<ClientboundPackets1_20_2, Protocol1_20To1_20_2> {
|
public final class EntityPacketRewriter1_20_2 extends EntityRewriter<ClientboundPackets1_20_2, Protocol1_20To1_20_2> {
|
||||||
|
|
||||||
public EntityPacketRewriter1_20_2(final Protocol1_20To1_20_2 protocol) {
|
public EntityPacketRewriter1_20_2(final Protocol1_20To1_20_2 protocol) {
|
||||||
super(protocol);
|
super(protocol, Types1_20.META_TYPES.optionalComponentType, Types1_20.META_TYPES.booleanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Binäre Datei nicht angezeigt.
@ -1,4 +1,4 @@
|
|||||||
projectVersion=4.9.0-23w44a-SNAPSHOT
|
projectVersion=4.9.0-23w45a-SNAPSHOT
|
||||||
|
|
||||||
# Smile emoji
|
# Smile emoji
|
||||||
mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
|
mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
|
||||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.9.0-23w44a-SNAPSHOT"
|
viaver = "4.9.0-23w45a-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
@ -24,15 +24,15 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
|||||||
import com.viaversion.viabackwards.template.protocol.rewriter.BlockItemPacketRewriter1_99;
|
import com.viaversion.viabackwards.template.protocol.rewriter.BlockItemPacketRewriter1_99;
|
||||||
import com.viaversion.viabackwards.template.protocol.rewriter.EntityPacketRewriter1_99;
|
import com.viaversion.viabackwards.template.protocol.rewriter.EntityPacketRewriter1_99;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||||
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
|
import com.viaversion.viaversion.rewriter.ComponentRewriter.ReadType;
|
||||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
@ -41,55 +41,55 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
// Placeholders to replace (in the entire package):
|
// Placeholders to replace (in the entire package):
|
||||||
// Protocol1_98To_99, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
|
// Protocol1_98To_99, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
|
||||||
// Protocol1_20_3To1_20_2 (the ViaVersion protocol class the mappings depend on)
|
// Protocol1_20_3To1_20_2 (the ViaVersion protocol class the mappings depend on)
|
||||||
// ClientboundPackets1_20_2
|
// ClientboundPackets1_20_3
|
||||||
// ServerboundPackets1_20_2
|
// ServerboundPackets1_20_3
|
||||||
// ClientboundConfigurationPackets1_20_2
|
// ClientboundConfigurationPackets1_20_2
|
||||||
// ServerboundConfigurationPackets1_20_2
|
// ServerboundConfigurationPackets1_20_2
|
||||||
// EntityTypes1_19_4 (UNMAPPED type)
|
// EntityTypes1_19_4 (UNMAPPED type)
|
||||||
// 1.99, 1.98
|
// 1.99, 1.98
|
||||||
public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_2, ServerboundPackets1_20_2> {
|
public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPackets1_20_3, ClientboundPackets1_20_3, ServerboundPackets1_20_3, ServerboundPackets1_20_3> {
|
||||||
|
|
||||||
// ViaBackwards uses its own mappings and also needs a translatablerewriter for translation mappings
|
// ViaBackwards uses its own mappings and also needs a translatablerewriter for translation mappings
|
||||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.99", "1.98", Protocol1_20_3To1_20_2.class);
|
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.99", "1.98", Protocol1_20_3To1_20_2.class);
|
||||||
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
|
||||||
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
|
||||||
private final TranslatableRewriter<ClientboundPackets1_20_2> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
|
private final TranslatableRewriter<ClientboundPackets1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
|
||||||
|
|
||||||
public Protocol1_98To_99() {
|
public Protocol1_98To_99() {
|
||||||
super(ClientboundPackets1_20_2.class, ClientboundPackets1_20_2.class, ServerboundPackets1_20_2.class, ServerboundPackets1_20_2.class);
|
super(ClientboundPackets1_20_3.class, ClientboundPackets1_20_3.class, ServerboundPackets1_20_3.class, ServerboundPackets1_20_3.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
super.registerPackets();
|
super.registerPackets();
|
||||||
|
|
||||||
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
|
final TagRewriter<ClientboundPackets1_20_3> tagRewriter = new TagRewriter<>(this);
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
|
||||||
|
|
||||||
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
|
final SoundRewriter<ClientboundPackets1_20_3> soundRewriter = new SoundRewriter<>(this);
|
||||||
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
|
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND);
|
||||||
soundRewriter.registerSound(ClientboundPackets1_20_2.ENTITY_SOUND);
|
soundRewriter.registerSound(ClientboundPackets1_20_3.ENTITY_SOUND);
|
||||||
soundRewriter.registerStopSound(ClientboundPackets1_20_2.STOP_SOUND);
|
soundRewriter.registerStopSound(ClientboundPackets1_20_3.STOP_SOUND);
|
||||||
|
|
||||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_2.STATISTICS);
|
new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.STATISTICS);
|
||||||
|
|
||||||
// Registers translatable mappings (missing a whole bunch still)
|
// Registers translatable mappings (missing a whole bunch still)
|
||||||
//translatableRewriter.registerOpenWindow(ClientboundPackets1_20_2.OPEN_WINDOW); // Handled by registerOpenWindow in item rewriters
|
//translatableRewriter.registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW); // Handled by registerOpenWindow in item rewriters
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.ACTIONBAR);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.ACTIONBAR);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.TITLE_TEXT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_TEXT);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.TITLE_SUBTITLE);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.TITLE_SUBTITLE);
|
||||||
translatableRewriter.registerBossBar(ClientboundPackets1_20_2.BOSSBAR);
|
translatableRewriter.registerBossBar(ClientboundPackets1_20_3.BOSSBAR);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.DISCONNECT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISCONNECT);
|
||||||
translatableRewriter.registerTabList(ClientboundPackets1_20_2.TAB_LIST);
|
translatableRewriter.registerTabList(ClientboundPackets1_20_3.TAB_LIST);
|
||||||
translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_2.COMBAT_KILL);
|
translatableRewriter.registerCombatKill1_20(ClientboundPackets1_20_3.COMBAT_KILL);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.SYSTEM_CHAT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT);
|
||||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_2.DISGUISED_CHAT);
|
translatableRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT);
|
||||||
translatableRewriter.registerPing();
|
translatableRewriter.registerPing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final UserConnection user) {
|
public void init(final UserConnection user) {
|
||||||
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_19_4.PLAYER));
|
addEntityTracker(user, new EntityTrackerBase(user, EntityTypes1_20_3.PLAYER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -108,7 +108,7 @@ public final class Protocol1_98To_99 extends BackwardsProtocol<ClientboundPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public TranslatableRewriter<ClientboundPackets1_20_2> getTranslatableRewriter() {
|
public TranslatableRewriter<ClientboundPackets1_20_3> getTranslatableRewriter() {
|
||||||
return translatableRewriter;
|
return translatableRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,15 +21,15 @@ import com.viaversion.viabackwards.api.rewriters.ItemRewriter;
|
|||||||
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
|
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
|
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
|
|
||||||
// To replace if needed:
|
// To replace if needed:
|
||||||
// ChunkType1_20_2
|
// ChunkType1_20_2
|
||||||
// RecipeRewriter1_20_2
|
// RecipeRewriter1_20_2
|
||||||
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_20_2, Protocol1_98To_99> {
|
public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundPackets1_20_3, ServerboundPackets1_20_3, Protocol1_98To_99> {
|
||||||
|
|
||||||
public BlockItemPacketRewriter1_99(final Protocol1_98To_99 protocol) {
|
public BlockItemPacketRewriter1_99(final Protocol1_98To_99 protocol) {
|
||||||
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
super(protocol, Type.ITEM1_20_2, Type.ITEM1_20_2_ARRAY);
|
||||||
@ -37,26 +37,26 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
final BlockRewriter<ClientboundPackets1_20_2> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
final BlockRewriter<ClientboundPackets1_20_3> blockRewriter = BlockRewriter.for1_20_2(protocol);
|
||||||
blockRewriter.registerBlockAction(ClientboundPackets1_20_2.BLOCK_ACTION);
|
blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_ACTION);
|
||||||
blockRewriter.registerBlockChange(ClientboundPackets1_20_2.BLOCK_CHANGE);
|
blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_CHANGE);
|
||||||
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_2.MULTI_BLOCK_CHANGE);
|
blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.MULTI_BLOCK_CHANGE);
|
||||||
blockRewriter.registerEffect(ClientboundPackets1_20_2.EFFECT, 1010, 2001);
|
blockRewriter.registerEffect(ClientboundPackets1_20_3.EFFECT, 1010, 2001);
|
||||||
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_2.CHUNK_DATA, ChunkType1_20_2::new);
|
blockRewriter.registerChunkData1_19(ClientboundPackets1_20_3.CHUNK_DATA, ChunkType1_20_2::new);
|
||||||
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_2.BLOCK_ENTITY_DATA);
|
blockRewriter.registerBlockEntityData(ClientboundPackets1_20_3.BLOCK_ENTITY_DATA);
|
||||||
|
|
||||||
// registerOpenWindow(ClientboundPackets1_20_2.OPEN_WINDOW);
|
// registerOpenWindow(ClientboundPackets1_20_3.OPEN_WINDOW);
|
||||||
registerSetCooldown(ClientboundPackets1_20_2.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_20_3.COOLDOWN);
|
||||||
registerWindowItems1_17_1(ClientboundPackets1_20_2.WINDOW_ITEMS);
|
registerWindowItems1_17_1(ClientboundPackets1_20_3.WINDOW_ITEMS);
|
||||||
registerSetSlot1_17_1(ClientboundPackets1_20_2.SET_SLOT);
|
registerSetSlot1_17_1(ClientboundPackets1_20_3.SET_SLOT);
|
||||||
registerAdvancements1_20_3(ClientboundPackets1_20_2.ADVANCEMENTS);
|
registerAdvancements1_20_3(ClientboundPackets1_20_3.ADVANCEMENTS);
|
||||||
registerEntityEquipmentArray(ClientboundPackets1_20_2.ENTITY_EQUIPMENT);
|
registerEntityEquipmentArray(ClientboundPackets1_20_3.ENTITY_EQUIPMENT);
|
||||||
registerClickWindow1_17_1(ServerboundPackets1_20_2.CLICK_WINDOW);
|
registerClickWindow1_17_1(ServerboundPackets1_20_3.CLICK_WINDOW);
|
||||||
registerTradeList1_19(ClientboundPackets1_20_2.TRADE_LIST);
|
registerTradeList1_19(ClientboundPackets1_20_3.TRADE_LIST);
|
||||||
registerCreativeInvAction(ServerboundPackets1_20_2.CREATIVE_INVENTORY_ACTION);
|
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
|
||||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.WINDOW_PROPERTY);
|
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_3.WINDOW_PROPERTY);
|
||||||
registerSpawnParticle1_19(ClientboundPackets1_20_2.SPAWN_PARTICLE);
|
registerSpawnParticle1_19(ClientboundPackets1_20_3.SPAWN_PARTICLE);
|
||||||
|
|
||||||
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_3.DECLARE_RECIPES);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,29 +19,29 @@ package com.viaversion.viabackwards.template.protocol.rewriter;
|
|||||||
|
|
||||||
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.EntityRewriter;
|
||||||
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
|
import com.viaversion.viabackwards.template.protocol.Protocol1_98To_99;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||||
|
|
||||||
// Replace if needed
|
// Replace if needed
|
||||||
// Types1_OLD
|
// Types1_OLD
|
||||||
// Types1_20_3
|
// Types1_20_3
|
||||||
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_2, Protocol1_98To_99> {
|
public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPackets1_20_3, Protocol1_98To_99> {
|
||||||
|
|
||||||
public EntityPacketRewriter1_99(final Protocol1_98To_99 protocol) {
|
public EntityPacketRewriter1_99(final Protocol1_98To_99 protocol) {
|
||||||
super(protocol);
|
super(protocol, Types1_20_3.META_TYPES.optionalComponentType, Types1_20_3.META_TYPES.booleanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerTrackerWithData1_19(ClientboundPackets1_20_2.SPAWN_ENTITY, EntityTypes1_19_4.FALLING_BLOCK);
|
registerTrackerWithData1_19(ClientboundPackets1_20_3.SPAWN_ENTITY, EntityTypes1_20_3.FALLING_BLOCK);
|
||||||
registerMetadataRewriter(ClientboundPackets1_20_2.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_3.METADATA_LIST); // Specify old and new metadata list if changed
|
registerMetadataRewriter(ClientboundPackets1_20_3.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_3.METADATA_LIST); // Specify old and new metadata list if changed
|
||||||
registerRemoveEntities(ClientboundPackets1_20_2.REMOVE_ENTITIES);
|
registerRemoveEntities(ClientboundPackets1_20_3.REMOVE_ENTITIES);
|
||||||
|
|
||||||
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
|
protocol.registerClientbound(State.CONFIGURATION, ClientboundConfigurationPackets1_20_2.REGISTRY_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
@ -52,7 +52,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_20_2.JOIN_GAME, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_20_3.JOIN_GAME, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.INT); // Entity id
|
map(Type.INT); // Entity id
|
||||||
@ -70,7 +70,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_20_2.RESPAWN, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_20_3.RESPAWN, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
map(Type.STRING); // Dimension
|
map(Type.STRING); // Dimension
|
||||||
@ -102,7 +102,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
Types1_20_3.META_TYPES.optionalComponentType
|
Types1_20_3.META_TYPES.optionalComponentType
|
||||||
);
|
);
|
||||||
|
|
||||||
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||||
final int blockState = meta.value();
|
final int blockState = meta.value();
|
||||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||||
});
|
});
|
||||||
@ -116,11 +116,11 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
|||||||
// If types changed, uncomment to map them
|
// If types changed, uncomment to map them
|
||||||
// mapTypes();
|
// mapTypes();
|
||||||
|
|
||||||
// mapEntityTypeWithData(EntityTypes1_19_4.SNIFFER, EntityTypes1_19_4.RAVAGER).jsonName();
|
// mapEntityTypeWithData(EntityTypes1_20_3.SNIFFER, EntityTypes1_20_3.RAVAGER).tagName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityType typeFromId(final int type) {
|
public EntityType typeFromId(final int type) {
|
||||||
return EntityTypes1_19_4.getTypeFromId(type);
|
return EntityTypes1_20_3.getTypeFromId(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren