From 5e7371d39b9d47c30d88a1d797f0ed81bc99b8f5 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 5 Sep 2021 13:23:58 +0200 Subject: [PATCH] Start working on 5.0.0 --- .../kotlin/vb.base-conventions.gradle.kts | 2 +- .../api/ViaBackwardsPlatform.java | 2 +- .../storage/EntityPositionHandler.java | 4 +- .../storage/EntityPositionStorage.java | 6 +-- .../storage/PlayerPositionStorage.java | 8 +-- .../api/entities/storage/WrappedMetadata.java | 16 +----- .../api/rewriters/EnchantmentRewriter.java | 37 +++++-------- .../api/rewriters/EntityRewriter.java | 2 +- .../rewriters/LegacyBlockItemRewriter.java | 53 +++--------------- .../rewriters/LegacyEnchantmentRewriter.java | 4 +- .../api/rewriters/LegacyEntityRewriter.java | 4 +- .../api/rewriters/LegacySoundRewriter.java | 37 ++----------- .../packets/BlockItemPackets1_11.java | 10 ++-- .../packets/EntityPackets1_11.java | 30 +++++------ .../packets/PlayerPackets1_11.java | 4 +- .../data/ShoulderTracker.java | 3 +- .../packets/BlockItemPackets1_12.java | 13 +++-- .../packets/ChatPackets1_12.java | 2 +- .../Protocol1_12_2To1_13.java | 4 +- .../data/BackwardsMappings.java | 17 ++---- .../data/EntityTypeMapping.java | 12 +---- .../data/ParticleMapping.java | 15 +++--- .../packets/BlockItemPackets1_13.java | 31 +++-------- .../packets/EntityPackets1_13.java | 31 +++++------ .../packets/PlayerPacket1_13.java | 53 +++++++----------- .../BackwardsBlockEntityProvider.java | 4 +- .../data/CommandRewriter1_14.java | 19 +++---- .../packets/BlockItemPackets1_14.java | 54 ++++++++----------- .../packets/EntityPackets1_14.java | 32 ++++------- .../packets/SoundPackets1_14.java | 6 +-- .../storage/ChunkLightStorage.java | 25 ++++----- .../Protocol1_13To1_13_1.java | 2 +- .../data/CommandRewriter1_13_1.java | 4 +- .../packets/WorldPackets1_13_1.java | 23 +++----- .../chat/TranslatableRewriter1_16.java | 4 +- .../packets/BlockItemPackets1_16.java | 32 +++-------- .../packets/EntityPackets1_16.java | 16 +++--- .../Protocol1_16_1To1_16_2.java | 2 +- .../data/CommandRewriter1_16_2.java | 4 +- .../packets/BlockItemPackets1_17.java | 2 +- .../packets/EntityPackets1_17.java | 9 +--- .../Protocol1_18_2To1_19.java | 28 +++++++--- .../storage/NonceStorage.java | 11 +--- .../storage/StoredPainting.java | 22 +++----- .../Protocol1_19_1To1_19_3.java | 17 ++++-- .../packets/EntityPackets1_19_3.java | 43 ++------------- .../storage/NonceStorage.java | 12 +---- .../Protocol1_19_3To1_19_4.java | 4 +- .../packets/BlockItemPackets1_19_4.java | 4 +- .../packets/BlockItemPackets1_20.java | 3 +- .../storage/BackSignEditStorage.java | 12 +---- .../Protocol1_19To1_19_1.java | 15 +++++- .../storage/NonceStorage.java | 13 +---- .../Protocol1_20_2To1_20_3.java | 8 +-- .../BlockItemPacketRewriter1_20_3.java | 4 +- .../storage/ResourcepackIDStorage.java | 11 +--- .../Protocol1_20_3To1_20_5.java | 10 ++-- .../BlockItemPacketRewriter1_20_5.java | 52 +++++++----------- .../Protocol1_20To1_20_2.java | 3 +- .../BlockItemPacketRewriter1_20_2.java | 16 +++--- .../storage/ConfigurationPacketStorage.java | 25 ++------- .../chunks/BlockEntity.java | 4 +- .../Protocol1_9_4To1_10.java | 4 +- gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- settings.gradle.kts | 1 + 66 files changed, 337 insertions(+), 627 deletions(-) diff --git a/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts b/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts index 42f6f817..6f3f42d5 100644 --- a/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/vb.base-conventions.gradle.kts @@ -21,7 +21,7 @@ tasks { } java { - javaTarget(8) + javaTarget(17) withSourcesJar() } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java index aa5d6d92..004398bf 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java @@ -68,7 +68,7 @@ import java.util.logging.Logger; public interface ViaBackwardsPlatform { - String MINIMUM_VV_VERSION = "4.10.2"; + String MINIMUM_VV_VERSION = "5.0.0"; /** * Initialize ViaBackwards. diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionHandler.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionHandler.java index e05b3135..6e75b0a9 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionHandler.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionHandler.java @@ -41,12 +41,12 @@ public class EntityPositionHandler { this.storageSupplier = storageSupplier; } - public void cacheEntityPosition(PacketWrapper wrapper, boolean create, boolean relative) throws Exception { + public void cacheEntityPosition(PacketWrapper wrapper, boolean create, boolean relative) { cacheEntityPosition(wrapper, wrapper.get(Type.DOUBLE, 0), wrapper.get(Type.DOUBLE, 1), wrapper.get(Type.DOUBLE, 2), create, relative); } - public void cacheEntityPosition(PacketWrapper wrapper, double x, double y, double z, boolean create, boolean relative) throws Exception { + public void cacheEntityPosition(PacketWrapper wrapper, double x, double y, double z, boolean create, boolean relative) { int entityId = wrapper.get(Type.VAR_INT, 0); StoredEntityData storedEntity = entityRewriter.tracker(wrapper.user()).entityData(entityId); if (storedEntity == null) { diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionStorage.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionStorage.java index 29869283..38df14f5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/EntityPositionStorage.java @@ -22,15 +22,15 @@ public abstract class EntityPositionStorage { private double y; private double z; - public double getX() { + public double x() { return x; } - public double getY() { + public double y() { return y; } - public double getZ() { + public double z() { return z; } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/PlayerPositionStorage.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/PlayerPositionStorage.java index 7e7a4ff4..8d143572 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/PlayerPositionStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/PlayerPositionStorage.java @@ -29,15 +29,15 @@ public abstract class PlayerPositionStorage implements StorableObject { protected PlayerPositionStorage() { } - public double getX() { + public double x() { return x; } - public double getY() { + public double y() { return y; } - public double getZ() { + public double z() { return z; } @@ -53,7 +53,7 @@ public abstract class PlayerPositionStorage implements StorableObject { this.z = z; } - public void setCoordinates(PacketWrapper wrapper, boolean relative) throws Exception { + public void setCoordinates(PacketWrapper wrapper, boolean relative) { setCoordinates(wrapper.get(Type.DOUBLE, 0), wrapper.get(Type.DOUBLE, 1), wrapper.get(Type.DOUBLE, 2), relative); } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/WrappedMetadata.java b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/WrappedMetadata.java index 9fc5ab39..1ad32ffe 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/WrappedMetadata.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/entities/storage/WrappedMetadata.java @@ -22,12 +22,7 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import java.util.List; import org.checkerframework.checker.nullness.qual.Nullable; -public final class WrappedMetadata { - private final List metadataList; - - public WrappedMetadata(List metadataList) { - this.metadataList = metadataList; - } +public record WrappedMetadata(List metadataList) { public boolean has(Metadata data) { return this.metadataList.contains(data); @@ -53,13 +48,4 @@ public final class WrappedMetadata { } return null; } - - public List metadataList() { - return metadataList; - } - - @Override - public String toString() { - return "MetaStorage{" + "metaDataList=" + metadataList + '}'; - } } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java index 64d8c946..d6407f5c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EnchantmentRewriter.java @@ -146,29 +146,18 @@ public class EnchantmentRewriter { } public static String getRomanNumber(int number) { - switch (number) { - case 1: - return "I"; - case 2: - return "II"; - case 3: - return "III"; - case 4: - return "IV"; - case 5: - return "V"; - case 6: - return "VI"; - case 7: - return "VII"; - case 8: - return "VIII"; - case 9: - return "IX"; - case 10: - return "X"; - default: - return Integer.toString(number); - } + return switch (number) { + case 1 -> "I"; + case 2 -> "II"; + case 3 -> "III"; + case 4 -> "IV"; + case 5 -> "V"; + case 6 -> "VI"; + case 7 -> "VII"; + case 8 -> "VIII"; + case 9 -> "IX"; + case 10 -> "X"; + default -> Integer.toString(number); + }; } } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriter.java index d0a4b3e0..ee3dee49 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/EntityRewriter.java @@ -138,7 +138,7 @@ public abstract class EntityRewriter 255) continue; // 1.17 + if (pos.y() < 0 || pos.y() > 255) continue; // 1.17 - ChunkSection section = chunk.getSections()[pos.getY() >> 4]; + ChunkSection section = chunk.getSections()[pos.y() >> 4]; if (section == null) continue; - int block = section.palette(PaletteType.BLOCKS).idAt(pos.getX(), pos.getY() & 0xF, pos.getZ()); + int block = section.palette(PaletteType.BLOCKS).idAt(pos.x(), pos.y() & 0xF, pos.z()); MappedLegacyBlockItem settings = getMappedBlock(block); if (settings != null && settings.hasBlockEntityHandler()) { @@ -379,51 +379,10 @@ public abstract class LegacyBlockItemRewriter entry : soundRewrites.int2ObjectEntrySet()) { if (soundId > entry.getIntKey()) { - if (entry.getValue().isAdded()) { + if (entry.getValue().added()) { newSoundId--; } else { newSoundId++; @@ -66,41 +66,14 @@ public abstract class LegacySoundRewriter { if (isLlama(wrapper.user())) { Optional horse = getChestedHorse(wrapper.user()); - if (!horse.isPresent()) + if (horse.isEmpty()) { return; + } + ChestedHorseStorage storage = horse.get(); int currentSlot = wrapper.get(Type.SHORT, 0); wrapper.set(Type.SHORT, 0, ((Integer) (currentSlot = getNewSlotId(storage, currentSlot))).shortValue()); @@ -94,8 +96,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter horse = getChestedHorse(wrapper.user()); - if (!horse.isPresent()) + if (horse.isEmpty()) { return; + } ChestedHorseStorage storage = horse.get(); stacks = Arrays.copyOf(stacks, !storage.isChested() ? 38 : 53); @@ -156,8 +159,9 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter { if (isLlama(wrapper.user())) { Optional horse = getChestedHorse(wrapper.user()); - if (!horse.isPresent()) + if (horse.isEmpty()) { return; + } ChestedHorseStorage storage = horse.get(); int clickSlot = wrapper.get(Type.SHORT, 0); int correctSlot = getOldSlotId(storage, clickSlot); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java index 62a94f86..02ef3802 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/EntityPackets1_11.java @@ -221,20 +221,14 @@ public class EntityPackets1_11 extends LegacyEntityRewriter { switch (meta.id()) { - case 13: - event.cancel(); - return; - case 14: - event.setIndex(15); - break; - case 15: - event.setIndex(14); - break; - // Profession - case 16: + case 13 -> event.cancel(); + case 14 -> event.setIndex(15); + case 15 -> event.setIndex(14); + case 16 -> { + // Profession event.setIndex(13); meta.setValue(1 + (int) meta.getValue()); - break; + } } }); @@ -297,18 +291,18 @@ public class EntityPackets1_11 extends LegacyEntityRewriter { storage.setLiamaStrength((int) meta.getValue()); event.cancel(); - break; - case 17: + } + case 17 -> { storage.setLiamaCarpetColor((int) meta.getValue()); event.cancel(); - break; - case 18: + } + case 18 -> { storage.setLiamaVariant((int) meta.getValue()); event.cancel(); - break; + } } }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/PlayerPackets1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/PlayerPackets1_11.java index 73b21838..a99c1bbb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/PlayerPackets1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_10to1_11/packets/PlayerPackets1_11.java @@ -30,9 +30,9 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPac import com.viaversion.viaversion.util.ComponentUtil; public class PlayerPackets1_11 { - private static final ValueTransformer TO_NEW_FLOAT = new ValueTransformer(Type.FLOAT) { + private static final ValueTransformer TO_NEW_FLOAT = new ValueTransformer<>(Type.FLOAT) { @Override - public Float transform(PacketWrapper wrapper, Short inputValue) throws Exception { + public Float transform(PacketWrapper wrapper, Short inputValue) { return inputValue / 16f; } }; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/data/ShoulderTracker.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/data/ShoulderTracker.java index 34ac5d18..ff670b8c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/data/ShoulderTracker.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/data/ShoulderTracker.java @@ -27,6 +27,7 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import com.viaversion.viaversion.util.Key; +import java.util.Locale; public class ShoulderTracker extends StoredObject { private int entityId; @@ -85,7 +86,7 @@ public class ShoulderTracker extends StoredObject { StringBuilder builder = new StringBuilder(); for (String s : array) { - builder.append(s.substring(0, 1).toUpperCase()) + builder.append(s.substring(0, 1).toUpperCase(Locale.ROOT)) .append(s.substring(1)) .append(" "); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java index 52be02b3..a138cee4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/BlockItemPackets1_12.java @@ -220,12 +220,12 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter entry = iterator.next(); - if (entry.getValue() instanceof CompoundTag) { + if (entry.getValue() instanceof CompoundTag tag) { CompoundTag nestedBackupTag = new CompoundTag(); backupTag.put(entry.getKey(), nestedBackupTag); - hasLongArrayTag |= handleNbtToClient((CompoundTag) entry.getValue(), nestedBackupTag); - } else if (entry.getValue() instanceof LongArrayTag) { - backupTag.put(entry.getKey(), fromLongArrayTag((LongArrayTag) entry.getValue())); + hasLongArrayTag |= handleNbtToClient(tag, nestedBackupTag); + } else if (entry.getValue() instanceof LongArrayTag tag) { + backupTag.put(entry.getKey(), fromLongArrayTag(tag)); iterator.remove(); hasLongArrayTag = true; } @@ -239,9 +239,8 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter { - public static final ComponentRewriter COMPONENT_REWRITER = new ComponentRewriter(null, ComponentRewriter.ReadType.JSON) { + public static final ComponentRewriter COMPONENT_REWRITER = new ComponentRewriter<>(null, ComponentRewriter.ReadType.JSON) { @Override public void processText(UserConnection connection, JsonElement element) { super.processText(connection, element); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java index be9c54a4..124c932c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/Protocol1_12_2To1_13.java @@ -54,7 +54,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter(this, ComponentRewriter.ReadType.JSON) { + private final TranslatableRewriter translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON) { @Override protected void handleTranslate(JsonObject root, String translate) { String mappedKey = mappedTranslationKey(translate); @@ -63,7 +63,7 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol translatableToLegacyRewriter = new TranslatableRewriter(this, ComponentRewriter.ReadType.JSON) { + private final TranslatableRewriter translatableToLegacyRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON) { @Override protected void handleTranslate(JsonObject root, String translate) { String mappedKey = mappedTranslationKey(translate); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java index 7e7b48a8..2fc2abd2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java @@ -64,18 +64,11 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back int mappedId = super.getNewBlockStateId(id); // https://github.com/ViaVersion/ViaBackwards/issues/290 - switch (mappedId) { - case 1595: - case 1596: - case 1597: - return 1584; // brown mushroom block - case 1611: - case 1612: - case 1613: - return 1600; // red mushroom block - default: - return mappedId; - } + return switch (mappedId) { + case 1595, 1596, 1597 -> 1584; // brown mushroom block + case 1611, 1612, 1613 -> 1600; // red mushroom block + default -> mappedId; + }; } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/EntityTypeMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/EntityTypeMapping.java index f2ca0854..8d9f31b3 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/EntityTypeMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/EntityTypeMapping.java @@ -20,22 +20,14 @@ package com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.EntityTypeRewriter; -import java.lang.reflect.Field; public class EntityTypeMapping { private static final Int2IntMap TYPES = new Int2IntOpenHashMap(); static { TYPES.defaultReturnValue(-1); - try { - Field field = EntityTypeRewriter.class.getDeclaredField("ENTITY_TYPES"); - field.setAccessible(true); - Int2IntMap entityTypes = (Int2IntMap) field.get(null); - for (Int2IntMap.Entry entry : entityTypes.int2IntEntrySet()) { - EntityTypeMapping.TYPES.put(entry.getIntValue(), entry.getIntKey()); - } - } catch (NoSuchFieldException | IllegalAccessException ex) { - ex.printStackTrace(); + for (Int2IntMap.Entry entry : EntityTypeRewriter.getEntityTypes().int2IntEntrySet()) { + EntityTypeMapping.TYPES.put(entry.getIntValue(), entry.getIntKey()); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/ParticleMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/ParticleMapping.java index ccc69a9b..908f4efc 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/ParticleMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/ParticleMapping.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.type.Type; import java.util.List; +import org.checkerframework.checker.nullness.qual.Nullable; public class ParticleMapping { private static final ParticleData[] particles; @@ -31,7 +32,7 @@ public class ParticleMapping { static { ParticleHandler blockHandler = new ParticleHandler() { @Override - public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception { + public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) { return rewrite(wrapper.read(Type.VAR_INT)); } @@ -63,13 +64,13 @@ public class ParticleMapping { rewrite(4), // (4->4) minecraft:bubble -> bubble rewrite(29), // (5->29) minecraft:cloud -> cloud rewrite(9), // (6->9) minecraft:crit -> crit - rewrite(44), // (7->44) minecraft:damage_indicator -> damageIndicator‌ + rewrite(44), // (7->44) minecraft:damage_indicator -> damageIndicator rewrite(42), // (8->42) minecraft:dragon_breath -> dragonbreath rewrite(19), // (9->19) minecraft:dripping_lava -> dripLava rewrite(18), // (10->18) minecraft:dripping_water -> dripWater rewrite(30, new ParticleHandler() { @Override - public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception { + public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) { float r = wrapper.read(Type.FLOAT); float g = wrapper.read(Type.FLOAT); float b = wrapper.read(Type.FLOAT); @@ -107,7 +108,7 @@ public class ParticleMapping { rewrite(14), // (26->14) minecraft:instant_effect -> instantSpell rewrite(36, new ParticleHandler() { @Override - public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception { + public int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) { return rewrite(protocol, wrapper.read(Type.ITEM1_13)); } @@ -160,7 +161,7 @@ public class ParticleMapping { public interface ParticleHandler { - int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception; + int[] rewrite(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper); int[] rewrite(Protocol1_12_2To1_13 protocol, List> data); @@ -182,12 +183,12 @@ public class ParticleMapping { this(historyId, null); } - public int[] rewriteData(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) throws Exception { + public int @Nullable [] rewriteData(Protocol1_12_2To1_13 protocol, PacketWrapper wrapper) { if (handler == null) return null; return handler.rewrite(protocol, wrapper); } - public int[] rewriteMeta(Protocol1_12_2To1_13 protocol, List> data) { + public int @Nullable [] rewriteMeta(Protocol1_12_2To1_13 protocol, List> data) { if (handler == null) return null; return handler.rewrite(protocol, data); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java index 19d8ac00..3b34d9ad 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java @@ -358,28 +358,13 @@ public class BlockItemPackets1_13 extends BackwardsItemRewriter 9; // end biomes + case 47, 48, 49 -> 24; // deep ocean biomes + case 50 -> 10; // deep frozen... let's just pick the frozen variant + case 44, 45, 46 -> 0; // the other new ocean biomes + default -> -1; + }; if (newId != -1) { chunk.getBiomeData()[i] = newId; @@ -978,7 +963,7 @@ public class BlockItemPackets1_13 extends BackwardsItemRewriter { Optional optionalType = EntityTypes1_13.ObjectType.findById(wrapper.get(Type.BYTE, 0)); - if (!optionalType.isPresent()) return; + if (optionalType.isEmpty()) return; EntityTypes1_13.ObjectType type = optionalType.get(); if (type == EntityTypes1_13.ObjectType.FALLING_BLOCK) { @@ -100,17 +100,12 @@ public class EntityPackets1_13 extends LegacyEntityRewriter 0; + case 4 -> 1; + case 5 -> 3; + default -> data; + }; wrapper.set(Type.INT, 0, data); } else if (type == EntityTypes1_13.ObjectType.TRIDENT) { wrapper.set(Type.BYTE, 0, (byte) EntityTypes1_13.ObjectType.TIPPED_ARROW.getId()); @@ -230,9 +225,9 @@ public class EntityPackets1_13 extends LegacyEntityRewriter { protocol.registerServerbound(ServerboundPackets1_12_1.PLUGIN_MESSAGE, wrapper -> { String channel = wrapper.read(Type.STRING); switch (channel) { - case "MC|BSign": - case "MC|BEdit": + case "MC|BSign", "MC|BEdit" -> { wrapper.setPacketType(ServerboundPackets1_13.EDIT_BOOK); Item book = wrapper.read(Type.ITEM1_8); wrapper.write(Type.ITEM1_13, protocol.getItemRewriter().handleItemToServer(wrapper.user(), book)); boolean signing = channel.equals("MC|BSign"); wrapper.write(Type.BOOLEAN, signing); - break; - case "MC|ItemName": - wrapper.setPacketType(ServerboundPackets1_13.RENAME_ITEM); - break; - case "MC|AdvCmd": + } + case "MC|ItemName" -> wrapper.setPacketType(ServerboundPackets1_13.RENAME_ITEM); + case "MC|AdvCmd" -> { byte type = wrapper.read(Type.BYTE); if (type == 0) { //Information from https://wiki.vg/index.php?title=Plugin_channels&oldid=14089 @@ -406,8 +403,8 @@ public class PlayerPacket1_13 extends RewriterBase { } else { wrapper.cancel(); } - break; - case "MC|AutoCmd": { + } + case "MC|AutoCmd" -> { wrapper.setPacketType(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK); int x = wrapper.read(Type.INT); @@ -430,9 +427,8 @@ public class PlayerPacket1_13 extends RewriterBase { if (wrapper.read(Type.BOOLEAN)) flags |= 0x04; //Automatic wrapper.write(Type.BYTE, flags); - break; } - case "MC|Struct": { + case "MC|Struct" -> { wrapper.setPacketType(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK); int x = wrapper.read(Type.INT); int y = wrapper.read(Type.INT); @@ -471,24 +467,18 @@ public class PlayerPacket1_13 extends RewriterBase { wrapper.passthrough(Type.VAR_LONG); //Seed wrapper.write(Type.BYTE, flags); - break; } - case "MC|Beacon": + case "MC|Beacon" -> { wrapper.setPacketType(ServerboundPackets1_13.SET_BEACON_EFFECT); wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Primary Effect - wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Secondary Effect - - break; - case "MC|TrSel": + } + case "MC|TrSel" -> { wrapper.setPacketType(ServerboundPackets1_13.SELECT_TRADE); wrapper.write(Type.VAR_INT, wrapper.read(Type.INT)); //Slot - - break; - case "MC|PickItem": - wrapper.setPacketType(ServerboundPackets1_13.PICK_ITEM); - break; - default: + } + case "MC|PickItem" -> wrapper.setPacketType(ServerboundPackets1_13.PICK_ITEM); + default -> { String newChannel = InventoryPackets.getNewPluginChannelId(channel); if (newChannel == null) { if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { @@ -514,10 +504,9 @@ public class PlayerPacket1_13 extends RewriterBase { wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8)); } else { wrapper.cancel(); - return; } } - break; + } } }); @@ -535,25 +524,19 @@ public class PlayerPacket1_13 extends RewriterBase { String name = ""; // categories 0-7 (items, blocks, entities) - probably not feasible switch (categoryId) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: + case 0, 1, 2, 3, 4, 5, 6, 7 -> { wrapper.read(Type.VAR_INT); // remove value newSize--; continue; - case 8: + } + case 8 -> { name = protocol.getMappingData().getStatisticMappings().get(statisticId); if (name == null) { wrapper.read(Type.VAR_INT); newSize--; continue; } - break; + } } wrapper.write(Type.STRING, name); // string id diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/providers/BackwardsBlockEntityProvider.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/providers/BackwardsBlockEntityProvider.java index 1daf268d..88bcad0e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/providers/BackwardsBlockEntityProvider.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/providers/BackwardsBlockEntityProvider.java @@ -62,7 +62,7 @@ public class BackwardsBlockEntityProvider implements Provider { * @param position The position of the block entity * @param tag The block entity tag */ - public CompoundTag transform(UserConnection user, Position position, CompoundTag tag) throws Exception { + public CompoundTag transform(UserConnection user, Position position, CompoundTag tag) { final StringTag idTag = tag.getStringTag("id"); if (idTag == null) { return tag; @@ -90,7 +90,7 @@ public class BackwardsBlockEntityProvider implements Provider { * @param position The position of the block entity * @param id The block entity id */ - public CompoundTag transform(UserConnection user, Position position, String id) throws Exception { + public CompoundTag transform(UserConnection user, Position position, String id) { CompoundTag tag = new CompoundTag(); tag.putString("id", id); tag.putInt("x", Math.toIntExact(position.x())); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/data/CommandRewriter1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/data/CommandRewriter1_14.java index d7668192..5685d1c5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/data/CommandRewriter1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/data/CommandRewriter1_14.java @@ -28,9 +28,7 @@ public class CommandRewriter1_14 extends CommandRewriter public CommandRewriter1_14(Protocol1_13_2To1_14 protocol) { super(protocol); - this.parserHandlers.put("minecraft:nbt_tag", wrapper -> { - wrapper.write(Type.VAR_INT, 2); // Greedy phrase - }); + this.parserHandlers.put("minecraft:nbt_tag", wrapper -> wrapper.write(Type.VAR_INT, 2)); // Greedy phrase this.parserHandlers.put("minecraft:time", wrapper -> { wrapper.write(Type.BYTE, (byte) (0x01)); // Flags wrapper.write(Type.INT, 0); // Min value @@ -39,15 +37,12 @@ public class CommandRewriter1_14 extends CommandRewriter @Override public @Nullable String handleArgumentType(String argumentType) { - switch (argumentType) { - case "minecraft:nbt_compound_tag": - return "minecraft:nbt"; - case "minecraft:nbt_tag": - return "brigadier:string"; - case "minecraft:time": - return "brigadier:integer"; - } - return super.handleArgumentType(argumentType); + return switch (argumentType) { + case "minecraft:nbt_compound_tag" -> "minecraft:nbt"; + case "minecraft:nbt_tag" -> "brigadier:string"; + case "minecraft:time" -> "brigadier:integer"; + default -> super.handleArgumentType(argumentType); + }; } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index e5c74466..3d42f10b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -86,50 +86,40 @@ public class BlockItemPackets1_14 extends BackwardsItemRewriter stringType = "minecraft:crafting_table"; + case 9, 20, 13, 14 -> { if (type == 9) containerTitle = "Blast Furnace"; else if (type == 20) containerTitle = "Smoker"; else if (type == 14) containerTitle = "Grindstone"; stringType = "minecraft:furnace"; slotSize = 3; - break; - case 6: + } + case 6 -> { stringType = "minecraft:dropper"; slotSize = 9; - break; - case 12: - stringType = "minecraft:enchanting_table"; - break; - case 10: + } + case 12 -> stringType = "minecraft:enchanting_table"; + case 10 -> { stringType = "minecraft:brewing_stand"; slotSize = 5; - break; - case 18: - stringType = "minecraft:villager"; - break; - case 8: + } + case 18 -> stringType = "minecraft:villager"; + case 8 -> { stringType = "minecraft:beacon"; slotSize = 1; - break; - case 21: //cartography_table - case 7: + } + case 21, 7 -> { if (type == 21) containerTitle = "Cartography Table"; stringType = "minecraft:anvil"; - break; - case 15: + } + case 15 -> { stringType = "minecraft:hopper"; slotSize = 5; - break; - case 19: + } + case 19 -> { stringType = "minecraft:shulker_box"; slotSize = 27; - break; + } } } @@ -266,20 +256,18 @@ public class BlockItemPackets1_14 extends BackwardsItemRewriter { wrapper.read(Type.STRING); // Group wrapper.read(Type.ITEM1_13_2_ARRAY); // Ingredients wrapper.read(Type.ITEM1_13_2); wrapper.read(Type.FLOAT); // EXP wrapper.read(Type.VAR_INT); // Cooking time - break; - case "stonecutting": + } + case "stonecutting" -> { wrapper.read(Type.STRING); // Group? wrapper.read(Type.ITEM1_13_2_ARRAY); // Ingredients wrapper.read(Type.ITEM1_13_2); // Result - break; + } } deleted++; continue; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java index 2a256419..3a231bf6 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java @@ -53,7 +53,7 @@ public class EntityPackets1_14 extends LegacyEntityRewriter 1; + case FURNACE_MINECART -> 2; + case TNT_MINECART -> 3; + case SPAWNER_MINECART -> 4; + case HOPPER_MINECART -> 5; + case COMMAND_BLOCK_MINECART -> 6; + default -> 0; + }; if (data != 0) wrapper.set(Type.INT, 0, data); } else { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java index 53d76e00..5eff4708 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java @@ -61,9 +61,9 @@ public class SoundPackets1_14 extends RewriterBase { float volume = wrapper.read(Type.FLOAT); float pitch = wrapper.read(Type.FLOAT); - int x = (int) (entityStorage.getX() * 8D); - int y = (int) (entityStorage.getY() * 8D); - int z = (int) (entityStorage.getZ() * 8D); + int x = (int) (entityStorage.x() * 8D); + int y = (int) (entityStorage.y() * 8D); + int z = (int) (entityStorage.z() * 8D); PacketWrapper soundPacket = wrapper.create(ClientboundPackets1_13.SOUND); soundPacket.write(Type.VAR_INT, newId); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/storage/ChunkLightStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/storage/ChunkLightStorage.java index 1c49e48d..96b000bb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/storage/ChunkLightStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/storage/ChunkLightStorage.java @@ -71,21 +71,22 @@ public class ChunkLightStorage implements StorableObject { return new HashMap<>(); } - public static class ChunkLight { - private final byte[][] skyLight; - private final byte[][] blockLight; + public record ChunkLight(byte[][] skyLight, byte[][] blockLight) { - public ChunkLight(byte[][] skyLight, byte[][] blockLight) { - this.skyLight = skyLight; - this.blockLight = blockLight; + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + final ChunkLight that = (ChunkLight) o; + if (!Arrays.deepEquals(skyLight, that.skyLight)) return false; + return Arrays.deepEquals(blockLight, that.blockLight); } - public byte[][] skyLight() { - return skyLight; - } - - public byte[][] blockLight() { - return blockLight; + @Override + public int hashCode() { + int result = Arrays.deepHashCode(skyLight); + result = 31 * result + Arrays.deepHashCode(blockLight); + return result; } } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java index 9c7893ad..0e99bd2e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java @@ -76,7 +76,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol(Type.STRING) { + map(Type.STRING, new ValueTransformer<>(Type.STRING) { @Override public String transform(PacketWrapper wrapper, String inputValue) { // 1.13 starts sending slash at start, so we remove it for compatibility diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/data/CommandRewriter1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/data/CommandRewriter1_13_1.java index d86361b7..57b1cc78 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/data/CommandRewriter1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/data/CommandRewriter1_13_1.java @@ -28,9 +28,7 @@ public class CommandRewriter1_13_1 extends CommandRewriter { - wrapper.write(Type.VAR_INT, 0); // Single word - }); + this.parserHandlers.put("minecraft:dimension", wrapper -> wrapper.write(Type.VAR_INT, 0)); // Single word } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/WorldPackets1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/WorldPackets1_13_1.java index cd16eb69..5d773e5d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/WorldPackets1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/packets/WorldPackets1_13_1.java @@ -70,26 +70,17 @@ public class WorldPackets1_13_1 { } else if (id == 2001) { // Block break + block break sound wrapper.set(Type.INT, 1, protocol.getMappingData().getNewBlockStateId(data)); } else if (id == 2000) { // Smoke - switch (data) { - case 0: // Down - case 1: // Up + switch (data) { // Down + case 0, 1 -> { // Up Position pos = wrapper.get(Type.POSITION1_8, 0); BlockFace relative = data == 0 ? BlockFace.BOTTOM : BlockFace.TOP; wrapper.set(Type.POSITION1_8, 0, pos.getRelative(relative)); // Y Offset wrapper.set(Type.INT, 1, 4); // Self - break; - case 2: // North - wrapper.set(Type.INT, 1, 1); // North - break; - case 3: // South - wrapper.set(Type.INT, 1, 7); // South - break; - case 4: // West - wrapper.set(Type.INT, 1, 3); // West - break; - case 5: // East - wrapper.set(Type.INT, 1, 5); // East - break; + } + case 2 -> wrapper.set(Type.INT, 1, 1); // North + case 3 -> wrapper.set(Type.INT, 1, 7); // South + case 4 -> wrapper.set(Type.INT, 1, 3); // West + case 5 -> wrapper.set(Type.INT, 1, 5); // East } } }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/chat/TranslatableRewriter1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/chat/TranslatableRewriter1_16.java index 46ba8d2f..ebe03c05 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/chat/TranslatableRewriter1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/chat/TranslatableRewriter1_16.java @@ -113,7 +113,9 @@ public class TranslatableRewriter1_16 extends TranslatableRewriter heightMapData[i] = v); heightMap.setValue(CompactArrayUtil.createCompactArray(9, heightMapData.length, i -> heightMapData[i])); @@ -188,12 +187,7 @@ public class BlockItemPackets1_16 extends BackwardsItemRewriter chunk.getBiomeData()[i] = 8; } } } @@ -266,19 +260,16 @@ public class BlockItemPackets1_16 extends BackwardsItemRewriter Owner CompoundTag ownerTag = new CompoundTag(); - for (Map.Entry entry : skullOwnerCompoundTag) { + for (Map.Entry entry : skullOwnerTag) { ownerTag.put(entry.getKey(), entry.getValue()); } tag.put("Owner", ownerTag); @@ -349,13 +340,6 @@ public class BlockItemPackets1_16 extends BackwardsItemRewriter { - private final ValueTransformer dimensionTransformer = new ValueTransformer(Type.STRING, Type.INT) { + private final ValueTransformer dimensionTransformer = new ValueTransformer<>(Type.STRING, Type.INT) { @Override public Integer transform(PacketWrapper wrapper, String input) { input = Key.namespaced(input); - switch (input) { - case "minecraft:the_nether": - return -1; - default: - case "minecraft:overworld": - return 0; - case "minecraft:the_end": - return 1; - } + return switch (input) { + case "minecraft:the_nether" -> -1; + case "minecraft:the_end" -> 1; + default -> 0; // Including overworld + }; } }; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java index fba53c97..300905b1 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java @@ -107,7 +107,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol(this).register(ClientboundPackets1_16_2.STATISTICS); } - private static void sendSeenRecipePacket(int recipeType, PacketWrapper wrapper) throws Exception { + private static void sendSeenRecipePacket(int recipeType, PacketWrapper wrapper) { boolean open = wrapper.read(Type.BOOLEAN); boolean filter = wrapper.read(Type.BOOLEAN); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/data/CommandRewriter1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/data/CommandRewriter1_16_2.java index 023d984a..da7fa0b2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/data/CommandRewriter1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/data/CommandRewriter1_16_2.java @@ -28,9 +28,7 @@ public class CommandRewriter1_16_2 extends CommandRewriter { - wrapper.write(Type.VAR_INT, 0); // Single word - }); + this.parserHandlers.put("minecraft:angle", wrapper -> wrapper.write(Type.VAR_INT, 0)); // Single word } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java index 6c5b866d..f088abc2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/BlockItemPackets1_17.java @@ -244,7 +244,7 @@ public final class BlockItemPackets1_17 extends BackwardsItemRewriter light = new ArrayList<>(); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java index f58b9b58..02f5c383 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java @@ -120,10 +120,7 @@ public final class EntityPackets1_17 extends EntityRewriter { - // Dismount vehicle ¯\_(ツ)_/¯ - wrapper.read(Type.BOOLEAN); - }); + read(Type.BOOLEAN); // Dismount vehicle ¯\_(ツ)_/¯ } }); @@ -131,9 +128,7 @@ public final class EntityPackets1_17 extends EntityRewriter { - wrapper.write(Type.INT, wrapper.read(Type.VAR_INT)); // Collection length - }); + handler(wrapper -> wrapper.write(Type.INT, wrapper.read(Type.VAR_INT))); // Collection length } }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java index 47bfa115..537c16fb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java @@ -56,6 +56,7 @@ import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.util.Pair; +import java.security.SignatureException; import java.time.Instant; import java.util.List; import java.util.UUID; @@ -254,7 +255,12 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol> arguments = argumentsProvider.getSignableArguments(command); wrapper.write(Type.VAR_INT, arguments.size()); for (final Pair argument : arguments) { - final byte[] signature = chatSession.signChatMessage(metadata, new DecoratableMessage(argument.value())); + final byte[] signature; + try { + signature = chatSession.signChatMessage(metadata, new DecoratableMessage(argument.value())); + } catch (final SignatureException e) { + throw new RuntimeException(e); + } wrapper.write(Type.STRING, argument.key()); wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature); @@ -266,7 +272,12 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol { - signer.accept(wrapper.user().remove(NonceStorage.class).nonce()); - signer.accept(Longs.toByteArray(salt)); - }); + final byte[] signature; + try { + signature = chatSession.sign(signer -> { + signer.accept(wrapper.user().remove(NonceStorage.class).nonce()); + signer.accept(Longs.toByteArray(salt)); + }); + } catch (final SignatureException e) { + throw new RuntimeException(e); + } wrapper.write(Type.LONG, salt); // Salt wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature); // Signature } else { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/NonceStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/NonceStorage.java index c5e6bc9a..3907af41 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/NonceStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/NonceStorage.java @@ -20,15 +20,6 @@ package com.viaversion.viabackwards.protocol.protocol1_18_2to1_19.storage; import com.viaversion.viaversion.api.connection.StorableObject; import org.checkerframework.checker.nullness.qual.Nullable; -public final class NonceStorage implements StorableObject { +public record NonceStorage(byte @Nullable [] nonce) implements StorableObject { - private final byte[] nonce; - - public NonceStorage(final byte @Nullable [] nonce) { - this.nonce = nonce; - } - - public byte @Nullable [] nonce() { - return nonce; - } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/StoredPainting.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/StoredPainting.java index 184368df..31c277a0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/StoredPainting.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/storage/StoredPainting.java @@ -52,19 +52,13 @@ public final class StoredPainting implements StorableObject { } private byte to2dDirection(int direction) { - switch (direction) { - case 0: - case 1: - return -1; // No worky - case 2: - return 2; - case 3: - return 0; - case 4: - return 1; - case 5: - return 3; - } - throw new IllegalArgumentException("Invalid direction: " + direction); + return switch (direction) { + case 0, 1 -> -1; // No worky + case 2 -> 2; + case 3 -> 0; + case 4 -> 1; + case 5 -> 3; + default -> throw new IllegalArgumentException("Invalid direction: " + direction); + }; } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java index 88118d27..7a27fd06 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java @@ -60,6 +60,7 @@ import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.util.CipherUtil; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.Pair; +import java.security.SignatureException; import java.util.BitSet; import java.util.List; import org.checkerframework.checker.nullness.qual.Nullable; @@ -231,7 +232,12 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol> arguments = argumentsProvider.getSignableArguments(command); wrapper.write(Type.VAR_INT, arguments.size()); for (final Pair argument : arguments) { - final byte[] signature = chatSession.signChatMessage(metadata, argument.value(), new PlayerMessageSignature[0]); + final byte[] signature; + try { + signature = chatSession.signChatMessage(metadata, argument.value(), new PlayerMessageSignature[0]); + } catch (final SignatureException e) { + throw new RuntimeException(e); + } wrapper.write(Type.STRING, argument.key()); wrapper.write(Protocol1_19_1To1_19_3.SIGNATURE_BYTES_TYPE, signature); @@ -350,7 +361,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol holder = wrapper.read(Type.SOUND_EVENT); if (holder.hasId()) { final int mappedId = MAPPINGS.getSoundMappings().getNewId(holder.id()); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/packets/EntityPackets1_19_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/packets/EntityPackets1_19_3.java index 3c5ec128..c60de0e6 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/packets/EntityPackets1_19_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/packets/EntityPackets1_19_3.java @@ -180,15 +180,9 @@ public final class EntityPackets1_19_3 extends EntityRewriter gamemode = wrapper.read(Type.VAR_INT); + case UPDATE_LATENCY -> latency = wrapper.read(Type.VAR_INT); + case UPDATE_DISPLAYNAME -> displayName = wrapper.read(Type.OPTIONAL_COMPONENT); } } @@ -213,7 +207,7 @@ public final class EntityPackets1_19_3 extends EntityRewriter(this) { + new CommandRewriter<>(this) { @Override - public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { + public void handleArgument(final PacketWrapper wrapper, final String argumentType) { switch (argumentType) { case "minecraft:heightmap": wrapper.write(Type.VAR_INT, 0); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/packets/BlockItemPackets1_19_4.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/packets/BlockItemPackets1_19_4.java index db69edb9..515bc764 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/packets/BlockItemPackets1_19_4.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/packets/BlockItemPackets1_19_4.java @@ -75,9 +75,9 @@ public final class BlockItemPackets1_19_4 extends BackwardsItemRewriter recipeRewriter = new RecipeRewriter1_19_3(protocol) { + final RecipeRewriter1_19_3 recipeRewriter = new RecipeRewriter1_19_3<>(protocol) { @Override - public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception { + public void handleCraftingShaped(final PacketWrapper wrapper) { final int ingredients = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT); wrapper.passthrough(Type.STRING); // Group wrapper.passthrough(Type.VAR_INT); // Crafting book category diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/packets/BlockItemPackets1_20.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/packets/BlockItemPackets1_20.java index 9f8d6e6f..23cfcbd5 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/packets/BlockItemPackets1_20.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/packets/BlockItemPackets1_20.java @@ -198,8 +198,7 @@ public final class BlockItemPackets1_20 extends BackwardsItemRewriter> arguments = argumentsProvider.getSignableArguments(command); wrapper.write(Type.VAR_INT, arguments.size()); for (final Pair argument : arguments) { - final byte[] signature = chatSession.signChatMessage(metadata, new DecoratableMessage(argument.value()), messagesStorage.lastSignatures()); + final byte[] signature; + try { + signature = chatSession.signChatMessage(metadata, new DecoratableMessage(argument.value()), messagesStorage.lastSignatures()); + } catch (final SignatureException e) { + throw new RuntimeException(e); + } wrapper.write(Type.STRING, argument.key()); wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19to1_19_1/storage/NonceStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19to1_19_1/storage/NonceStorage.java index b669164b..19ece970 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19to1_19_1/storage/NonceStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19to1_19_1/storage/NonceStorage.java @@ -18,17 +18,6 @@ package com.viaversion.viabackwards.protocol.protocol1_19to1_19_1.storage; import com.viaversion.viaversion.api.connection.StorableObject; -import org.checkerframework.checker.nullness.qual.Nullable; -public final class NonceStorage implements StorableObject { - - private final byte[] nonce; - - public NonceStorage(final byte @Nullable [] nonce) { - this.nonce = nonce; - } - - public byte @Nullable [] nonce() { - return nonce; - } +public record NonceStorage(byte[] nonce) implements StorableObject { } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java index 4a2f30af..99f3be1c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java @@ -83,9 +83,9 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol(this).register(ClientboundPackets1_20_3.STATISTICS); - new CommandRewriter1_19_4(this) { + new CommandRewriter1_19_4<>(this) { @Override - public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { + public void handleArgument(final PacketWrapper wrapper, final String argumentType) { if (argumentType.equals("minecraft:style")) { wrapper.write(Type.VAR_INT, 1); // Phrase } else { @@ -364,13 +364,13 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol(protocol) { + new RecipeRewriter1_20_3<>(protocol) { @Override - public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception { + public void handleCraftingShaped(final PacketWrapper wrapper) { // Move width and height up final String group = wrapper.read(Type.STRING); final int craftingBookCategory = wrapper.read(Type.VAR_INT); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/storage/ResourcepackIDStorage.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/storage/ResourcepackIDStorage.java index 9a01e5e1..0c2ce1dd 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/storage/ResourcepackIDStorage.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/storage/ResourcepackIDStorage.java @@ -20,16 +20,7 @@ package com.viaversion.viabackwards.protocol.protocol1_20_2to1_20_3.storage; import com.viaversion.viaversion.api.connection.StorableObject; import java.util.UUID; -public final class ResourcepackIDStorage implements StorableObject { - private final UUID uuid; - - public ResourcepackIDStorage(final UUID uuid) { - this.uuid = uuid; - } - - public UUID uuid() { - return uuid; - } +public record ResourcepackIDStorage(UUID uuid) implements StorableObject { @Override public boolean clearOnServerSwitch() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java index a5d82bb5..65f24df4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java @@ -151,9 +151,9 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol(this) { + new CommandRewriter1_19_4<>(this) { @Override - public void handleArgument(final PacketWrapper wrapper, final String argumentType) throws Exception { + public void handleArgument(final PacketWrapper wrapper, final String argumentType) { if (argumentType.equals("minecraft:loot_table") || argumentType.equals("minecraft:loot_predicate") || argumentType.equals("minecraft:loot_modifier")) { @@ -182,7 +182,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol 1; + case "magenta" -> 2; + case "light_blue" -> 3; + case "yellow" -> 4; + case "lime" -> 5; + case "pink" -> 6; + case "gray" -> 7; + case "light_gray" -> 8; + case "cyan" -> 9; + case "purple" -> 10; + case "blue" -> 11; + case "brown" -> 12; + case "green" -> 13; + case "red" -> 14; + case "black" -> 15; + default -> 0; + }; } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java index 243ca5f2..144aaeab 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java @@ -35,6 +35,7 @@ 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.exception.CancelException; +import com.viaversion.viaversion.exception.InformativeException; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets; import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets; @@ -170,7 +171,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol(protocol) { + new RecipeRewriter1_20_2<>(protocol) { @Override - public void handleCraftingShapeless(final PacketWrapper wrapper) throws Exception { + public void handleCraftingShapeless(final PacketWrapper wrapper) { wrapper.passthrough(Type.STRING); // Group wrapper.passthrough(Type.VAR_INT); // Crafting book category handleIngredients(wrapper); @@ -299,7 +299,7 @@ public final class BlockItemPacketRewriter1_20_2 extends BackwardsItemRewriter tags, UserConnection connection) throws Exception { + public static void handle(List tags, UserConnection connection) { for (CompoundTag tag : tags) { StringTag idTag = tag.getStringTag("id"); if (idTag == null) { @@ -71,7 +71,7 @@ public class BlockEntity { } } - private static void updateBlockEntity(Position pos, short id, CompoundTag tag, UserConnection connection) throws Exception { + private static void updateBlockEntity(Position pos, short id, CompoundTag tag, UserConnection connection) { PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, null, connection); wrapper.write(Type.POSITION1_8, pos); wrapper.write(Type.UNSIGNED_BYTE, id); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_9_4to1_10/Protocol1_9_4To1_10.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_9_4to1_10/Protocol1_9_4To1_10.java index aa139656..9704986c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_9_4to1_10/Protocol1_9_4To1_10.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_9_4to1_10/Protocol1_9_4To1_10.java @@ -37,8 +37,8 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPac public class Protocol1_9_4To1_10 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.10", "1.9.4"); - private static final ValueTransformer TO_OLD_PITCH = new ValueTransformer(Type.UNSIGNED_BYTE) { - public Short transform(PacketWrapper packetWrapper, Float inputValue) throws Exception { + private static final ValueTransformer TO_OLD_PITCH = new ValueTransformer<>(Type.UNSIGNED_BYTE) { + public Short transform(PacketWrapper packetWrapper, Float inputValue) { return (short) Math.round(inputValue * 63.5F); } }; diff --git a/gradle.properties b/gradle.properties index 14276168..19fb2afc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=4.10.3-SNAPSHOT +projectVersion=5.0.0-SNAPSHOT # Smile emoji mcVersions=1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eb866ce7..e398a0e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ metadata.format.version = "1.1" [versions] # ViaVersion -viaver = "4.10.2-SNAPSHOT" +viaver = "5.0.0-SNAPSHOT" # Common provided netty = "4.0.20.Final" diff --git a/settings.gradle.kts b/settings.gradle.kts index b061c3c9..60990dc1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,7 @@ rootProject.name = "viabackwards-parent" dependencyResolutionManagement { repositories { + mavenLocal() maven("https://repo.viaversion.com") maven("https://repo.papermc.io/repository/maven-public/") maven("https://oss.sonatype.org/content/repositories/snapshots/")