Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-17 13:30:14 +01:00
Ensure correct packet types in rewriters during compile time
Dieser Commit ist enthalten in:
Ursprung
a506b21f56
Commit
f30fdc1feb
@ -55,7 +55,7 @@ public abstract class BackwardsProtocol<C1 extends ClientboundPacketType, C2 ext
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable TranslatableRewriter getTranslatableRewriter() {
|
||||
public @Nullable TranslatableRewriter<C1> getTranslatableRewriter() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ import java.util.function.Supplier;
|
||||
public class EntityPositionHandler {
|
||||
|
||||
public static final double RELATIVE_MOVE_FACTOR = 32 * 128;
|
||||
private final EntityRewriterBase entityRewriter;
|
||||
private final EntityRewriterBase<?, ?> entityRewriter;
|
||||
private final Class<? extends EntityPositionStorage> storageClass;
|
||||
private final Supplier<? extends EntityPositionStorage> storageSupplier;
|
||||
private boolean warnedForMissingEntity;
|
||||
|
||||
public EntityPositionHandler(EntityRewriterBase entityRewriter,
|
||||
public EntityPositionHandler(EntityRewriterBase<?, ?> entityRewriter,
|
||||
Class<? extends EntityPositionStorage> storageClass, Supplier<? extends EntityPositionStorage> storageSupplier) {
|
||||
this.entityRewriter = entityRewriter;
|
||||
this.storageClass = storageClass;
|
||||
|
@ -38,15 +38,15 @@ import java.util.Map;
|
||||
public class EnchantmentRewriter {
|
||||
|
||||
private final Map<String, String> enchantmentMappings = new HashMap<>();
|
||||
private final ItemRewriter itemRewriter;
|
||||
private final ItemRewriter<?, ?, ?> itemRewriter;
|
||||
private final boolean jsonFormat;
|
||||
|
||||
public EnchantmentRewriter(ItemRewriter itemRewriter, boolean jsonFormat) {
|
||||
public EnchantmentRewriter(ItemRewriter<?, ?, ?> itemRewriter, boolean jsonFormat) {
|
||||
this.itemRewriter = itemRewriter;
|
||||
this.jsonFormat = jsonFormat;
|
||||
}
|
||||
|
||||
public EnchantmentRewriter(ItemRewriter itemRewriter) {
|
||||
public EnchantmentRewriter(ItemRewriter<?, ?, ?> itemRewriter) {
|
||||
this(itemRewriter, true);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_14;
|
||||
|
||||
public abstract class EntityRewriter<T extends BackwardsProtocol> extends EntityRewriterBase<T> {
|
||||
public abstract class EntityRewriter<C extends ClientboundPacketType, T extends BackwardsProtocol<C, ?, ?, ?>> extends EntityRewriterBase<C, T> {
|
||||
|
||||
protected EntityRewriter(T protocol) {
|
||||
this(protocol, Types1_14.META_TYPES.optionalComponentType, Types1_14.META_TYPES.booleanType);
|
||||
@ -39,7 +39,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTrackerWithData(ClientboundPacketType packetType, EntityType fallingBlockType) {
|
||||
public void registerTrackerWithData(C packetType, EntityType fallingBlockType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -79,7 +79,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Entity
|
||||
};
|
||||
}
|
||||
|
||||
public void registerSpawnTracker(ClientboundPacketType packetType) {
|
||||
public void registerSpawnTracker(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -28,6 +28,7 @@ import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
@ -46,7 +47,7 @@ import java.util.List;
|
||||
* @see com.viaversion.viabackwards.api.rewriters.EntityRewriter
|
||||
* @see LegacyEntityRewriter
|
||||
*/
|
||||
public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends EntityRewriter<T> {
|
||||
public abstract class EntityRewriterBase<C extends ClientboundPacketType, T extends BackwardsProtocol<C, ?, ?, ?>> extends EntityRewriter<C, T> {
|
||||
private final Int2ObjectMap<EntityData> entityDataMappings = new Int2ObjectOpenHashMap<>();
|
||||
private final MetaType displayNameMetaType;
|
||||
private final MetaType displayVisibilityMetaType;
|
||||
|
@ -21,6 +21,7 @@ import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.data.MappedItem;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -32,7 +33,8 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewriterBase<T> {
|
||||
public abstract class ItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
||||
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriterBase<C, S, T> {
|
||||
|
||||
protected ItemRewriter(T protocol) {
|
||||
super(protocol, true);
|
||||
@ -119,7 +121,7 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAdvancements(ClientboundPacketType packetType, Type<Item> type) {
|
||||
public void registerAdvancements(C packetType, Type<Item> type) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -138,7 +140,7 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
|
||||
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||
final JsonElement title = wrapper.passthrough(Type.COMPONENT);
|
||||
final JsonElement description = wrapper.passthrough(Type.COMPONENT);
|
||||
final TranslatableRewriter translatableRewriter = protocol.getTranslatableRewriter();
|
||||
final TranslatableRewriter<C> translatableRewriter = protocol.getTranslatableRewriter();
|
||||
if (translatableRewriter != null) {
|
||||
translatableRewriter.processText(title);
|
||||
translatableRewriter.processText(description);
|
||||
|
@ -19,6 +19,8 @@ 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.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
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;
|
||||
@ -26,7 +28,8 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends ItemRewriter<T> {
|
||||
public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
||||
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriter<C, S, T> {
|
||||
|
||||
protected final String nbtTagName;
|
||||
protected final boolean jsonNameFormat;
|
||||
@ -37,6 +40,7 @@ public abstract class ItemRewriterBase<T extends BackwardsProtocol> extends Item
|
||||
nbtTagName = "VB|" + protocol.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Item handleItemToServer(@Nullable Item item) {
|
||||
if (item == null) return null;
|
||||
super.handleItemToServer(item);
|
||||
|
@ -26,6 +26,8 @@ import com.viaversion.viabackwards.utils.Block;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -43,7 +45,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class LegacyBlockItemRewriter<T extends BackwardsProtocol> extends ItemRewriterBase<T> {
|
||||
public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
||||
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriterBase<C, S, T> {
|
||||
|
||||
private static final Map<String, Int2ObjectMap<MappedLegacyBlockItem>> LEGACY_MAPPINGS = new HashMap<>();
|
||||
protected final Int2ObjectMap<MappedLegacyBlockItem> replacementData;
|
||||
|
@ -40,7 +40,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends EntityRewriterBase<T> {
|
||||
public abstract class LegacyEntityRewriter<C extends ClientboundPacketType, T extends BackwardsProtocol<C, ?, ?, ?>> extends EntityRewriterBase<C, T> {
|
||||
private final Map<ObjectType, EntityData> objectTypes = new HashMap<>();
|
||||
|
||||
protected LegacyEntityRewriter(T protocol) {
|
||||
@ -61,7 +61,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
return objectTypes.get(type);
|
||||
}
|
||||
|
||||
protected void registerRespawn(ClientboundPacketType packetType) {
|
||||
protected void registerRespawn(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -74,7 +74,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
});
|
||||
}
|
||||
|
||||
protected void registerJoinGame(ClientboundPacketType packetType, EntityType playerType) {
|
||||
protected void registerJoinGame(C packetType, EntityType playerType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -91,7 +91,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
||||
public void registerMetadataRewriter(C packetType, Type<List<Metadata>> oldMetaType, Type<List<Metadata>> newMetaType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -110,7 +110,7 @@ public abstract class LegacyEntityRewriter<T extends BackwardsProtocol> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMetadataRewriter(ClientboundPacketType packetType, Type<List<Metadata>> metaType) {
|
||||
public void registerMetadataRewriter(C packetType, Type<List<Metadata>> metaType) {
|
||||
registerMetadataRewriter(packetType, null, metaType);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
@Deprecated
|
||||
public abstract class LegacySoundRewriter<T extends BackwardsProtocol> extends RewriterBase<T> {
|
||||
public abstract class LegacySoundRewriter<T extends BackwardsProtocol<?, ?, ?, ?>> extends RewriterBase<T> {
|
||||
protected final Int2ObjectMap<SoundData> soundRewrites = new Int2ObjectOpenHashMap<>(64);
|
||||
|
||||
protected LegacySoundRewriter(T protocol) {
|
||||
|
@ -23,16 +23,16 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
|
||||
public class SoundRewriter extends com.viaversion.viaversion.rewriter.SoundRewriter {
|
||||
public class SoundRewriter<C extends ClientboundPacketType> extends com.viaversion.viaversion.rewriter.SoundRewriter<C> {
|
||||
|
||||
private final BackwardsProtocol protocol;
|
||||
private final BackwardsProtocol<C, ?, ?, ?> protocol;
|
||||
|
||||
public SoundRewriter(BackwardsProtocol protocol) {
|
||||
public SoundRewriter(BackwardsProtocol<C, ?, ?, ?> protocol) {
|
||||
super(protocol);
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public void registerNamedSound(ClientboundPacketType packetType) {
|
||||
public void registerNamedSound(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -42,7 +42,7 @@ public class SoundRewriter extends com.viaversion.viaversion.rewriter.SoundRewri
|
||||
});
|
||||
}
|
||||
|
||||
public void registerStopSound(ClientboundPacketType packetType) {
|
||||
public void registerStopSound(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -31,7 +31,7 @@ import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TranslatableRewriter extends ComponentRewriter {
|
||||
public class TranslatableRewriter<C extends ClientboundPacketType> extends ComponentRewriter<C> {
|
||||
|
||||
private static final Map<String, Map<String, String>> TRANSLATABLES = new HashMap<>();
|
||||
protected final Map<String, String> newTranslatables;
|
||||
@ -47,11 +47,11 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
}
|
||||
}
|
||||
|
||||
public TranslatableRewriter(BackwardsProtocol protocol) {
|
||||
public TranslatableRewriter(BackwardsProtocol<C, ?, ?, ?> protocol) {
|
||||
this(protocol, protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
||||
}
|
||||
|
||||
public TranslatableRewriter(BackwardsProtocol protocol, String sectionIdentifier) {
|
||||
public TranslatableRewriter(BackwardsProtocol<C, ?, ?, ?> protocol, String sectionIdentifier) {
|
||||
super(protocol);
|
||||
final Map<String, String> newTranslatables = TRANSLATABLES.get(sectionIdentifier);
|
||||
if (newTranslatables == null) {
|
||||
@ -71,7 +71,7 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerDisconnect(ClientboundPacketType packetType) {
|
||||
public void registerDisconnect(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -80,7 +80,7 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerLegacyOpenWindow(ClientboundPacketType packetType) {
|
||||
public void registerLegacyOpenWindow(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -91,7 +91,7 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerOpenWindow(ClientboundPacketType packetType) {
|
||||
public void registerOpenWindow(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -102,7 +102,7 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerTabList(ClientboundPacketType packetType) {
|
||||
public void registerTabList(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -114,7 +114,7 @@ public class TranslatableRewriter extends ComponentRewriter {
|
||||
});
|
||||
}
|
||||
|
||||
public void registerCombatKill(ClientboundPacketType packetType) {
|
||||
public void registerCombatKill(C packetType) {
|
||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -48,7 +48,7 @@ public class Protocol1_10To1_11 extends BackwardsProtocol<ClientboundPackets1_9_
|
||||
entityPackets.register();
|
||||
new PlayerPackets1_11().register(this);
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_9_3.NAMED_SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_9_3.SOUND);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.Client
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<Protocol1_10To1_11> {
|
||||
public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPackets1_9_3, ServerboundPackets1_9_3, Protocol1_10To1_11> {
|
||||
|
||||
private LegacyEnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
|
@ -41,7 +41,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPac
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11> {
|
||||
public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_10To1_11> {
|
||||
|
||||
public EntityPackets1_11(Protocol1_10To1_11 protocol) {
|
||||
super(protocol);
|
||||
|
@ -42,7 +42,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1To1_12> {
|
||||
public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPackets1_12, ServerboundPackets1_9_3, Protocol1_11_1To1_12> {
|
||||
|
||||
public BlockItemPackets1_12(Protocol1_11_1To1_12 protocol) {
|
||||
super(protocol);
|
||||
@ -56,34 +56,28 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<Protocol1_11_1
|
||||
map(Type.VAR_INT);
|
||||
map(Type.BYTE);
|
||||
map(Type.BOOLEAN);
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int count = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < count * 3; i++) {
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
}
|
||||
handler(wrapper -> {
|
||||
int count = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < count * 3; i++) {
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
}
|
||||
});
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
if (columns <= 0) return;
|
||||
handler(wrapper -> {
|
||||
short columns = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
if (columns <= 0) return;
|
||||
|
||||
short rows = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
|
||||
byte[] data = wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
short color = (short) (data[i] & 0xFF);
|
||||
if (color > 143) {
|
||||
color = (short) MapColorMapping.getNearestOldColor(color);
|
||||
data[i] = (byte) color;
|
||||
}
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Rows
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // X
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Z
|
||||
byte[] data = wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
short color = (short) (data[i] & 0xFF);
|
||||
if (color > 143) {
|
||||
color = (short) MapColorMapping.getNearestOldColor(color);
|
||||
data[i] = (byte) color;
|
||||
}
|
||||
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, data);
|
||||
}
|
||||
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, data);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
|
||||
public class ChatPackets1_12 extends RewriterBase<Protocol1_11_1To1_12> {
|
||||
|
||||
private final ComponentRewriter componentRewriter = new ComponentRewriter() {
|
||||
private final ComponentRewriter<ClientboundPackets1_12> componentRewriter = new ComponentRewriter<ClientboundPackets1_12>() {
|
||||
@Override
|
||||
protected void handleTranslate(JsonObject object, String translate) {
|
||||
String text = AdvancementTranslations.get(translate);
|
||||
|
@ -38,7 +38,7 @@ import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPacke
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityPackets1_12 extends LegacyEntityRewriter<Protocol1_11_1To1_12> {
|
||||
public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_12, Protocol1_11_1To1_12> {
|
||||
|
||||
public EntityPackets1_12(Protocol1_11_1To1_12 protocol) {
|
||||
super(protocol);
|
||||
|
@ -23,7 +23,6 @@ import com.viaversion.viabackwards.protocol.protocol1_11to1_11_1.packets.EntityP
|
||||
import com.viaversion.viabackwards.protocol.protocol1_11to1_11_1.packets.ItemPackets1_11_1;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_11Types;
|
||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||
@ -32,7 +31,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 final EntityPackets1_11_1 entityPackets = new EntityPackets1_11_1(this);
|
||||
private final ItemRewriter itemRewriter = new ItemPackets1_11_1(this);
|
||||
private final ItemPackets1_11_1 itemRewriter = new ItemPackets1_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);
|
||||
@ -60,7 +59,7 @@ public class Protocol1_11To1_11_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRewriter getItemRewriter() {
|
||||
public ItemPackets1_11_1 getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||
|
||||
public class EntityPackets1_11_1 extends LegacyEntityRewriter<Protocol1_11To1_11_1> {
|
||||
public class EntityPackets1_11_1 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_11To1_11_1> {
|
||||
|
||||
public EntityPackets1_11_1(Protocol1_11To1_11_1 protocol) {
|
||||
super(protocol);
|
||||
|
@ -31,7 +31,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||
|
||||
public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<Protocol1_11To1_11_1> {
|
||||
public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPackets1_9_3, ServerboundPackets1_9_3, Protocol1_11To1_11_1> {
|
||||
|
||||
private LegacyEnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
|
@ -34,7 +34,6 @@ 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;
|
||||
@ -47,7 +46,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 final EntityPackets1_13 entityRewriter = new EntityPackets1_13(this);
|
||||
private final BlockItemPackets1_13 blockItemPackets = new BlockItemPackets1_13(this);
|
||||
|
||||
public Protocol1_12_2To1_13() {
|
||||
@ -62,7 +61,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
Via.getManager().getProviders().register(BackwardsBlockEntityProvider.class, new BackwardsBlockEntityProvider());
|
||||
});
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this) {
|
||||
TranslatableRewriter<ClientboundPackets1_13> translatableRewriter = new TranslatableRewriter<ClientboundPackets1_13>(this) {
|
||||
@Override
|
||||
protected void handleTranslate(JsonObject root, String translate) {
|
||||
String newTranslate = newTranslatables.get(translate);
|
||||
@ -119,7 +118,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_13 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_12_2To1_13> {
|
||||
public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<ClientboundPackets1_13, ServerboundPackets1_12_1, Protocol1_12_2To1_13> {
|
||||
|
||||
private final Map<String, String> enchantmentMappings = new HashMap<>();
|
||||
private final String extraNbtTag;
|
||||
|
@ -45,7 +45,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityPackets1_13 extends LegacyEntityRewriter<Protocol1_12_2To1_13> {
|
||||
public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_13, Protocol1_12_2To1_13> {
|
||||
|
||||
public EntityPackets1_13(Protocol1_12_2To1_13 protocol) {
|
||||
super(protocol);
|
||||
|
@ -48,8 +48,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class PlayerPacket1_13 extends RewriterBase<Protocol1_12_2To1_13> {
|
||||
|
||||
private final CommandRewriter commandRewriter = new CommandRewriter(protocol) {
|
||||
};
|
||||
private final CommandRewriter<ClientboundPackets1_13> commandRewriter = new CommandRewriter<>(protocol);
|
||||
|
||||
public PlayerPacket1_13(Protocol1_12_2To1_13 protocol) {
|
||||
super(protocol);
|
||||
|
@ -32,7 +32,6 @@ 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;
|
||||
@ -46,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 final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final EntityPackets1_14 entityRewriter = new EntityPackets1_14(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_14> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
private BlockItemPackets1_14 blockItemPackets;
|
||||
|
||||
public Protocol1_13_2To1_14() {
|
||||
@ -74,7 +73,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
new PlayerPackets1_14(this).register();
|
||||
new SoundPackets1_14(this).register();
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_14.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_14.STATISTICS);
|
||||
|
||||
cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
|
||||
cancelClientbound(ClientboundPackets1_14.UPDATE_VIEW_DISTANCE);
|
||||
@ -206,7 +205,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_14 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@ -216,7 +215,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_14> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,15 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CommandRewriter1_14 extends CommandRewriter {
|
||||
public class CommandRewriter1_14 extends CommandRewriter<ClientboundPackets1_14> {
|
||||
|
||||
public CommandRewriter1_14(Protocol protocol) {
|
||||
public CommandRewriter1_14(Protocol1_13_2To1_14 protocol) {
|
||||
super(protocol);
|
||||
|
||||
this.parserHandlers.put("minecraft:nbt_tag", wrapper -> {
|
||||
|
@ -60,7 +60,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_13_2To1_14> {
|
||||
public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<ClientboundPackets1_14, ServerboundPackets1_13, Protocol1_13_2To1_14> {
|
||||
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
@ -189,7 +189,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
|
||||
}
|
||||
});
|
||||
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION);
|
||||
BlockRewriter<ClientboundPackets1_14> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_14.COOLDOWN);
|
||||
registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
@ -295,7 +295,7 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
|
||||
}
|
||||
});
|
||||
|
||||
RecipeRewriter recipeHandler = new RecipeRewriter1_13_2(protocol);
|
||||
RecipeRewriter<ClientboundPackets1_14> recipeHandler = new RecipeRewriter1_13_2<>(protocol);
|
||||
protocol.registerClientbound(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -46,7 +46,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import com.viaversion.viaversion.rewriter.meta.MetaHandler;
|
||||
|
||||
public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14> {
|
||||
public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_14, Protocol1_13_2To1_14> {
|
||||
|
||||
private EntityPositionHandler positionHandler;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class SoundPackets1_14 extends RewriterBase<Protocol1_13_2To1_14> {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
SoundRewriter soundRewriter = new SoundRewriter(protocol);
|
||||
SoundRewriter<ClientboundPackets1_14> soundRewriter = new SoundRewriter<>(protocol);
|
||||
soundRewriter.registerSound(ClientboundPackets1_14.SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_14.NAMED_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_14.STOP_SOUND);
|
||||
|
@ -33,8 +33,6 @@ 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.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -50,8 +48,8 @@ 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);
|
||||
private final ItemRewriter itemRewriter = new InventoryPackets1_13_1(this);
|
||||
private final EntityPackets1_13_1 entityRewriter = new EntityPackets1_13_1(this);
|
||||
private final InventoryPackets1_13_1 itemRewriter = new InventoryPackets1_13_1(this);
|
||||
|
||||
public Protocol1_13To1_13_1() {
|
||||
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
|
||||
@ -65,7 +63,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
itemRewriter.register();
|
||||
WorldPackets1_13_1.register(this);
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
TranslatableRewriter<ClientboundPackets1_13> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
translatableRewriter.registerComponentPacket(ClientboundPackets1_13.CHAT_MESSAGE);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_13.COMBAT_EVENT);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_13.DISCONNECT);
|
||||
@ -222,8 +220,8 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_13.STATISTICS);
|
||||
new TagRewriter<>(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_13.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -241,12 +239,12 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_13_1 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRewriter getItemRewriter() {
|
||||
public InventoryPackets1_13_1 getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,15 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CommandRewriter1_13_1 extends CommandRewriter {
|
||||
public class CommandRewriter1_13_1 extends CommandRewriter<ClientboundPackets1_13> {
|
||||
|
||||
public CommandRewriter1_13_1(Protocol protocol) {
|
||||
public CommandRewriter1_13_1(Protocol1_13To1_13_1 protocol) {
|
||||
super(protocol);
|
||||
|
||||
this.parserHandlers.put("minecraft:dimension", wrapper -> {
|
||||
|
@ -34,7 +34,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityPackets1_13_1 extends LegacyEntityRewriter<Protocol1_13To1_13_1> {
|
||||
public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets1_13, Protocol1_13To1_13_1> {
|
||||
|
||||
public EntityPackets1_13_1(Protocol1_13To1_13_1 protocol) {
|
||||
super(protocol);
|
||||
|
@ -27,7 +27,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
|
||||
public class InventoryPackets1_13_1 extends ItemRewriter<Protocol1_13To1_13_1> {
|
||||
public class InventoryPackets1_13_1 extends ItemRewriter<ClientboundPackets1_13, ServerboundPackets1_13, Protocol1_13To1_13_1> {
|
||||
|
||||
public InventoryPackets1_13_1(Protocol1_13To1_13_1 protocol) {
|
||||
super(protocol);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets;
|
||||
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockFace;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
@ -33,8 +34,8 @@ import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public class WorldPackets1_13_1 {
|
||||
|
||||
public static void register(Protocol protocol) {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION);
|
||||
public static void register(Protocol1_13To1_13_1 protocol) {
|
||||
BlockRewriter<ClientboundPackets1_13> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_13.CHUNK_DATA, new PacketRemapper() {
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
});
|
||||
|
||||
RecipeRewriter recipeHandler = new RecipeRewriter1_14(this);
|
||||
RecipeRewriter<ClientboundPackets1_14> recipeHandler = new RecipeRewriter1_14<>(this);
|
||||
registerClientbound(ClientboundPackets1_14.DECLARE_RECIPES, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -29,7 +29,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
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,8 +41,8 @@ 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 final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final EntityPackets1_15 entityRewriter = new EntityPackets1_15(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_15> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
private BlockItemPackets1_15 blockItemPackets;
|
||||
|
||||
public Protocol1_14_4To1_15() {
|
||||
@ -66,7 +65,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
(blockItemPackets = new BlockItemPackets1_15(this)).register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_15> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_15.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_15.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_15.NAMED_SOUND);
|
||||
@ -97,9 +96,9 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter<>(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_15.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_15.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +113,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_15 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@ -124,7 +123,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_15> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_14_4To1_15> {
|
||||
public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<ClientboundPackets1_15, ServerboundPackets1_14, Protocol1_14_4To1_15> {
|
||||
|
||||
public BlockItemPackets1_15(Protocol1_14_4To1_15 protocol) {
|
||||
super(protocol);
|
||||
@ -40,9 +40,9 @@ public class BlockItemPackets1_15 extends com.viaversion.viabackwards.api.rewrit
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
BlockRewriter<ClientboundPackets1_15> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_14(protocol).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_14<>(protocol).registerDefaultHandler(ClientboundPackets1_15.DECLARE_RECIPES);
|
||||
|
||||
protocol.registerServerbound(ServerboundPackets1_14.EDIT_BOOK, new PacketRemapper() {
|
||||
@Override
|
||||
|
@ -33,7 +33,7 @@ import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPacke
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EntityPackets1_15 extends EntityRewriter<Protocol1_14_4To1_15> {
|
||||
public class EntityPackets1_15 extends EntityRewriter<ClientboundPackets1_15, Protocol1_14_4To1_15> {
|
||||
|
||||
public EntityPackets1_15(Protocol1_14_4To1_15 protocol) {
|
||||
super(protocol);
|
||||
|
@ -21,14 +21,13 @@ 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);
|
||||
private final EntityPackets1_14_1 entityRewriter = new EntityPackets1_14_1(this);
|
||||
|
||||
public Protocol1_14To1_14_1() {
|
||||
super(ClientboundPackets1_14.class, ClientboundPackets1_14.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
|
||||
@ -45,7 +44,7 @@ public class Protocol1_14To1_14_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_14_1 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPacke
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityPackets1_14_1 extends LegacyEntityRewriter<Protocol1_14To1_14_1> {
|
||||
public class EntityPackets1_14_1 extends LegacyEntityRewriter<ClientboundPackets1_14, Protocol1_14To1_14_1> {
|
||||
|
||||
public EntityPackets1_14_1(Protocol1_14To1_14_1 protocol) {
|
||||
super(protocol);
|
||||
|
@ -19,7 +19,6 @@ package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16;
|
||||
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.rewriters.SoundRewriter;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.chat.TranslatableRewriter1_16;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.CommandRewriter1_16;
|
||||
@ -32,7 +31,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
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;
|
||||
@ -52,8 +50,8 @@ 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 final TranslatableRewriter translatableRewriter = new TranslatableRewriter1_16(this);
|
||||
private final EntityPackets1_16 entityRewriter = new EntityPackets1_16(this);
|
||||
private final TranslatableRewriter1_16 translatableRewriter = new TranslatableRewriter1_16(this);
|
||||
private BlockItemPackets1_16 blockItemPackets;
|
||||
|
||||
public Protocol1_15_2To1_16() {
|
||||
@ -117,7 +115,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_16> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_16.NAMED_SOUND);
|
||||
@ -135,9 +133,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter<>(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_16.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_16.STATISTICS);
|
||||
|
||||
registerServerbound(ServerboundPackets1_14.ENTITY_ACTION, new PacketRemapper() {
|
||||
@Override
|
||||
@ -206,7 +204,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter1_16 getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@ -216,7 +214,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_16 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.chat;
|
||||
|
||||
import com.viaversion.viabackwards.ViaBackwards;
|
||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.libs.gson.JsonObject;
|
||||
@ -27,8 +27,9 @@ import com.viaversion.viaversion.libs.gson.JsonParseException;
|
||||
import com.viaversion.viaversion.libs.gson.JsonPrimitive;
|
||||
import com.viaversion.viaversion.libs.kyori.adventure.text.Component;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
|
||||
public class TranslatableRewriter1_16 extends TranslatableRewriter {
|
||||
public class TranslatableRewriter1_16 extends TranslatableRewriter<ClientboundPackets1_16> {
|
||||
|
||||
private static final ChatColor[] COLORS = {
|
||||
new ChatColor("black", 0x000000),
|
||||
@ -49,7 +50,7 @@ public class TranslatableRewriter1_16 extends TranslatableRewriter {
|
||||
new ChatColor("white", 0xffffff)
|
||||
};
|
||||
|
||||
public TranslatableRewriter1_16(BackwardsProtocol protocol) {
|
||||
public TranslatableRewriter1_16(Protocol1_15_2To1_16 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,14 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CommandRewriter1_16 extends CommandRewriter {
|
||||
public class CommandRewriter1_16 extends CommandRewriter<ClientboundPackets1_16> {
|
||||
|
||||
public CommandRewriter1_16(Protocol protocol) {
|
||||
public CommandRewriter1_16(Protocol1_15_2To1_16 protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_15_2To1_16> {
|
||||
public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<ClientboundPackets1_16, ServerboundPackets1_14, Protocol1_15_2To1_16> {
|
||||
|
||||
private EnchantmentRewriter enchantmentRewriter;
|
||||
|
||||
@ -62,9 +62,9 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
BlockRewriter<ClientboundPackets1_16> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
|
||||
RecipeRewriter1_14 recipeRewriter = new RecipeRewriter1_14(protocol);
|
||||
RecipeRewriter1_14<ClientboundPackets1_16> recipeRewriter = new RecipeRewriter1_14<>(protocol);
|
||||
// Remove new smithing type, only in this handler
|
||||
protocol.registerClientbound(ClientboundPackets1_16.DECLARE_RECIPES, new PacketRemapper() {
|
||||
@Override
|
||||
@ -86,7 +86,7 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit
|
||||
}
|
||||
|
||||
wrapper.write(Type.STRING, originalType);
|
||||
String id = wrapper.passthrough(Type.STRING); // Recipe Identifier
|
||||
wrapper.passthrough(Type.STRING); // Recipe Identifier
|
||||
recipeRewriter.handle(wrapper, type);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
|
||||
public class EntityPackets1_16 extends EntityRewriter<ClientboundPackets1_16, Protocol1_15_2To1_16> {
|
||||
|
||||
private final ValueTransformer<String, Integer> dimensionTransformer = new ValueTransformer<String, Integer>(Type.STRING, Type.INT) {
|
||||
@Override
|
||||
|
@ -31,7 +31,6 @@ 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;
|
||||
@ -46,8 +45,8 @@ 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 final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final EntityPackets1_16_2 entityRewriter = new EntityPackets1_16_2(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_16_2> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
private BlockItemPackets1_16_2 blockItemPackets;
|
||||
|
||||
public Protocol1_16_1To1_16_2() {
|
||||
@ -71,7 +70,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
(blockItemPackets = new BlockItemPackets1_16_2(this)).register();
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_16_2> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_16_2.NAMED_SOUND);
|
||||
@ -130,9 +129,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
});
|
||||
|
||||
new TagRewriter(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
|
||||
new TagRewriter<>(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_16_2.STATISTICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,7 +141,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_16_2> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@ -152,7 +151,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_16_2 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,15 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public class CommandRewriter1_16_2 extends CommandRewriter {
|
||||
public class CommandRewriter1_16_2 extends CommandRewriter<ClientboundPackets1_16_2> {
|
||||
|
||||
public CommandRewriter1_16_2(Protocol protocol) {
|
||||
public CommandRewriter1_16_2(Protocol1_16_1To1_16_2 protocol) {
|
||||
super(protocol);
|
||||
|
||||
this.parserHandlers.put("minecraft:angle", wrapper -> {
|
||||
|
@ -36,7 +36,7 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewri
|
||||
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.types.Chunk1_16Type;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<Protocol1_16_1To1_16_2> {
|
||||
public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewriters.ItemRewriter<ClientboundPackets1_16_2, ServerboundPackets1_16, Protocol1_16_1To1_16_2> {
|
||||
|
||||
public BlockItemPackets1_16_2(Protocol1_16_1To1_16_2 protocol) {
|
||||
super(protocol);
|
||||
@ -44,9 +44,9 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
BlockRewriter<ClientboundPackets1_16_2> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_16<>(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
|
||||
registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
|
@ -39,7 +39,7 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.packets.EntityPa
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class EntityPackets1_16_2 extends EntityRewriter<Protocol1_16_1To1_16_2> {
|
||||
public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2, Protocol1_16_1To1_16_2> {
|
||||
|
||||
private final Set<String> oldDimensions = Sets.newHashSet("minecraft:overworld", "minecraft:the_nether", "minecraft:the_end");
|
||||
private boolean warned;
|
||||
|
@ -32,8 +32,6 @@ import com.viaversion.viaversion.api.minecraft.TagData;
|
||||
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.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList;
|
||||
@ -46,7 +44,6 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPacke
|
||||
import com.viaversion.viaversion.rewriter.IdRewriteFunction;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -56,8 +53,8 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
|
||||
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 final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final EntityPackets1_17 entityRewriter = new EntityPackets1_17(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_17> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
private BlockItemPackets1_17 blockItemPackets;
|
||||
|
||||
public Protocol1_16_4To1_17() {
|
||||
@ -80,13 +77,13 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
|
||||
entityRewriter.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_17> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_17.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_17.ENTITY_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
|
||||
|
||||
TagRewriter tagRewriter = new TagRewriter(this);
|
||||
TagRewriter<ClientboundPackets1_17> tagRewriter = new TagRewriter<>(this);
|
||||
registerClientbound(ClientboundPackets1_17.TAGS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -144,7 +141,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
});
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_17.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_17.STATISTICS);
|
||||
|
||||
registerClientbound(ClientboundPackets1_17.RESOURCE_PACK, new PacketRemapper() {
|
||||
@Override
|
||||
@ -259,7 +256,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_17> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@ -276,12 +273,12 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_17 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRewriter getItemRewriter() {
|
||||
public BlockItemPackets1_17 getItemRewriter() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_17> {
|
||||
public final class BlockItemPackets1_17 extends ItemRewriter<ClientboundPackets1_17, ServerboundPackets1_16_2, Protocol1_16_4To1_17> {
|
||||
|
||||
public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol) {
|
||||
super(protocol);
|
||||
@ -60,9 +60,9 @@ public final class BlockItemPackets1_17 extends ItemRewriter<Protocol1_16_4To1_1
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
BlockRewriter<ClientboundPackets1_17> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_16<>(protocol).registerDefaultHandler(ClientboundPackets1_17.DECLARE_RECIPES);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_17.COOLDOWN);
|
||||
registerWindowItems(ClientboundPackets1_17.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||
|
@ -37,7 +37,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
|
||||
|
||||
public final class EntityPackets1_17 extends EntityRewriter<Protocol1_16_4To1_17> {
|
||||
public final class EntityPackets1_17 extends EntityRewriter<ClientboundPackets1_17, Protocol1_16_4To1_17> {
|
||||
|
||||
private boolean warned;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
|
||||
private static final BackwardsMappings MAPPINGS = new BackwardsMappings();
|
||||
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_18> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
private BlockItemPackets1_18 itemRewriter;
|
||||
|
||||
public Protocol1_17_1To1_18() {
|
||||
@ -66,13 +66,13 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
entityRewriter.register();
|
||||
itemRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
final SoundRewriter<ClientboundPackets1_18> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
|
||||
soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
|
||||
soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
|
||||
|
||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||
final TagRewriter<ClientboundPackets1_18> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
|
||||
|
||||
@ -155,7 +155,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_18> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -42,12 +42,11 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17T
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||
import com.viaversion.viaversion.util.MathUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_18> {
|
||||
public final class BlockItemPackets1_18 extends ItemRewriter<ClientboundPackets1_18, ServerboundPackets1_17, Protocol1_17_1To1_18> {
|
||||
|
||||
public BlockItemPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||
super(protocol);
|
||||
@ -55,7 +54,7 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_16<>(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_18.WINDOW_ITEMS);
|
||||
|
@ -34,7 +34,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
|
||||
public final class EntityPackets1_18 extends EntityRewriter<Protocol1_17_1To1_18> {
|
||||
public final class EntityPackets1_18 extends EntityRewriter<ClientboundPackets1_18, Protocol1_17_1To1_18> {
|
||||
|
||||
public EntityPackets1_18(final Protocol1_17_1To1_18 protocol) {
|
||||
super(protocol);
|
||||
|
@ -32,8 +32,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||
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.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
@ -50,7 +48,6 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPacke
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -61,7 +58,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
private static final byte[] EMPTY_BYTES = new byte[0];
|
||||
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
|
||||
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_19> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
|
||||
public Protocol1_18_2To1_19() {
|
||||
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
|
||||
@ -87,7 +84,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
blockItemPackets.register();
|
||||
entityRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
final SoundRewriter<ClientboundPackets1_19> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_19.STOP_SOUND);
|
||||
registerClientbound(ClientboundPackets1_19.SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
@ -130,7 +127,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
});
|
||||
|
||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||
final TagRewriter<ClientboundPackets1_19> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.removeTags("minecraft:banner_pattern");
|
||||
tagRewriter.removeTags("minecraft:instrument");
|
||||
tagRewriter.removeTags("minecraft:cat_variant");
|
||||
@ -141,9 +138,9 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:occludes_vibration_signals");
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_19.TAGS);
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_19.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_19.STATISTICS);
|
||||
|
||||
final CommandRewriter commandRewriter = new CommandRewriter1_19(this);
|
||||
final CommandRewriter<ClientboundPackets1_19> commandRewriter = new CommandRewriter1_19(this);
|
||||
registerClientbound(ClientboundPackets1_19.DECLARE_COMMANDS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -299,17 +296,17 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_19> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_19 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRewriter getItemRewriter() {
|
||||
public BlockItemPackets1_19 getItemRewriter() {
|
||||
return blockItemPackets;
|
||||
}
|
||||
}
|
||||
|
@ -17,13 +17,14 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.Protocol1_18_2To1_19;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
|
||||
public final class CommandRewriter1_19 extends CommandRewriter {
|
||||
public final class CommandRewriter1_19 extends CommandRewriter<ClientboundPackets1_19> {
|
||||
|
||||
public CommandRewriter1_19(Protocol protocol) {
|
||||
public CommandRewriter1_19(Protocol1_18_2To1_19 protocol) {
|
||||
super(protocol);
|
||||
this.parserHandlers.put("minecraft:template_mirror", wrapper -> wrapper.write(Type.VAR_INT, 0));
|
||||
this.parserHandlers.put("minecraft:template_rotation", wrapper -> wrapper.write(Type.VAR_INT, 0));
|
||||
|
@ -36,7 +36,7 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPacke
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.util.MathUtil;
|
||||
|
||||
public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_19> {
|
||||
public final class BlockItemPackets1_19 extends ItemRewriter<ClientboundPackets1_19, ServerboundPackets1_17, Protocol1_18_2To1_19> {
|
||||
|
||||
public BlockItemPackets1_19(final Protocol1_18_2To1_19 protocol) {
|
||||
super(protocol);
|
||||
@ -44,9 +44,9 @@ public final class BlockItemPackets1_19 extends ItemRewriter<Protocol1_18_2To1_1
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
final BlockRewriter<ClientboundPackets1_19> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
|
||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_19.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_16<>(protocol).registerDefaultHandler(ClientboundPackets1_19.DECLARE_RECIPES);
|
||||
|
||||
registerSetCooldown(ClientboundPackets1_19.COOLDOWN);
|
||||
registerWindowItems1_17_1(ClientboundPackets1_19.WINDOW_ITEMS);
|
||||
|
@ -41,7 +41,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||
|
||||
public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19> {
|
||||
public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_19, Protocol1_18_2To1_19> {
|
||||
|
||||
public EntityPackets1_19(final Protocol1_18_2To1_19 protocol) {
|
||||
super(protocol);
|
||||
|
@ -17,14 +17,15 @@
|
||||
*/
|
||||
package com.viaversion.viabackwards.protocol.protocol1_18to1_18_2.data;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_18to1_18_2.Protocol1_18To1_18_2;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class CommandRewriter1_18_2 extends CommandRewriter {
|
||||
public final class CommandRewriter1_18_2 extends CommandRewriter<ClientboundPackets1_18> {
|
||||
|
||||
public CommandRewriter1_18_2(Protocol protocol) {
|
||||
public CommandRewriter1_18_2(Protocol1_18To1_18_2 protocol) {
|
||||
super(protocol);
|
||||
|
||||
// Uncompletable without the full list
|
||||
|
@ -34,8 +34,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
||||
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.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.BitSetType;
|
||||
import com.viaversion.viaversion.api.type.types.ByteArrayType;
|
||||
@ -54,7 +52,6 @@ import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.CipherUtil;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundPackets1_19_3, ClientboundPackets1_19_1, ServerboundPackets1_19_3, ServerboundPackets1_19_1> {
|
||||
@ -64,7 +61,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
|
||||
private static final ByteArrayType SIGNATURE_BYTES_TYPE = new ByteArrayType(256);
|
||||
private final EntityPackets1_19_3 entityRewriter = new EntityPackets1_19_3(this);
|
||||
private final BlockItemPackets1_19_3 itemRewriter = new BlockItemPackets1_19_3(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_19_3> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
|
||||
public Protocol1_19_1To1_19_3() {
|
||||
super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_1.class);
|
||||
@ -91,7 +88,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
|
||||
itemRewriter.register();
|
||||
entityRewriter.register();
|
||||
|
||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
final SoundRewriter<ClientboundPackets1_19_3> soundRewriter = new SoundRewriter<>(this);
|
||||
soundRewriter.registerStopSound(ClientboundPackets1_19_3.STOP_SOUND);
|
||||
registerClientbound(ClientboundPackets1_19_3.SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
@ -165,14 +162,14 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
|
||||
}
|
||||
});
|
||||
|
||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||
final TagRewriter<ClientboundPackets1_19_3> tagRewriter = new TagRewriter<>(this);
|
||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood");
|
||||
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:overworld_natural_logs");
|
||||
tagRewriter.registerGeneric(ClientboundPackets1_19_3.TAGS);
|
||||
|
||||
new StatisticsRewriter(this).register(ClientboundPackets1_19_3.STATISTICS);
|
||||
new StatisticsRewriter<>(this).register(ClientboundPackets1_19_3.STATISTICS);
|
||||
|
||||
final CommandRewriter commandRewriter = new CommandRewriter(this);
|
||||
final CommandRewriter<ClientboundPackets1_19_3> commandRewriter = new CommandRewriter<>(this);
|
||||
registerClientbound(ClientboundPackets1_19_3.DECLARE_COMMANDS, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
@ -388,17 +385,17 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_19_3> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRewriter getItemRewriter() {
|
||||
public BlockItemPackets1_19_3 getItemRewriter() {
|
||||
return itemRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_19_3 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
|
||||
public final class BlockItemPackets1_19_3 extends ItemRewriter<Protocol1_19_1To1_19_3> {
|
||||
public final class BlockItemPackets1_19_3 extends ItemRewriter<ClientboundPackets1_19_3, ServerboundPackets1_19_1, Protocol1_19_1To1_19_3> {
|
||||
|
||||
public BlockItemPackets1_19_3(final Protocol1_19_1To1_19_3 protocol) {
|
||||
super(protocol);
|
||||
@ -36,7 +36,7 @@ public final class BlockItemPackets1_19_3 extends ItemRewriter<Protocol1_19_1To1
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||
final BlockRewriter<ClientboundPackets1_19_3> blockRewriter = new BlockRewriter<>(protocol, Type.POSITION1_14);
|
||||
blockRewriter.registerBlockAction(ClientboundPackets1_19_3.BLOCK_ACTION);
|
||||
blockRewriter.registerBlockChange(ClientboundPackets1_19_3.BLOCK_CHANGE);
|
||||
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_3.MULTI_BLOCK_CHANGE);
|
||||
@ -64,7 +64,7 @@ public final class BlockItemPackets1_19_3 extends ItemRewriter<Protocol1_19_1To1
|
||||
}
|
||||
});
|
||||
|
||||
final RecipeRewriter1_16 recipeRewriter = new RecipeRewriter1_16(protocol);
|
||||
final RecipeRewriter1_16<ClientboundPackets1_19_3> recipeRewriter = new RecipeRewriter1_16<>(protocol);
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.DECLARE_RECIPES, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -42,7 +42,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import java.util.BitSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class EntityPackets1_19_3 extends EntityRewriter<Protocol1_19_1To1_19_3> {
|
||||
public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets1_19_3, Protocol1_19_1To1_19_3> {
|
||||
|
||||
private static final BitSetType PROFILE_ACTIONS_ENUM_TYPE = new BitSetType(6);
|
||||
private static final int[] PROFILE_ACTIONS = {2, 4, 5}; // Ignore initialize chat and listed status; add player already handled before
|
||||
|
@ -47,7 +47,7 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
|
||||
|
||||
entityRewriter.register();
|
||||
|
||||
final CommandRewriter commandRewriter = new CommandRewriter(this) {
|
||||
final CommandRewriter<ClientboundPackets1_19_4> commandRewriter = new CommandRewriter<ClientboundPackets1_19_4>(this) {
|
||||
@Override
|
||||
public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception {
|
||||
if (argumentType.equals("minecraft:time")) {
|
||||
|
@ -31,7 +31,7 @@ import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPac
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
|
||||
public final class EntityPackets1_19_4 extends EntityRewriter<Protocol1_19_3To1_19_4> {
|
||||
public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets1_19_4, Protocol1_19_3To1_19_4> {
|
||||
|
||||
public EntityPackets1_19_4(final Protocol1_19_3To1_19_4 protocol) {
|
||||
super(protocol);
|
||||
|
@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
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;
|
||||
@ -57,11 +56,10 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPacke
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.EntityPackets;
|
||||
import com.viaversion.viaversion.util.CipherUtil;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPackets1_19_1, ClientboundPackets1_19, ServerboundPackets1_19_1, ServerboundPackets1_19> {
|
||||
|
||||
@ -70,7 +68,7 @@ public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPac
|
||||
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||
private static final byte[] EMPTY_BYTES = new byte[0];
|
||||
private final EntityPackets1_19_1 entityRewriter = new EntityPackets1_19_1(this);
|
||||
private final TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
private final TranslatableRewriter<ClientboundPackets1_19_1> translatableRewriter = new TranslatableRewriter<>(this);
|
||||
|
||||
public Protocol1_19To1_19_1() {
|
||||
super(ClientboundPackets1_19_1.class, ClientboundPackets1_19.class, ServerboundPackets1_19_1.class, ServerboundPackets1_19.class);
|
||||
@ -355,12 +353,12 @@ public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_19_1> getTranslatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRewriter getEntityRewriter() {
|
||||
public EntityPackets1_19_1 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
||||
|
||||
public final class EntityPackets1_19_1 extends EntityRewriter<Protocol1_19To1_19_1> {
|
||||
public final class EntityPackets1_19_1 extends EntityRewriter<ClientboundPackets1_19_1, Protocol1_19To1_19_1> {
|
||||
|
||||
public EntityPackets1_19_1(final Protocol1_19To1_19_1 protocol) {
|
||||
super(protocol);
|
||||
|
@ -53,7 +53,7 @@ public class Protocol1_9_4To1_10 extends BackwardsProtocol<ClientboundPackets1_9
|
||||
entityPackets.register();
|
||||
blockItemPackets.register();
|
||||
|
||||
SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||
SoundRewriter<ClientboundPackets1_9_3> soundRewriter = new SoundRewriter<>(this);
|
||||
registerClientbound(ClientboundPackets1_9_3.NAMED_SOUND, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
@ -32,7 +32,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPac
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<Protocol1_9_4To1_10> {
|
||||
public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPackets1_9_3, ServerboundPackets1_9_3, Protocol1_9_4To1_10> {
|
||||
|
||||
public BlockItemPackets1_10(Protocol1_9_4To1_10 protocol) {
|
||||
super(protocol);
|
||||
|
@ -39,7 +39,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPac
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityPackets1_10 extends LegacyEntityRewriter<Protocol1_9_4To1_10> {
|
||||
public class EntityPackets1_10 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_9_4To1_10> {
|
||||
|
||||
public EntityPackets1_10(Protocol1_9_4To1_10 protocol) {
|
||||
super(protocol);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren