Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 13:30:14 +01:00
Update VV usage
Dieser Commit ist enthalten in:
Ursprung
3d3c1a0430
Commit
83a566d145
@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
allprojects {
|
||||
group = "com.viaversion"
|
||||
version = "4.0.0-1.17-pre4-SNAPSHOT"
|
||||
version = "4.0.0-1.17-pre5-SNAPSHOT"
|
||||
description = "Allow older clients to join newer server versions."
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,11 @@ package com.viaversion.viabackwards.api.rewriters;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
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.rewriter.RewriterBase;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends RewriterBase<T> {
|
||||
|
@ -21,7 +21,7 @@ package com.viaversion.viabackwards.api.rewriters;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
@Deprecated
|
||||
public abstract class LegacySoundRewriter<T extends BackwardsProtocol> extends RewriterBase<T> {
|
||||
|
@ -35,7 +35,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.Client
|
||||
public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.11", "1.10", null, true);
|
||||
private EntityPackets1_11 entityPackets; // Required for the item rewriter
|
||||
private final EntityPackets1_11 entityPackets = new EntityPackets1_11(this); // Required for the item rewriter
|
||||
private BlockItemPackets1_11 blockItemPackets;
|
||||
|
||||
public Protocol1_10To1_11() {
|
||||
@ -44,7 +44,7 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
(entityPackets = new EntityPackets1_11(this)).register();
|
||||
entityPackets.register();
|
||||
new PlayerPackets1_11().register(this);
|
||||
(blockItemPackets = new BlockItemPackets1_11(this)).register();
|
||||
|
||||
@ -67,10 +67,6 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
|
||||
}
|
||||
}
|
||||
|
||||
public EntityPackets1_11 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_11 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
@ -80,6 +76,11 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets1_11 getEntityRewriter() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMappingDataToLoad() {
|
||||
return true;
|
||||
|
@ -335,7 +335,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To
|
||||
}
|
||||
});
|
||||
|
||||
protocol.getEntityPackets().filter().handler((event, meta) -> {
|
||||
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
||||
if (meta.metaType().type().equals(Type.ITEM)) // Is Item
|
||||
meta.setValue(handleItemToClient((Item) meta.getValue()));
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
|
||||
|
||||
public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_12, ClientboundPackets1_9_3, ServerboundPackets1_12, ServerboundPackets1_9_3> {
|
||||
|
||||
private EntityPackets1_12 entityPackets;
|
||||
private final EntityPackets1_12 entityPackets = new EntityPackets1_12(this);
|
||||
private BlockItemPackets1_12 blockItemPackets;
|
||||
|
||||
public Protocol1_11_1To1_12() {
|
||||
@ -48,7 +48,7 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
(entityPackets = new EntityPackets1_12(this)).register();
|
||||
entityPackets.register();
|
||||
(blockItemPackets = new BlockItemPackets1_12(this)).register();
|
||||
new SoundPackets1_12(this).register();
|
||||
new ChatPackets1_12(this).register();
|
||||
@ -83,11 +83,12 @@ public class Protocol1_11_1To1_12 extends BackwardsProtocol<ClientboundPackets1_
|
||||
user.put(new ShoulderTracker(user));
|
||||
}
|
||||
|
||||
public EntityPackets1_12 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_12 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets1_12 getEntityRewriter() {
|
||||
return entityPackets;
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
||||
}
|
||||
});
|
||||
|
||||
protocol.getEntityPackets().filter().handler((event, meta) -> {
|
||||
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
||||
if (meta.metaType().type().equals(Type.ITEM)) // Is Item
|
||||
meta.setValue(handleItemToClient((Item) meta.getValue()));
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
public class ChatPackets1_12 extends RewriterBase<Protocol1_11_1To1_12> {
|
||||
|
||||
|
@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.Client
|
||||
|
||||
public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||
|
||||
private EntityPackets1_11_1 entityPackets;
|
||||
private final EntityPackets1_11_1 entityPackets = new EntityPackets1_11_1(this);
|
||||
|
||||
public Protocol1_11To1_11_1() {
|
||||
super(ClientboundPackets1_9_3.class, ClientboundPackets1_9_3.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9_3.class);
|
||||
@ -38,7 +38,7 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
(entityPackets = new EntityPackets1_11_1(this)).register();
|
||||
entityPackets.register();
|
||||
new ItemPackets1_11_1(this).register();
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_11Types.EntityType.PLAYER));
|
||||
}
|
||||
|
||||
public EntityPackets1_11_1 getEntityPackets() {
|
||||
@Override
|
||||
public EntityPackets1_11_1 getEntityRewriter() {
|
||||
return entityPackets;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<Protocol1_11To1_1
|
||||
itemRewriter.registerCreativeInvAction(ServerboundPackets1_9_3.CREATIVE_INVENTORY_ACTION, Type.ITEM);
|
||||
|
||||
// Handle item metadata
|
||||
protocol.getEntityPackets().filter().handler((event, meta) -> {
|
||||
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
||||
if (meta.metaType().type().equals(Type.ITEM)) { // Is Item
|
||||
meta.setValue(handleItemToClient((Item) meta.getValue()));
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.storage.TabComp
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||
@ -46,6 +47,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.Client
|
||||
public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_12_1, ServerboundPackets1_13, ServerboundPackets1_12_1> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_13(this);
|
||||
private BlockItemPackets1_13 blockItemPackets;
|
||||
|
||||
public Protocol1_12_2To1_13() {
|
||||
@ -79,7 +81,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
translatableRewriter.registerTabList(ClientboundPackets1_13.TAB_LIST);
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_13(this)).register();
|
||||
new EntityPackets1_13(this).register();
|
||||
entityRewriter.register();
|
||||
new PlayerPacket1_13(this).register();
|
||||
new SoundPackets1_13(this).register();
|
||||
|
||||
@ -119,4 +121,9 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
public class SoundPackets1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
private static final String[] SOUND_SOURCES = {"master", "music", "record", "weather", "block", "hostile", "neutral", "player", "ambient", "voice"};
|
||||
|
@ -31,6 +31,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
@ -44,8 +45,8 @@ import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_13, ServerboundPackets1_14, ServerboundPackets1_13> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.14", "1.13.2", Protocol1_14To1_13_2.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_14(this);
|
||||
private BlockItemPackets1_14 blockItemPackets;
|
||||
private EntityPackets1_14 entityPackets;
|
||||
|
||||
public Protocol1_13_2To1_14() {
|
||||
super(ClientboundPackets1_14.class, ClientboundPackets1_13.class, ServerboundPackets1_14.class, ServerboundPackets1_13.class);
|
||||
@ -68,12 +69,11 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
blockItemPackets = new BlockItemPackets1_14(this, translatableRewriter);
|
||||
blockItemPackets.register();
|
||||
entityPackets = new EntityPackets1_14(this);
|
||||
entityPackets.register();
|
||||
entityRewriter.register();
|
||||
new PlayerPackets1_14(this).register();
|
||||
new SoundPackets1_14(this).register();
|
||||
|
||||
new StatisticsRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_14.STATISTICS);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_14.STATISTICS);
|
||||
|
||||
cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
|
||||
cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_DISTANCE);
|
||||
@ -200,12 +200,13 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
public EntityPackets1_14 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
public class PlayerPackets1_14 extends RewriterBase<Protocol1_13_2To1_14> {
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import com.viaversion.viaversion.rewriter.RewriterBase;
|
||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||
|
||||
public class SoundPackets1_14 extends RewriterBase<Protocol1_13_2To1_14> {
|
||||
|
||||
|
@ -31,6 +31,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -47,6 +48,7 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_13, ServerboundPackets1_13, ServerboundPackets1_13> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.13.2", "1.13", Protocol1_13_1To1_13.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_13_1(this);
|
||||
|
||||
public Protocol1_13To1_13_1() {
|
||||
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
|
||||
@ -56,7 +58,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
protected void registerPackets() {
|
||||
executeAsyncAfterLoaded(Protocol1_13_1To1_13.class, MAPPINGS::load);
|
||||
|
||||
new EntityPackets1_13_1(this).register();
|
||||
entityRewriter.register();
|
||||
InventoryPackets1_13_1.register(this);
|
||||
WorldPackets1_13_1.register(this);
|
||||
|
||||
@ -210,8 +212,8 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, null).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
|
||||
new StatisticsRewriter(this, null).register(ClientboundPackets1_13.STATISTICS);
|
||||
new TagRewriter(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_13.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -227,4 +229,9 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.data.EntityTypeMapping;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.data.ImmediateRespawn;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.packets.BlockItemPackets1_15;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.packets.EntityPackets1_15;
|
||||
@ -29,6 +28,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
@ -42,6 +42,7 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_15, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.15", "1.14", Protocol1_15To1_14_4.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_15(this);
|
||||
private BlockItemPackets1_15 blockItemPackets;
|
||||
|
||||
public Protocol1_14_4To1_15() {
|
||||
@ -63,7 +64,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
translatableRewriter.registerPing();
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_15(this, translatableRewriter)).register();
|
||||
new EntityPackets1_15(this).register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_15.SOUND);
|
||||
@ -96,9 +97,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this, EntityTypeMapping::getOldEntityId).register(ClientboundPackets1_15.STATISTICS);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_15.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,4 +116,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -21,23 +21,31 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_14to1_14_1.packets.EntityPackets1_14_1;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14;
|
||||
|
||||
public class Protocol1_14To1_14_1 extends BackwardsProtocol<ClientboundPackets1_14, ClientboundPackets1_14, ServerboundPackets1_14, ServerboundPackets1_14> {
|
||||
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_14_1(this);
|
||||
|
||||
public Protocol1_14To1_14_1() {
|
||||
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new EntityPackets1_14_1(this).register();
|
||||
entityRewriter.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection user) {
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_15Types.PLAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -45,12 +46,14 @@ import com.viaversion.viaversion.rewriter.RegistryType;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.GsonUtil;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_16, ClientboundPackets1_15, ServerboundPackets1_16, ServerboundPackets1_14> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_16(this);
|
||||
private BlockItemPackets1_16 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
@ -73,8 +76,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
new CommandRewriter1_16(this).registerDeclareCommands(ClientboundPackets1_16.DECLARE_COMMANDS);
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_16(this, translatableRewriter)).register();
|
||||
EntityPackets1_16 entityPackets = new EntityPackets1_16(this);
|
||||
entityPackets.register();
|
||||
entityRewriter.register();
|
||||
|
||||
registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {
|
||||
@Override
|
||||
@ -135,9 +137,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_16.STATISTICS);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_16.STATISTICS);
|
||||
|
||||
registerServerbound(ServerboundPackets1_14.ENTITY_ACTION, new PacketRemapper() {
|
||||
@Override
|
||||
@ -218,4 +220,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -44,6 +45,7 @@ import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16, ServerboundPackets1_16_2, ServerboundPackets1_16> {
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.16.2", "1.16", Protocol1_16_2To1_16_1.class, true);
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_16_2(this);
|
||||
private BlockItemPackets1_16_2 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
@ -67,8 +69,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
new CommandRewriter1_16_2(this).registerDeclareCommands(ClientboundPackets1_16_2.DECLARE_COMMANDS);
|
||||
|
||||
(blockItemPackets = new BlockItemPackets1_16_2(this, translatableRewriter)).register();
|
||||
EntityPackets1_16_2 entityPackets = new EntityPackets1_16_2(this);
|
||||
entityPackets.register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
|
||||
@ -129,9 +130,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,4 +152,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
public BackwardsMappings getMappingData() {
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList;
|
||||
@ -50,6 +51,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true);
|
||||
private static final int[] EMPTY_ARRAY = {};
|
||||
private final EntityRewriter entityRewriter = new EntityPackets1_17(this);
|
||||
private BlockItemPackets1_17 blockItemPackets;
|
||||
private TranslatableRewriter translatableRewriter;
|
||||
|
||||
@ -72,8 +74,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
|
||||
blockItemPackets = new BlockItemPackets1_17(this, translatableRewriter);
|
||||
blockItemPackets.register();
|
||||
|
||||
EntityPackets1_17 entityPackets = new EntityPackets1_17(this);
|
||||
entityPackets.register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_17.SOUND);
|
||||
@ -81,7 +82,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
|
||||
|
||||
TagRewriter tagRewriter = new TagRewriter(this, entityPackets::newEntityId);
|
||||
TagRewriter tagRewriter = new TagRewriter(this);
|
||||
registerClientbound(ClientboundPackets1_17.TAGS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -139,7 +140,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new StatisticsRewriter(this, entityPackets::newEntityId).register(ClientboundPackets1_17.STATISTICS);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_17.STATISTICS);
|
||||
|
||||
registerClientbound(ClientboundPackets1_17.RESOURCE_PACK, new PacketRemapper() {
|
||||
@Override
|
||||
@ -255,4 +256,9 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
|
||||
return (short) Math.round(inputValue * 63.5F);
|
||||
}
|
||||
};
|
||||
private EntityPackets1_10 entityPackets; // Required for the item rewriter
|
||||
private final EntityPackets1_10 entityPackets = new EntityPackets1_10(this);
|
||||
private BlockItemPackets1_10 blockItemPackets;
|
||||
|
||||
public Protocol1_9_4To1_10() {
|
||||
@ -50,7 +50,7 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
|
||||
}
|
||||
|
||||
protected void registerPackets() {
|
||||
(entityPackets = new EntityPackets1_10(this)).register();
|
||||
entityPackets.register();
|
||||
(blockItemPackets = new BlockItemPackets1_10(this)).register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
@ -99,10 +99,6 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
|
||||
user.addEntityTracker(this.getClass(), new EntityTrackerBase(user, Entity1_10Types.EntityType.PLAYER));
|
||||
}
|
||||
|
||||
public EntityPackets1_10 getEntityPackets() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
public BlockItemPackets1_10 getBlockItemPackets() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
@ -112,6 +108,11 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPackets1_10 getEntityRewriter() {
|
||||
return entityPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMappingDataToLoad() {
|
||||
return true;
|
||||
|
@ -137,7 +137,7 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4T
|
||||
});
|
||||
|
||||
// Rewrite metadata items
|
||||
protocol.getEntityPackets().filter().handler((event, meta) -> {
|
||||
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
||||
if (meta.metaType().type().equals(Type.ITEM)) // Is Item
|
||||
meta.setValue(handleItemToClient((Item) meta.getValue()));
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.0"
|
||||
[versions]
|
||||
|
||||
# ViaVersion
|
||||
viaver = "4.0.0-1.17-pre4-SNAPSHOT"
|
||||
viaver = "4.0.0-1.17-pre5-SNAPSHOT"
|
||||
|
||||
# Common provided
|
||||
netty = "4.0.20.Final"
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren