Compare commits

...
37 Commits
Author SHA1 Message Date
Nassim Jahnke 736ba3c53c 5.10.0 Release 2026-06-19 19:17:37 +02:00
Pantera 6d47c5af61 Add limit to debug sample subscription count (#4975) 2026-06-19 19:17:19 +02:00
Nassim Jahnke 2b42e38300 Add infiniburn tags if missing
They are from 1.16, but some servers might not send them and they are required now.
2026-06-16 19:10:22 +02:00
Nassim Jahnke 4260095390 Remove snapshot bit 2026-06-16 08:09:51 +02:00
riku6460 769498661d Add recipe rewriter 2026-06-16 08:08:52 +02:00
Florian Reuth 1c25e5011a Hide player list heads on offline mode servers
Signed-off-by: Florian Reuth <git@florianreuth.de>
2026-06-15 11:50:35 +02:00
Nassim Jahnke bb3de8ef8d Update deps 2026-06-13 12:15:45 +02:00
Nassim Jahnke 770dd485ec 26.2-rc-2 2026-06-12 17:59:11 +02:00
Nassim Jahnke 964a1b2581 26.2-rc-1 2026-06-12 17:20:54 +02:00
Nassim Jahnke bb1a5e745a 26.2-pre-6 2026-06-12 17:20:54 +02:00
Nassim Jahnke a0a31641e3 26.2-pre-5 2026-06-12 17:20:54 +02:00
Nassim Jahnke 4e493f61cd 26.2-pre-4 2026-06-12 17:20:53 +02:00
Nassim Jahnke ae7f1f07d5 26.2-pre-3 2026-06-12 17:20:53 +02:00
Nassim Jahnke be89cb52b3 26.2-pre-2 2026-06-12 17:20:53 +02:00
Nassim Jahnke b63765a970 26.2-pre-1 2026-06-12 17:20:53 +02:00
Nassim Jahnke 2047b42d78 26.2-snapshot-8 2026-06-12 17:20:53 +02:00
Nassim Jahnke a1179887cd 26.2-snapshot-7 2026-06-12 17:20:53 +02:00
Nassim Jahnke b2a3512bbd 26.2-snapshot-6 2026-06-12 17:20:52 +02:00
Nassim Jahnke 2fe81b5b70 26.2-snapshot-5 2026-06-12 17:20:52 +02:00
Nassim Jahnke 1da2fb89c4 26.2-snapshot-4 2026-06-12 17:20:52 +02:00
Nassim Jahnke 53e18c1f8d 26.2-snapshot-3 2026-06-12 17:20:52 +02:00
Nassim Jahnke 9460a65f02 26.2-snapshot-2 2026-06-12 17:20:52 +02:00
Nassim Jahnke 150a516006 26.2-snapshot-1 2026-06-12 17:20:52 +02:00
itslilscorp d05985fdb3 Add effect blending to nausea in 1.21.4->1.21.5 (#4964) 2026-06-09 12:01:03 +02:00
itslilscorp 2bb90d32da Preserve legacy stained glass pane falling dust appearance in 1.12->1.13 (#4955)
Map stained glass pane falling dust particles to the corresponding
stained glass block state when translating from 1.12.2 to 1.13.

Legacy clients render stained glass and stained glass pane falling dust
identically. Modern clients render stained glass pane falling dust with
an incorrect dark tint. Preserve the legacy appearance while leaving
other block-backed particles unchanged.
2026-06-07 12:07:03 +02:00
trassert e59c12cf62 Add the_end clock (#4961) 2026-06-05 19:21:32 +02:00
LeonTG b4d8fe6ba1 Display infinite potion effect duration for 1.19.4+, if it would display infinite on 1.19.2 and below (#4953) 2026-05-31 20:58:12 +02:00
itslilscorp cab919bfaf Fix legacy skull rotation overflow in 1.12.2->1.13 (#4952) 2026-05-31 11:51:49 +02:00
Frederik van der Els 9d9fe03317 Add rewrite for commands.locatebiome.success (#4949) 2026-05-28 18:49:43 +02:00
AmirAli Mollaei 8fd09c8ba4 Fix registry key tracking for adding missing keys (#4946) 2026-05-25 09:34:14 +02:00
Florian Reuth 4802926441 Add missing locate command translation to 1.16->1.17 (#4947) 2026-05-25 08:58:45 +02:00
Nassim Jahnke 5628bcbb83 Fix ponder_goat_horn key 2026-05-23 21:56:37 +02:00
Florian Reuth 33062af729 Fix blocks attacks bypassed_by hashing (#4942) 2026-05-21 20:02:56 +02:00
RK_01 f32dca9b56 Make OptionalType non-abstract (#4939)
This allows it to be used like ArrayType without having to create new classes
2026-05-15 18:53:52 +02:00
Nassim Jahnke a09fa97f42 Send new entries for fully missing registries 2026-05-09 10:04:26 +02:00
Nassim Jahnke 08100010c7 Track gamemode in 1.20.5+ already 2026-05-08 18:55:50 +02:00
Nassim Jahnke 9a8a01b753 Make config limits configurable via system properties 2026-05-08 18:24:17 +02:00
71 changed files with 1179 additions and 164 deletions

No files matched your search

+2
View File
@@ -6,9 +6,11 @@ updates:
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
cooldown:
default-days: 7
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
+2 -2
View File
@@ -11,11 +11,11 @@ jobs:
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
cache-disabled: false
cache-provider: basic
+2 -2
View File
@@ -16,11 +16,11 @@ jobs:
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
cache-disabled: false
cache-provider: basic
@@ -104,7 +104,7 @@ public class MappingDataLoader {
throw new IllegalArgumentException("Unknown global identifier key: " + registry);
}
if (globalId < 0 || globalId >= array.length) {
throw new IllegalArgumentException("Unknown global identifier index: " + globalId);
throw new IllegalArgumentException("Unknown global identifier index: " + registry + "/" + globalId);
}
return array[globalId];
}
@@ -262,6 +262,13 @@ public class MappingDataLoader {
// Assign the changed value
addConsumer.addTo(mappings, changedId, values[i]);
}
// Fill the remainder
if (fillBetween && nextUnhandledId != size) {
for (int id = nextUnhandledId; id < size; id++) {
addConsumer.addTo(mappings, id, id);
}
}
} else if (strategy == IDENTITY_ID) {
final IntTag sizeTag = tag.getIntTag("size");
return new IdentityMappings(sizeTag.asInt(), mappedSize);
@@ -315,6 +322,10 @@ public class MappingDataLoader {
continue;
}
if (mappedGlobalId == -1) {
throw new IllegalArgumentException("Mapped global id -1 for unmapped global id: " + key + "/" + unmappedIdentifier + " (" + unmappedGlobalId + ")");
}
identity = false;
unmappedIdentifiers.add(unmappedIdentifier);
mappedIdentifiers.add(identifierFromGlobalId(key, mappedGlobalId));
@@ -24,6 +24,7 @@ package com.viaversion.viaversion.api.data.entity;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.util.KeyMappings;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -210,4 +211,8 @@ public interface EntityTracker {
@Nullable DimensionData dimensionData(int dimensionId);
void setDimensions(Map<String, DimensionData> dimensions);
@Nullable KeyMappings registryKeys(String registryKey);
void addRegistryKeys(String registryKey, KeyMappings mappings);
}
@@ -22,6 +22,7 @@
*/
package com.viaversion.viaversion.api.minecraft.codec;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.protocol.Protocol;
@@ -35,8 +36,12 @@ public interface CodecContext {
boolean isSupported(StructuredDataKey<?> key);
UserConnection connection();
interface RegistryAccess {
UserConnection connection();
Key item(int id);
Key attributeModifier(int id);
@@ -67,8 +72,8 @@ public interface CodecContext {
*/
int id(MappingData.MappingType mappingType, String identifier);
static RegistryAccess of(final Protocol<?, ?, ?, ?> protocol) {
return new RegistryAccessImpl(protocol);
static RegistryAccess of(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection) {
return new RegistryAccessImpl(protocol, connection);
}
/**
@@ -23,31 +23,40 @@
package com.viaversion.viaversion.api.minecraft.codec;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.FullMappings;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.rewriter.RegistryDataRewriter;
import com.viaversion.viaversion.util.Key;
import com.viaversion.viaversion.util.KeyMappings;
import org.checkerframework.checker.nullness.qual.Nullable;
final class RegistryAccessImpl implements CodecContext.RegistryAccess {
private final RegistryDataRewriter registryDataRewriter;
private final EntityTracker entityTracker;
private final MappingData mappingData;
private final UserConnection connection;
private final boolean mapped;
RegistryAccessImpl(final Protocol<?, ?, ?, ?> protocol) {
this.mappingData = protocol.getMappingData();
this.registryDataRewriter = protocol.getRegistryDataRewriter();
RegistryAccessImpl(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection) {
this.mappingData = Preconditions.checkNotNull(protocol.getMappingData());
this.entityTracker = Preconditions.checkNotNull(protocol.getEntityRewriter().tracker(connection));
this.connection = connection;
this.mapped = false;
}
private RegistryAccessImpl(final MappingData mappingData, final RegistryDataRewriter registryDataRewriter, final boolean mapped) {
private RegistryAccessImpl(final MappingData mappingData, final UserConnection connection, final EntityTracker entityTracker, final boolean mapped) {
this.mappingData = mappingData;
this.registryDataRewriter = registryDataRewriter;
this.connection = connection;
this.entityTracker = entityTracker;
this.mapped = mapped;
}
@Override
public UserConnection connection() {
return connection;
}
@Override
public Key item(final int id) {
return key(mappingData.getFullItemMappings(), id);
@@ -91,8 +100,8 @@ final class RegistryAccessImpl implements CodecContext.RegistryAccess {
@Override
public Key registryKey(final String registry, final int id) {
final KeyMappings mappings = registryDataRewriter.getMappings(registry);
Preconditions.checkNotNull(mappings, "No registry mappings for registry: " + registry);
final KeyMappings mappings = entityTracker.registryKeys(registry);
Preconditions.checkNotNull(mappings, "No registry mappings for registry: %s", registry);
final String identifier = id >= 0 && id < mappings.size() ? mappings.idToKey(id) : null;
return key(identifier, id);
}
@@ -108,6 +117,6 @@ final class RegistryAccessImpl implements CodecContext.RegistryAccess {
@Override
public CodecContext.RegistryAccess withMapped(final boolean mapped) {
return this.mapped == mapped ? this : new RegistryAccessImpl(this.mappingData, this.registryDataRewriter, mapped);
return this.mapped == mapped ? this : new RegistryAccessImpl(this.mappingData, this.connection, this.entityTracker, mapped);
}
}
@@ -35,6 +35,7 @@ import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_11;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_2;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_5;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.item.data.AdventureModePredicate;
import com.viaversion.viaversion.api.minecraft.item.data.ArmorTrim;
import com.viaversion.viaversion.api.minecraft.item.data.ArmorTrimMaterial;
@@ -34,7 +34,7 @@ public class StructuredDataKeys1_20_5 extends VersionedStructuredDataKeys {
public StructuredDataKeys1_20_5(final VersionedTypesHolder types) {
this.container = add("container", types.itemArray());
this.chargedProjectiles = add("charged_projectiles", types.itemArray());
this.bundleContents = add("bundle_contents", types.itemArray());
this.chargedProjectiles = add("charged_projectiles", types.itemArray().withMaxLength(1024));
this.bundleContents = add("bundle_contents", types.itemArray().withMaxLength(1024));
}
}
@@ -36,8 +36,8 @@ public class StructuredDataKeys1_21_2 extends VersionedStructuredDataKeys {
public StructuredDataKeys1_21_2(final VersionedTypesHolder types) {
this.container = add("container", new ContainerContentsType(types.optionalItemTemplate()));
this.chargedProjectiles = add("charged_projectiles", types.itemTemplateArray());
this.bundleContents = add("bundle_contents", types.itemTemplateArray());
this.chargedProjectiles = add("charged_projectiles", types.itemTemplateArray().withMaxLength(1024));
this.bundleContents = add("bundle_contents", types.itemTemplateArray().withMaxLength(1024));
this.useRemainder = add("use_remainder", types.itemTemplate());
}
}
@@ -0,0 +1,37 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft.data.version;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.type.types.version.VersionedTypesHolder;
public class StructuredDataKeys26_2 extends StructuredDataKeys1_21_11 {
public final StructuredDataKey<Item> sulfurCubeContent;
public StructuredDataKeys26_2(final VersionedTypesHolder types) {
super(types);
this.sulfurCubeContent = add("sulfur_cube_content", types.item());
}
}
@@ -0,0 +1,332 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.viaversion.viaversion.api.minecraft.entities;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.util.EntityTypeUtil;
import com.viaversion.viaversion.util.Key;
import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable;
public enum EntityTypes26_2 implements EntityType {
ENTITY(null, null),
AREA_EFFECT_CLOUD(ENTITY),
END_CRYSTAL(ENTITY),
EVOKER_FANGS(ENTITY),
EXPERIENCE_ORB(ENTITY),
EYE_OF_ENDER(ENTITY),
FALLING_BLOCK(ENTITY),
ITEM(ENTITY),
TNT(ENTITY),
OMINOUS_ITEM_SPAWNER(ENTITY),
MARKER(ENTITY),
LIGHTNING_BOLT(ENTITY),
INTERACTION(ENTITY),
DISPLAY(ENTITY, null),
BLOCK_DISPLAY(DISPLAY),
ITEM_DISPLAY(DISPLAY),
TEXT_DISPLAY(DISPLAY),
// Hanging entities
HANGING_ENTITY(ENTITY, null),
LEASH_KNOT(HANGING_ENTITY),
PAINTING(HANGING_ENTITY),
ITEM_FRAME(HANGING_ENTITY),
GLOW_ITEM_FRAME(ITEM_FRAME),
// Projectiles
PROJECTILE(ENTITY, null),
ITEM_PROJECTILE(PROJECTILE, null),
SNOWBALL(ITEM_PROJECTILE),
ENDER_PEARL(ITEM_PROJECTILE),
EGG(ITEM_PROJECTILE),
EXPERIENCE_BOTTLE(ITEM_PROJECTILE),
FIREWORK_ROCKET(PROJECTILE),
LLAMA_SPIT(PROJECTILE),
SHULKER_BULLET(PROJECTILE),
FISHING_BOBBER(PROJECTILE),
WITHER_SKULL(PROJECTILE),
DRAGON_FIREBALL(PROJECTILE), // Doesn't actually inherit fireball
ABSTRACT_THROWN_POTION(ITEM_PROJECTILE, null),
SPLASH_POTION(ABSTRACT_THROWN_POTION),
LINGERING_POTION(ABSTRACT_THROWN_POTION),
ABSTRACT_ARROW(PROJECTILE, null),
ARROW(ABSTRACT_ARROW),
SPECTRAL_ARROW(ABSTRACT_ARROW),
TRIDENT(ABSTRACT_ARROW),
ABSTRACT_FIREBALL(ENTITY, null),
FIREBALL(ABSTRACT_FIREBALL),
SMALL_FIREBALL(ABSTRACT_FIREBALL),
ABSTRACT_WIND_CHARGE(PROJECTILE, null),
WIND_CHARGE(ABSTRACT_WIND_CHARGE),
BREEZE_WIND_CHARGE(ABSTRACT_WIND_CHARGE),
// Vehicles
VEHICLE(ENTITY, null),
ABSTRACT_MINECART(VEHICLE, null),
MINECART(ABSTRACT_MINECART),
FURNACE_MINECART(ABSTRACT_MINECART),
COMMAND_BLOCK_MINECART(ABSTRACT_MINECART),
TNT_MINECART(ABSTRACT_MINECART),
SPAWNER_MINECART(ABSTRACT_MINECART),
ABSTRACT_MINECART_CONTAINER(ABSTRACT_MINECART, null),
CHEST_MINECART(ABSTRACT_MINECART_CONTAINER),
HOPPER_MINECART(ABSTRACT_MINECART_CONTAINER),
ABSTRACT_BOAT(VEHICLE, null),
ABSTRACT_CHEST_BOAT(ABSTRACT_BOAT, null),
ACACIA_BOAT(ABSTRACT_BOAT),
ACACIA_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
BAMBOO_CHEST_RAFT(ABSTRACT_CHEST_BOAT),
BAMBOO_RAFT(ABSTRACT_BOAT),
BIRCH_BOAT(ABSTRACT_BOAT),
BIRCH_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
CHERRY_BOAT(ABSTRACT_BOAT),
CHERRY_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
DARK_OAK_BOAT(ABSTRACT_BOAT),
DARK_OAK_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
JUNGLE_BOAT(ABSTRACT_BOAT),
JUNGLE_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
MANGROVE_BOAT(ABSTRACT_BOAT),
MANGROVE_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
OAK_BOAT(ABSTRACT_BOAT),
OAK_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
PALE_OAK_BOAT(ABSTRACT_BOAT),
PALE_OAK_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
SPRUCE_BOAT(ABSTRACT_BOAT),
SPRUCE_CHEST_BOAT(ABSTRACT_CHEST_BOAT),
// Living entities as a larger subclass
LIVING_ENTITY(ENTITY, null),
ARMOR_STAND(LIVING_ENTITY),
// Players
AVATAR(LIVING_ENTITY, null),
MANNEQUIN(AVATAR),
PLAYER(AVATAR),
// Mobs as a larger subclass
MOB(LIVING_ENTITY, null),
ENDER_DRAGON(MOB),
// Ambient mobs
AMBIENT_CREATURE(MOB, null),
BAT(AMBIENT_CREATURE),
// Flying mobs
FLYING_MOB(MOB, null),
GHAST(FLYING_MOB),
PHANTOM(FLYING_MOB),
// Pathfinder mobs and its subclasses
PATHFINDER_MOB(MOB, null),
ALLAY(PATHFINDER_MOB),
ABSTRACT_GOLEM(PATHFINDER_MOB, null),
SNOW_GOLEM(ABSTRACT_GOLEM),
IRON_GOLEM(ABSTRACT_GOLEM),
SHULKER(ABSTRACT_GOLEM),
COPPER_GOLEM(ABSTRACT_GOLEM),
// Ageable mobs and (tamable) animals
ABSTRACT_AGEABLE(PATHFINDER_MOB, null),
ABSTRACT_VILLAGER(ABSTRACT_AGEABLE, null),
VILLAGER(ABSTRACT_VILLAGER),
WANDERING_TRADER(ABSTRACT_VILLAGER),
ABSTRACT_CUBE_MOB(ABSTRACT_AGEABLE, null),
SLIME(ABSTRACT_CUBE_MOB),
MAGMA_CUBE(ABSTRACT_CUBE_MOB),
SULFUR_CUBE(ABSTRACT_CUBE_MOB),
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
AXOLOTL(ABSTRACT_ANIMAL),
CHICKEN(ABSTRACT_ANIMAL),
PANDA(ABSTRACT_ANIMAL),
PIG(ABSTRACT_ANIMAL),
POLAR_BEAR(ABSTRACT_ANIMAL),
RABBIT(ABSTRACT_ANIMAL),
SHEEP(ABSTRACT_ANIMAL),
BEE(ABSTRACT_ANIMAL),
TURTLE(ABSTRACT_ANIMAL),
FOX(ABSTRACT_ANIMAL),
FROG(ABSTRACT_ANIMAL),
GOAT(ABSTRACT_ANIMAL),
HOGLIN(ABSTRACT_ANIMAL),
STRIDER(ABSTRACT_ANIMAL),
SNIFFER(ABSTRACT_ANIMAL),
ARMADILLO(ABSTRACT_ANIMAL),
HAPPY_GHAST(ABSTRACT_ANIMAL),
OCELOT(ABSTRACT_ANIMAL),
ABSTRACT_COW(ABSTRACT_ANIMAL, null),
COW(ABSTRACT_COW),
MOOSHROOM(ABSTRACT_COW),
TAMABLE_ANIMAL(ABSTRACT_ANIMAL, null),
CAT(TAMABLE_ANIMAL),
WOLF(TAMABLE_ANIMAL),
PARROT(TAMABLE_ANIMAL),
ABSTRACT_NAUTILUS(TAMABLE_ANIMAL, null),
NAUTILUS(ABSTRACT_NAUTILUS),
ZOMBIE_NAUTILUS(ABSTRACT_NAUTILUS),
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
HORSE(ABSTRACT_HORSE),
SKELETON_HORSE(ABSTRACT_HORSE),
ZOMBIE_HORSE(ABSTRACT_HORSE),
CAMEL(ABSTRACT_HORSE),
CAMEL_HUSK(CAMEL),
ABSTRACT_CHESTED_HORSE(ABSTRACT_HORSE, null),
DONKEY(ABSTRACT_CHESTED_HORSE),
MULE(ABSTRACT_CHESTED_HORSE),
LLAMA(ABSTRACT_CHESTED_HORSE),
TRADER_LLAMA(LLAMA),
// Monsters
ABSTRACT_MONSTER(PATHFINDER_MOB, null),
BLAZE(ABSTRACT_MONSTER),
CREEPER(ABSTRACT_MONSTER),
ENDERMITE(ABSTRACT_MONSTER),
ENDERMAN(ABSTRACT_MONSTER),
GIANT(ABSTRACT_MONSTER),
SILVERFISH(ABSTRACT_MONSTER),
VEX(ABSTRACT_MONSTER),
WITHER(ABSTRACT_MONSTER),
BREEZE(ABSTRACT_MONSTER),
ZOGLIN(ABSTRACT_MONSTER),
WARDEN(ABSTRACT_MONSTER),
CREAKING(ABSTRACT_MONSTER),
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
SKELETON(ABSTRACT_SKELETON),
STRAY(ABSTRACT_SKELETON),
WITHER_SKELETON(ABSTRACT_SKELETON),
BOGGED(ABSTRACT_SKELETON),
PARCHED(ABSTRACT_SKELETON),
ZOMBIE(ABSTRACT_MONSTER),
DROWNED(ZOMBIE),
HUSK(ZOMBIE),
ZOMBIFIED_PIGLIN(ZOMBIE),
ZOMBIE_VILLAGER(ZOMBIE),
GUARDIAN(ABSTRACT_MONSTER),
ELDER_GUARDIAN(GUARDIAN),
SPIDER(ABSTRACT_MONSTER),
CAVE_SPIDER(SPIDER),
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
PIGLIN(ABSTRACT_PIGLIN),
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
// Water mobs
AGEABLE_WATER_CREATURE(ABSTRACT_AGEABLE, null),
DOLPHIN(AGEABLE_WATER_CREATURE),
SQUID(AGEABLE_WATER_CREATURE),
GLOW_SQUID(SQUID),
WATER_ANIMAL(PATHFINDER_MOB, null),
ABSTRACT_FISH(WATER_ANIMAL, null),
PUFFERFISH(ABSTRACT_FISH),
TADPOLE(ABSTRACT_FISH),
ABSTRACT_SCHOOLING_FISH(ABSTRACT_FISH, null),
COD(ABSTRACT_SCHOOLING_FISH),
SALMON(ABSTRACT_SCHOOLING_FISH),
TROPICAL_FISH(ABSTRACT_SCHOOLING_FISH),
// Raiders
ABSTRACT_RAIDER(ABSTRACT_MONSTER, null),
WITCH(ABSTRACT_RAIDER),
RAVAGER(ABSTRACT_RAIDER),
ABSTRACT_ILLAGER(ABSTRACT_RAIDER, null),
SPELLCASTER_ILLAGER(ABSTRACT_ILLAGER, null),
VINDICATOR(ABSTRACT_ILLAGER),
PILLAGER(ABSTRACT_ILLAGER),
EVOKER(SPELLCASTER_ILLAGER),
ILLUSIONER(SPELLCASTER_ILLAGER);
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent;
private final String identifier;
private int id = -1;
EntityTypes26_2(final EntityType parent) {
this.parent = parent;
this.identifier = Key.namespaced(name().toLowerCase(Locale.ROOT));
}
EntityTypes26_2(final EntityType parent, @Nullable final String identifier) {
this.parent = parent;
this.identifier = identifier;
}
@Override
public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id;
}
@Override
public String identifier() {
Preconditions.checkArgument(identifier != null, "Called identifier method on abstract type");
return identifier;
}
@Override
public @Nullable EntityType getParent() {
return parent;
}
@Override
public boolean isAbstractType() {
return identifier == null;
}
public static EntityType getTypeFromId(final int typeId) {
return EntityTypeUtil.getTypeFromId(TYPES, typeId, PIG);
}
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
}
}
@@ -122,7 +122,7 @@ public record BlocksAttacks(
.writeOptional("disable_cooldown_scale", Types.FLOAT, value.disableCooldownScale(), 1F)
.writeOptional("damage_reductions", DamageReduction.ARRAY_TYPE, value.damageReductions(), defaultDamageReductions)
.writeOptional("item_damage", ItemDamageFunction.TYPE, value.itemDamage(), defaultItemDamage)
.writeOptional("bypassed_by", Types.HOLDER_SET, value.bypassedBy())
.writeOptional("bypassed_by", new HolderSetType(RegistryKey.of("damage_type")), value.bypassedBy())
.writeOptional("block_sound", Types.SOUND_EVENT, value.blockSound())
.writeOptional("disabled_sound", Types.SOUND_EVENT, value.disableSound()));
}
@@ -74,6 +74,11 @@ public interface PacketTypesProvider<CU extends ClientboundPacketType, CM extend
return map != null ? map.typeByName(typeName) : null;
}
default @Nullable CM mappedClientboundType(final State state, final String typeName) {
PacketTypeMap<CM> map = mappedClientboundPacketTypes().get(state);
return map != null ? map.typeByName(typeName) : null;
}
default @Nullable SU unmappedServerboundType(final State state, final String typeName) {
PacketTypeMap<SU> map = unmappedServerboundPacketTypes().get(state);
return map != null ? map.typeByName(typeName) : null;
@@ -94,6 +94,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
public static final ProtocolVersion v1_21_9 = register(773, "1.21.9-1.21.10", new SubVersionRange("1.21", 9, 10));
public static final ProtocolVersion v1_21_11 = register(774, "1.21.11");
public static final ProtocolVersion v26_1 = register(775, "26.1-26.1.2", new SubVersionRange("26.1", 0, 2));
public static final ProtocolVersion v26_2 = register(776, "26.2");
public static final ProtocolVersion unknown = new ProtocolVersion(VersionType.SPECIAL, -1, -1, "UNKNOWN", null);
static {
@@ -25,19 +25,22 @@ package com.viaversion.viaversion.api.rewriter;
import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.util.KeyMappings;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface RegistryDataRewriter {
void handle(PacketWrapper wrapper);
@Nullable
KeyMappings getMappings(String registryKey);
boolean shouldRemoveRegistry(String registryKey);
boolean hasRegistriesToRemove();
void updateDialog(UserConnection connection, CompoundTag tag);
/**
* Sends registries that had additional entries configured, but weren't sent by the server at all
* by the time finish_configuration was sent to the client.
*
* @param connection the user connection
*/
void sendMissingRegistries(final UserConnection connection);
}
@@ -26,10 +26,10 @@ import com.viaversion.viaversion.api.minecraft.codec.Ops;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
public abstract class OptionalType<T> extends Type<T> {
public class OptionalType<T> extends Type<T> {
private final Type<T> type;
protected OptionalType(final Type<T> type) {
public OptionalType(final Type<T> type) {
super(type.getOutputClass());
this.type = type;
}
@@ -179,7 +179,8 @@ public final class Types {
public static final Type<UUID[]> UUID_ARRAY = new ArrayType<>(Types.UUID);
public static final VarIntType VAR_INT = new VarIntType();
public static final OptionalVarIntType OPTIONAL_VAR_INT = new OptionalVarIntType();
public static final OptionalVarIntType OPTIONAL_VAR_INT = new OptionalVarIntType(); // compact
public static final OptionalType<Integer> BOOL_OPTIONAL_VAR_INT = new VarIntType.OptionalVarIntType(); // regular boolean prefixed
public static final Type<int[]> VAR_INT_ARRAY_PRIMITIVE = new VarIntArrayType();
public static final VarLongType VAR_LONG = new VarLongType();
@@ -45,6 +45,12 @@ public class ArrayType<T> extends Type<T[]> {
this.maxLength = maxLength;
}
private ArrayType(Class<? super T[]> outputClass, Type<T> type, int maxLength) {
super(type.getTypeName() + " Array", outputClass);
this.elementType = type;
this.maxLength = maxLength;
}
public static Class<?> getArrayClass(Class<?> componentType) {
// Should only happen once per class init.
return Array.newInstance(componentType, 0).getClass();
@@ -101,4 +107,8 @@ public class ArrayType<T> extends Type<T[]> {
}
});
}
public ArrayType<T> withMaxLength(final int maxLength) {
return new ArrayType<>(this.getOutputClass(), this.elementType, maxLength);
}
}
@@ -23,6 +23,7 @@
package com.viaversion.viaversion.api.type.types;
import com.viaversion.viaversion.api.minecraft.codec.Ops;
import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.TypeConverter;
import com.viaversion.viaversion.api.type.Types;
@@ -108,4 +109,11 @@ public class VarIntType extends Type<Integer> implements TypeConverter<Integer>
public static int varIntLength(final int value) {
return VAR_INT_LENGTHS[Integer.numberOfLeadingZeros(value)];
}
public static final class OptionalVarIntType extends OptionalType<Integer> {
public OptionalVarIntType() {
super(Types.VAR_INT);
}
}
}
@@ -163,6 +163,13 @@ public class ParticleType extends DynamicType<Particle> {
particle.add(Types.INT, Types.INT.readPrimitive(buf)); // Color
particle.add(Types.FLOAT, Types.FLOAT.readPrimitive(buf)); // Power
};
public static final DataReader<Particle> GEYSER_BASE = (buf, particle) -> {
particle.add(Types.INT, Types.INT.readPrimitive(buf)); // Water blocks
particle.add(Types.FLOAT, Types.FLOAT.readPrimitive(buf)); // Burst impulse base
};
public static final DataReader<Particle> GEYSER = (buf, particle) -> {
particle.add(Types.INT, Types.INT.readPrimitive(buf)); // Water blocks
};
public static DataReader<Particle> item(Type<Item> item) {
return (buf, particle) -> particle.add(item, item.read(buf));
@@ -259,12 +266,20 @@ public class ParticleType extends DynamicType<Particle> {
return fill1_21_4(protocol).reader("tinted_leaves", Readers.COLOR);
}
public static void fill1_21_9(final Protocol<?, ?, ?, ?> protocol) {
fill1_21_5(protocol)
public static DataFiller fill1_21_9(final Protocol<?, ?, ?, ?> protocol) {
return fill1_21_5(protocol)
.reader("dragon_breath", Readers.POWER)
.reader("effect", Readers.SPELL)
.reader("instant_effect", Readers.SPELL)
.reader("flash", Readers.COLOR);
}
public static void fill26_2(final Protocol<?, ?, ?, ?> protocol) {
fill1_21_9(protocol)
.reader("geyser", Readers.GEYSER)
.reader("geyser_base", Readers.GEYSER_BASE)
.reader("geyser_poof", Readers.GEYSER_BASE)
.reader("geyser_plume", Readers.GEYSER);
}
}
}
@@ -47,7 +47,7 @@ public class Types1_20_5<K extends VersionedStructuredDataKeys, E extends Abstra
public final Type<StructuredData<?>[]> structuredDataArray = new ArrayType<>(structuredData);
public final Type<Item> item = new ItemType1_20_5(structuredData);
public final Type<Item> lengthPrefixedItem = new ItemType1_20_5(lengthPrefixedStructuredData);
public final Type<Item[]> itemArray = new ArrayType<>(item);
public final ArrayType<Item> itemArray = new ArrayType<>(item);
public final Type<Item> itemCost = new ItemCostType1_20_5(structuredDataArray);
public final Type<Item> optionalItemCost = new ItemCostType1_20_5.OptionalItemCostType(itemCost);
private K structuredDataKeys;
@@ -77,7 +77,7 @@ public class Types1_20_5<K extends VersionedStructuredDataKeys, E extends Abstra
}
@Override
public Type<Item[]> itemArray() {
public ArrayType<Item> itemArray() {
return itemArray;
}
@@ -92,7 +92,7 @@ public class Types1_20_5<K extends VersionedStructuredDataKeys, E extends Abstra
}
@Override
public Type<Item[]> itemTemplateArray() {
public ArrayType<Item> itemTemplateArray() {
return itemArray;
}
@@ -34,7 +34,7 @@ public class Types26_1<K extends VersionedStructuredDataKeys, E extends Abstract
public final Type<Item> itemTemplate = new ItemTemplateType26_1(structuredData);
public final Type<Item> optionalItemTemplate = new ItemTemplateType26_1.OptionalItemTemplateType(itemTemplate);
public final Type<Item[]> itemTemplateArray = new ArrayType<>(itemTemplate);
public final ArrayType<Item> itemTemplateArray = new ArrayType<>(itemTemplate);
public Types26_1(final Function<VersionedTypesHolder, K> keysSupplier, final Function<VersionedTypesHolder, E> entityDataTypesSupplier) {
super(null, entityDataTypesSupplier);
@@ -52,7 +52,7 @@ public class Types26_1<K extends VersionedStructuredDataKeys, E extends Abstract
}
@Override
public Type<Item[]> itemTemplateArray() {
public ArrayType<Item> itemTemplateArray() {
return itemTemplateArray;
}
}
@@ -26,6 +26,7 @@ import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_11;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_2;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_5;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys26_2;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_20_5;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_21;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_21_11;
@@ -51,4 +52,5 @@ public final class VersionedTypes {
public static final Types1_20_5<StructuredDataKeys1_21_5, EntityDataTypes1_21_9> V1_21_9 = new Types1_20_5<>(StructuredDataKeys1_21_5::new, EntityDataTypes1_21_9::new);
public static final Types1_20_5<StructuredDataKeys1_21_11, EntityDataTypes1_21_11> V1_21_11 = new Types1_20_5<>(StructuredDataKeys1_21_11::new, EntityDataTypes1_21_11::new);
public static final Types26_1<StructuredDataKeys1_21_11, EntityDataTypes26_1> V26_1 = new Types26_1<>(StructuredDataKeys1_21_11::new, EntityDataTypes26_1::new);
public static final Types26_1<StructuredDataKeys26_2, EntityDataTypes26_1> V26_2 = new Types26_1<>(StructuredDataKeys26_2::new, EntityDataTypes26_1::new);
}
@@ -46,7 +46,7 @@ public interface VersionedTypesHolder {
*/
Type<Item> item();
Type<Item[]> itemArray();
ArrayType<Item> itemArray();
/**
* Returns the unmapped item stack template type, used for certain recipes/templates in 26.1+.
@@ -57,7 +57,7 @@ public interface VersionedTypesHolder {
Type<Item> optionalItemTemplate();
Type<Item[]> itemTemplateArray();
ArrayType<Item> itemTemplateArray();
/**
* Returns the unmapped item cost type, used in merchant offers.
+1 -1
View File
@@ -8,7 +8,7 @@ repositories {
dependencies {
// version must be manually kept in sync with the one in root project settings.gradle.kts
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.4.1")
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.4.2")
// A nice no-conflict comment for patching in downgrading
}
@@ -17,6 +17,7 @@
*/
package com.viaversion.viaversion.codec;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.codec.CodecContext;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.protocol.Protocol;
@@ -48,4 +49,9 @@ public record CodecRegistryContext(Protocol<?, ?, ?, ?> protocol, RegistryAccess
final VersionedTypesHolder types = mapped ? protocol.mappedTypes() : protocol.types();
return (NOT_IMPLEMENTED.isEmpty() || !NOT_IMPLEMENTED.contains(key)) && types.structuredDataKeys().supportsOps(key);
}
@Override
public UserConnection connection() {
return registryAccess.connection();
}
}
@@ -27,14 +27,17 @@ import com.viaversion.viaversion.api.data.entity.StoredEntityData;
import com.viaversion.viaversion.api.data.entity.TrackedEntity;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.util.Key;
import com.viaversion.viaversion.util.KeyMappings;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.Nullable;
public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeListener {
protected final Int2ObjectMap<TrackedEntity> entities = new Int2ObjectOpenHashMap<>();
private final Map<String, KeyMappings> registryKeyMappings = new HashMap<>();
private final UserConnection connection;
private final EntityType playerType;
private Integer clientEntityId;
@@ -115,6 +118,7 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
}
clientEntityId = null;
registryKeyMappings.clear();
}
@Override
@@ -222,4 +226,14 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
public void setDimensions(Map<String, DimensionData> dimensions) {
this.dimensions = dimensions;
}
@Override
public @Nullable KeyMappings registryKeys(String registryKey) {
return registryKeyMappings.get(Key.stripMinecraftNamespace(registryKey));
}
@Override
public void addRegistryKeys(String registryKey, KeyMappings mappings) {
registryKeyMappings.put(Key.stripMinecraftNamespace(registryKey), mappings);
}
}
@@ -47,7 +47,7 @@ public class ItemHasherBase implements ItemHasher {
private final CodecContext mappedContext;
public ItemHasherBase(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection) {
final RegistryAccess registryAccess = RegistryAccess.of(protocol);
final RegistryAccess registryAccess = RegistryAccess.of(protocol, connection);
this.context = new CodecRegistryContext(protocol, registryAccess, false);
this.mappedContext = new CodecRegistryContext(protocol, registryAccess, true);
this.connection = connection;
@@ -90,6 +90,7 @@ import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9;
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.Protocol1_9_1To1_9_3;
import com.viaversion.viaversion.protocols.v1_9_3to1_10.Protocol1_9_3To1_10;
import com.viaversion.viaversion.protocols.v1_9to1_9_1.Protocol1_9To1_9_1;
import com.viaversion.viaversion.protocols.v26_1to26_2.Protocol26_1To26_2;
import com.viaversion.viaversion.util.MathUtil;
import com.viaversion.viaversion.util.Pair;
import io.netty.buffer.ByteBuf;
@@ -219,6 +220,7 @@ public class ProtocolManagerImpl implements ProtocolManager {
registerProtocol(new Protocol1_21_9To1_21_11(), ProtocolVersion.v1_21_11, ProtocolVersion.v1_21_9);
registerProtocol(new Protocol1_21_11To26_1(), ProtocolVersion.v26_1, ProtocolVersion.v1_21_11);
registerProtocol(new Protocol26_1To26_2(), ProtocolVersion.v26_2, ProtocolVersion.v26_1);
}
@Override
@@ -122,6 +122,11 @@ public final class RegistrationBuilder {
this.adapter = adapter;
}
/**
* @param max max version, exclusive
* @param action registration
* @return self
*/
public TypedRangesBuilder<CU, SU, R> to(final ProtocolVersion max, final TypedRegistrationAction<CU, SU, R> action) {
to(max, wrapAction(action));
return this;
@@ -109,7 +109,7 @@ public record RegistrationContext<CU extends ClientboundPacketType, SU extends S
return false;
}
private SU serverboundPacketType(final ServerboundPacketType genericPacketType) {
public SU serverboundPacketType(final ServerboundPacketType genericPacketType) {
final SU type = protocol.getPacketTypesProvider().unmappedServerboundType(genericPacketType.state(), genericPacketType.getName());
if (type == null) {
throw new IllegalArgumentException("Could not find serverbound packet type for " + genericPacketType.state() + " " + genericPacketType.getName());
@@ -117,7 +117,7 @@ public record RegistrationContext<CU extends ClientboundPacketType, SU extends S
return type;
}
private CU clientboundPacketType(final ClientboundPacketType genericPacketType) {
public CU clientboundPacketType(final ClientboundPacketType genericPacketType) {
final CU type = protocol.getPacketTypesProvider().unmappedClientboundType(genericPacketType.state(), genericPacketType.getName());
if (type == null) {
throw new IllegalArgumentException("Could not find clientbound packet type for " + genericPacketType.state() + " " + genericPacketType.getName() + " in " + protocol.getClass().getSimpleName());
@@ -86,7 +86,8 @@ public final class DefaultRegistrations {
.to(ProtocolVersion.v1_21_5, TextComponentRegistrations::registerComponents1_21_4)
)
.ranges(TextComponentRegistrations::nbtText, ProtocolVersion.v1_21_5, b -> b
.since(TextComponentRegistrations::registerComponents1_21_5)
.to(ProtocolVersion.v26_2, TextComponentRegistrations::registerComponents1_21_5)
.since(TextComponentRegistrations::registerComponents26_2)
)
.ranges(ProtocolVersion.v1_17_1, sbeps -> sbeps
@@ -67,13 +67,11 @@ final class EntityRegistrations {
static <CU extends ClientboundPacketType> void registerEntityPackets1_21_4(final RegistrationContext<CU, ?> ctx, final EntityRewriter<CU, ?> er) {
common1_20_5(ctx, er);
registerGameModeTrackers1_21_4(ctx, er);
ctx.clientbound(ClientboundPackets1_21_2.ADD_ENTITY, er::registerTrackerWithData1_19);
}
static <CU extends ClientboundPacketType> void registerEntityPackets1_21_9(final RegistrationContext<CU, ?> ctx, final EntityRewriter<CU, ?> er) {
common1_20_5(ctx, er);
registerGameModeTrackers1_21_4(ctx, er);
ctx.clientbound(ClientboundPackets1_21_9.ADD_ENTITY, er::registerTrackerWithData1_21_9);
}
@@ -82,11 +80,8 @@ final class EntityRegistrations {
ctx.clientbound(ClientboundPackets1_20_5.REMOVE_ENTITIES, er::registerRemoveEntities);
ctx.clientbound(ClientboundPackets1_20_5.LOGIN, er::registerLogin1_20_5);
ctx.clientbound(ClientboundPackets1_20_5.RESPAWN, er::registerRespawn1_20_5);
}
private static <CU extends ClientboundPacketType> void registerGameModeTrackers1_21_4(final RegistrationContext<CU, ?> ctx, final EntityRewriter<CU, ?> er) {
ctx.clientbound(ClientboundPackets1_21_2.GAME_EVENT, er::registerGameEvent);
ctx.clientbound(ClientboundPackets1_21_2.PLAYER_ABILITIES, er::registerPlayerAbilities);
ctx.clientbound(ClientboundPackets1_20_5.GAME_EVENT, er::registerGameEvent);
ctx.clientbound(ClientboundPackets1_20_5.PLAYER_ABILITIES, er::registerPlayerAbilities);
}
@@ -135,7 +135,7 @@ final class ItemRegistrations {
ctx.clientbound(ClientboundPackets1_21.UPDATE_ADVANCEMENTS, ir::registerAdvancements1_20_3);
ctx.clientbound(ClientboundPackets1_21.COOLDOWN, ir::registerCooldown);
ctx.serverbound(ServerboundPackets1_20_5.CONTAINER_CLICK, ir::registerContainerClick1_17_1);
ctx.serverbound(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT, ir::registerSetCreativeModeSlot);
ctx.serverbound(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT, ir::registerSetCreativeModeSlot1_20_5);
ctx.clientbound(ClientboundPackets1_21.SET_EQUIPMENT, ir::registerSetEquipment);
ctx.clientbound(ClientboundPackets1_21.OPEN_SCREEN, ir::registerOpenScreen);
ctx.clientbound(ClientboundPackets1_21.MERCHANT_OFFERS, ir::registerMerchantOffers1_20_5);
@@ -147,7 +147,7 @@ final class ItemRegistrations {
ctx.clientbound(ClientboundPackets1_21_2.UPDATE_ADVANCEMENTS, ir::registerAdvancements1_20_3);
ctx.clientbound(ClientboundPackets1_21_2.COOLDOWN, ir::registerCooldown1_21_2);
ctx.serverbound(ServerboundPackets1_21_2.CONTAINER_CLICK, ir::registerContainerClick1_21_2);
ctx.serverbound(ServerboundPackets1_21_2.SET_CREATIVE_MODE_SLOT, ir::registerSetCreativeModeSlot);
ctx.serverbound(ServerboundPackets1_21_2.SET_CREATIVE_MODE_SLOT, ir::registerSetCreativeModeSlot1_20_5);
ctx.clientbound(ClientboundPackets1_21_2.SET_EQUIPMENT, ir::registerSetEquipment);
ctx.clientbound(ClientboundPackets1_21_2.OPEN_SCREEN, ir::registerOpenScreen);
ctx.clientbound(ClientboundPackets1_21_2.MERCHANT_OFFERS, ir::registerMerchantOffers1_20_5);
@@ -183,6 +183,14 @@ final class TextComponentRegistrations {
ctx.clientbound(ClientboundPackets1_21_5.PLAYER_CHAT, cr::registerPlayerChat1_21_5);
}
static <CU extends ClientboundPacketType> void registerComponents26_2(final RegistrationContext<CU, ?> ctx, final NBTComponentRewriter<CU> cr) {
common1_20_5(ctx, cr);
ctx.clientbound(ClientboundPackets1_21_5.SET_PLAYER_TEAM, cr::registerSetPlayerTeam26_2);
ctx.clientbound(ClientboundPackets1_21_5.DISGUISED_CHAT, cr::registerDisguisedChat);
ctx.clientbound(ClientboundPackets1_21_5.PLAYER_INFO_UPDATE, cr::registerPlayerInfoUpdate1_21_4);
ctx.clientbound(ClientboundPackets1_21_5.PLAYER_CHAT, cr::registerPlayerChat1_21_5);
}
static @Nullable <CU extends ClientboundPacketType, SU extends ServerboundPacketType> ComponentRewriterBase<CU> text(final RegistrationContext<CU, SU> ctx) {
return (ComponentRewriterBase<CU>) ctx.protocol().getComponentRewriter();
}
@@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.rewriter.RegistryDataRewriter;
import com.viaversion.viaversion.protocol.shared_registration.PacketBound;
import com.viaversion.viaversion.protocol.shared_registration.RegistrationContext;
import com.viaversion.viaversion.protocols.v1_20to1_20_2.packet.ClientboundConfigurationPackets1_20_2;
@@ -51,8 +52,13 @@ public final class ConfigurationRegistrations {
PacketBound.ADDED_AT_MIN
);
ctx.clientbound(ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION,
packetType -> ctx.protocol().registerClientbound(packetType, wrapper -> wrapper.user().getProtocolInfo().setServerState(State.PLAY)),
ctx.clientbound(ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION, packetType -> ctx.protocol().registerClientbound(packetType, wrapper -> {
final RegistryDataRewriter registryDataRewriter = ctx.protocol().getRegistryDataRewriter();
if (registryDataRewriter != null) {
registryDataRewriter.sendMissingRegistries(wrapper.user());
}
wrapper.user().getProtocolInfo().setServerState(State.PLAY);
}),
PacketBound.ADDED_AT_MIN
);
}
@@ -30,12 +30,14 @@ import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.api.type.types.version.VersionedTypes;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPacket26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPackets26_1;
import com.viaversion.viaversion.protocols.v1_21_4to1_21_5.rewriter.RecipeDisplayRewriter1_21_5;
import com.viaversion.viaversion.protocols.v1_21_5to1_21_6.packet.ServerboundPackets1_21_6;
import com.viaversion.viaversion.protocols.v1_21_7to1_21_9.packet.ClientboundConfigurationPackets1_21_9;
import com.viaversion.viaversion.protocols.v1_21_7to1_21_9.packet.ServerboundConfigurationPackets1_21_9;
import com.viaversion.viaversion.protocols.v1_21_7to1_21_9.packet.ServerboundPacket1_21_9;
import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.ParticleRewriter;
import com.viaversion.viaversion.rewriter.RecipeDisplayRewriter;
import com.viaversion.viaversion.rewriter.RegistryDataRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import com.viaversion.viaversion.rewriter.block.BlockRewriter1_21_5;
@@ -58,6 +60,7 @@ final class Protocol98_1To99_1 extends AbstractProtocol<ClientboundPacket26_1, C
private final ParticleRewriter<ClientboundPacket26_1> particleRewriter = new ParticleRewriter<>(this);
private final TagRewriter<ClientboundPacket26_1> tagRewriter = new TagRewriter<>(this);
private final NBTComponentRewriter<ClientboundPacket26_1> componentRewriter = new ComponentRewriter99_1(this);
private final RecipeDisplayRewriter<ClientboundPacket26_1> recipeewriter = new RecipeDisplayRewriter1_21_5<>(this);
private final RegistryDataRewriter registryDataRewriter = new RegistryDataRewriter(this);
public Protocol98_1To99_1() {
@@ -132,6 +135,11 @@ final class Protocol98_1To99_1 extends AbstractProtocol<ClientboundPacket26_1, C
return registryDataRewriter;
}
@Override
public RecipeDisplayRewriter<ClientboundPacket26_1> getRecipeRewriter() {
return recipeewriter;
}
@Override
public ParticleRewriter<ClientboundPacket26_1> getParticleRewriter() {
return particleRewriter;
@@ -87,7 +87,7 @@ public class ParticleIdMappings1_13 {
add(16); // (43->16) endrod -> minecraft:end_rod
add(7); // (44->7) damageindicator -> minecraft:damage_indicator
add(40); // (45->40) sweepattack -> minecraft:sweep_attack
add(20, blockHandler()); // (46->20) fallingdust -> minecraft:falling_dust
add(20, blockHandler(160, 95)); // (46->20) fallingdust -> minecraft:falling_dust
// BlockState VarInt The ID of the block state.
add(41); // (47->41) totem -> minecraft:totem_of_undying
add(38); // (48->38) spit -> minecraft:spit
@@ -148,8 +148,15 @@ public class ParticleIdMappings1_13 {
// Handle (id+(data<<12)) encoded blocks
private static ParticleDataHandler blockHandler() {
return blockHandler(-1, -1);
}
private static ParticleDataHandler blockHandler(int fromBlockId, int toBlockId) {
return (particle, data) -> {
int value = data[0];
if ((value & 4095) == fromBlockId) {
value = value & ~4095 | toBlockId;
}
int combined = (((value & 4095) << 4) | (value >> 12 & 15));
int newId = WorldPacketRewriter1_13.toNewId(combined);
@@ -41,15 +41,15 @@ public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
int id = storage.get(position).getOriginal();
if (id >= SKULL_WALL_START && id <= SKULL_END) {
NumberTag rot = tag.getNumberTag("Rot");
if (rot != null) {
id += rot.asInt() & 0xF;
}
NumberTag skullType = tag.getNumberTag("SkullType");
if (skullType != null) {
id += skullType.asInt() * 20;
}
NumberTag rot = tag.getNumberTag("Rot");
if (rot != null) {
id += rot.asInt();
}
} else {
Protocol1_12_2To1_13.LOGGER.warning("Why does this block have the skull block entity? " + tag);
return -1;
@@ -38,6 +38,8 @@ public final class ComponentRewriter1_17 extends JsonNBTComponentRewriter<Client
mappings.put("commands.replaceitem.block.success", "commands.item.block.set.success");
mappings.put("commands.debug.reportSaved", "Created debug report in %s");
mappings.put("commands.debug.reportFailed", "Failed to create debug report");
mappings.put("commands.locate.success", "The nearest %s is at %s (%s blocks away)");
mappings.put("commands.locatebiome.success", "The nearest %s is at %s (%s blocks away)");
}
@Override
@@ -73,6 +73,20 @@ public final class Protocol1_19_3To1_19_4 extends AbstractProtocol<ClientboundPa
};
replaceClientbound(ClientboundPackets1_19_3.COMMANDS, commandRewriter::handle1_19);
registerClientbound(ClientboundPackets1_19_3.UPDATE_MOB_EFFECT, wrapper -> {
wrapper.passthrough(Types.VAR_INT); // entity id
wrapper.passthrough(Types.VAR_INT); // effect id
wrapper.passthrough(Types.BYTE); // amplifier
int duration = wrapper.read(Types.VAR_INT);
if (duration >= Short.MAX_VALUE) { // Anything at or above this would display as infinite on 1.19.2 and below, and on 1.19.4+, infinite is -1
wrapper.write(Types.VAR_INT, -1);
} else {
wrapper.write(Types.VAR_INT, duration);
}
});
registerClientbound(ClientboundPackets1_19_3.SERVER_DATA, wrapper -> {
JsonElement element = wrapper.read(Types.OPTIONAL_COMPONENT);
if (element != null) {
@@ -344,6 +344,15 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
recipeRewriter.handleRecipeType(wrapper, type);
}
});
protocol.replaceServerbound(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT, wrapper -> {
if (!protocol.getEntityRewriter().tracker(wrapper.user()).canInstaBuild()) {
wrapper.cancel();
return;
}
wrapper.passthrough(Types.SHORT); // Slot
wrapper.write(itemType(), handleItemToServer(wrapper.user(), wrapper.read(mappedItemType())));
});
}
public Item handleNonEmptyItemToClient(final UserConnection connection, @Nullable Item item) {
@@ -1076,7 +1085,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
}
private void updateEffects(final ListTag<CompoundTag> effects, final StructuredDataContainer data) {
final SuspiciousStewEffect[] suspiciousStewEffects = new SuspiciousStewEffect[effects.size()];
final List<SuspiciousStewEffect> suspiciousStewEffects = new ArrayList<>();
for (int i = 0; i < effects.size(); i++) {
final CompoundTag effect = effects.get(i);
final String effectIdString = effect.getString("id", "luck");
@@ -1087,10 +1096,10 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
effectId,
duration
);
suspiciousStewEffects[i] = stewEffect;
suspiciousStewEffects.add(stewEffect);
}
}
data.set(StructuredDataKey.SUSPICIOUS_STEW_EFFECTS, suspiciousStewEffects);
data.set(StructuredDataKey.SUSPICIOUS_STEW_EFFECTS, suspiciousStewEffects.toArray(SuspiciousStewEffect[]::new));
}
private void updateLodestoneTracker(final boolean tracked, final CompoundTag lodestonePosTag, final String lodestoneDimension, final StructuredDataContainer data) {
@@ -1550,8 +1550,9 @@ public class ComponentRewriter1_20_5<C extends ClientboundPacketType> extends Js
}
protected Item[] itemArrayFromTag(final UserConnection connection, final ListTag<CompoundTag> tag) {
final Item[] items = new Item[tag.size()];
for (int i = 0; i < tag.size(); i++) {
final int size = Math.min(tag.size(), 1024);
final Item[] items = new Item[size];
for (int i = 0; i < size; i++) {
items[i] = itemFromTag(connection, tag.get(i));
}
return items;
@@ -278,7 +278,9 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
storage.clear();
final byte gamemode = wrapper.get(Types.BYTE, 0);
sendRangeAttributes(wrapper.user(), gamemode == GameMode.CREATIVE.id());
final boolean creativeMode = gamemode == GameMode.CREATIVE.id();
sendRangeAttributes(wrapper.user(), creativeMode);
tracker(wrapper.user()).setInstaBuild(creativeMode);
});
}
});
@@ -293,7 +295,9 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
wrapper.passthrough(Types.LONG); // Seed
final byte gamemode = wrapper.passthrough(Types.BYTE);
sendRangeAttributes(wrapper.user(), gamemode == GameMode.CREATIVE.id());
final boolean creativeMode = gamemode == GameMode.CREATIVE.id();
sendRangeAttributes(wrapper.user(), creativeMode);
tracker(wrapper.user()).setInstaBuild(creativeMode);
wrapper.user().put(new ScoreboardTeamStorage());
});
@@ -338,7 +342,14 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
// Resend attributes either with their original list or with the creative range modifier added
final int value = (int) Math.floor(wrapper.passthrough(Types.FLOAT) + 0.5F);
sendRangeAttributes(wrapper.user(), value == GameMode.CREATIVE.id());
final boolean creativeMode = value == GameMode.CREATIVE.id();
sendRangeAttributes(wrapper.user(), creativeMode);
tracker(wrapper.user()).setInstaBuild(creativeMode);
});
protocol.registerClientbound(ClientboundPackets1_20_3.PLAYER_ABILITIES, wrapper -> {
final byte flags = wrapper.passthrough(Types.BYTE);
tracker(wrapper.user()).setInstaBuild((flags & 1 << 3) != 0);
});
}
@@ -34,6 +34,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ConfigurationState implements StorableObject {
private static final int MAX_SERVERBOUND_QUEUED_PACKETS = Integer.getInteger("viaversion.maxQueuedServerboundConfigPackets", 1000);
private static final int MAX_SERVERBOUND_QUEUED_BYTES = Integer.getInteger("viaversion.maxQueuedServerboundConfigPacketBytes", 1048576);
private static final QueuedPacket[] EMPTY_PACKET_ARRAY = new QueuedPacket[0];
private final List<QueuedPacket> packetQueue = new ArrayList<>();
private BridgePhase bridgePhase = BridgePhase.NONE;
@@ -42,6 +44,7 @@ public class ConfigurationState implements StorableObject {
private CompoundTag lastDimensionRegistry;
private ClientInformation clientInformation;
private int queuedServerboundBytes;
private int queuedServerboundPackets;
public BridgePhase bridgePhase() {
return bridgePhase;
@@ -78,10 +81,11 @@ public class ConfigurationState implements StorableObject {
public void addServerboundPacketToQueue(final PacketWrapper wrapper) {
final QueuedPacket queued = toQueuedPacket(wrapper, false, false);
final int bytes = queued.buf().readableBytes();
if (packetQueue.size() > 5000 || queuedServerboundBytes + bytes > 2097152) {
if (queuedServerboundPackets >= MAX_SERVERBOUND_QUEUED_PACKETS || queuedServerboundBytes + bytes > MAX_SERVERBOUND_QUEUED_BYTES) {
wrapper.user().disconnect("Sent too many packets during config phase");
return;
}
queuedServerboundPackets++;
queuedServerboundBytes += bytes;
packetQueue.add(queued);
}
@@ -93,7 +93,10 @@ public final class Protocol1_21_11To26_1 extends AbstractProtocol<ClientboundPac
appendClientbound(ClientboundConfigurationPackets1_21_9.FINISH_CONFIGURATION, wrapper -> {
final PacketWrapper clocksPacket = wrapper.create(ClientboundConfigurationPackets1_21_9.REGISTRY_DATA);
clocksPacket.write(Types.STRING, "world_clock");
clocksPacket.write(Types.REGISTRY_ENTRY_ARRAY, new RegistryEntry[]{new RegistryEntry("minecraft:overworld", new CompoundTag())});
clocksPacket.write(Types.REGISTRY_ENTRY_ARRAY, new RegistryEntry[]{
new RegistryEntry("minecraft:overworld", new CompoundTag()),
new RegistryEntry("minecraft:the_end", new CompoundTag())
});
clocksPacket.send(Protocol1_21_11To26_1.class);
sendSoundVariants(wrapper, "cat_sound_variant", MAPPINGS.catSoundVariants());
@@ -198,6 +201,9 @@ public final class Protocol1_21_11To26_1 extends AbstractProtocol<ClientboundPac
spearDamageType.putString("scaling", "when_caused_by_living_non_player");
registryDataRewriter.addEntries("damage_type", new RegistryEntry("spear", spearDamageType));
final CompoundTag temperateChicken = new CompoundTag();
temperateChicken.putString("asset_id", "entity/chicken/chicken_temperate");
temperateChicken.putString("baby_asset_id", "entity/chicken/chicken_temperate_baby");
final CompoundTag coldChicken = new CompoundTag();
coldChicken.putString("asset_id", "entity/chicken/chicken_cold");
coldChicken.putString("baby_asset_id", "entity/chicken/chicken_cold_baby");
@@ -205,7 +211,7 @@ public final class Protocol1_21_11To26_1 extends AbstractProtocol<ClientboundPac
final CompoundTag warmChicken = new CompoundTag();
warmChicken.putString("asset_id", "entity/chicken/chicken_warm");
warmChicken.putString("baby_asset_id", "entity/chicken/chicken_warm_baby");
registryDataRewriter.addEntries("chicken_variant", new RegistryEntry("cold", coldChicken), new RegistryEntry("warm", warmChicken));
registryDataRewriter.addEntries("chicken_variant", new RegistryEntry("temperate", temperateChicken), new RegistryEntry("cold", coldChicken), new RegistryEntry("warm", warmChicken));
final CompoundTag ponderGoatHornInstrument = new CompoundTag();
final CompoundTag ponderGoatHornDescription = new CompoundTag();
@@ -214,7 +220,7 @@ public final class Protocol1_21_11To26_1 extends AbstractProtocol<ClientboundPac
ponderGoatHornInstrument.putString("sound_event", "item.goat_horn.sound.0");
ponderGoatHornInstrument.putFloat("use_duration", 7F);
ponderGoatHornInstrument.putFloat("range", 256F);
registryDataRewriter.addEntries("instrument", new RegistryEntry("spear", ponderGoatHornInstrument));
registryDataRewriter.addEntries("instrument", new RegistryEntry("ponder_goat_horn", ponderGoatHornInstrument));
addJukeboxPlayables("11", "13", "5", "blocks", "cat", "chirp", "far", "mall", "mellohi", "otherside", "pigstep", "relic", "stal", "strad", "wait", "ward", "creator", "creator_music_box", "lava_chicken", "tears", "precipice");
addTrimMaterials("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst", "resin");
@@ -233,17 +239,21 @@ public final class Protocol1_21_11To26_1 extends AbstractProtocol<ClientboundPac
private void addJukeboxPlayables(final String... songs) {
for (final String song : songs) {
final CompoundTag songTag = new CompoundTag();
final CompoundTag songDescription = new CompoundTag();
songDescription.putString("translate", "jukebox_song.minecraft." + song);
songTag.put("description", songDescription);
songTag.putString("sound_event", "music_disc." + song);
songTag.putFloat("length_in_seconds", 175F);
songTag.putInt("comparator_output", 10);
registryDataRewriter.addEntries("jukebox_song", new RegistryEntry(song, songTag));
registryDataRewriter.addEntries("jukebox_song", createJukeboxPlayableEntry(song));
}
}
public static RegistryEntry createJukeboxPlayableEntry(final String song) {
final CompoundTag songTag = new CompoundTag();
final CompoundTag songDescription = new CompoundTag();
songDescription.putString("translate", "jukebox_song.minecraft." + song);
songTag.put("description", songDescription);
songTag.putString("sound_event", "music_disc." + song);
songTag.putFloat("length_in_seconds", 175F);
songTag.putInt("comparator_output", 10);
return new RegistryEntry(song, songTag);
}
private void swapAffixAndAddAssetId(final String registryKey, final String affix) {
registryDataRewriter.addHandler(registryKey, (key, tag) -> {
swapEntityNameAffix(affix, tag);
@@ -81,7 +81,7 @@ public enum ServerboundPackets26_1 implements ServerboundPacket26_1 {
SET_STRUCTURE_BLOCK, // 0x3B
SET_TEST_BLOCK, // 0x3C
SIGN_UPDATE, // 0x3D
SPECTATE_ENTITY, // 0x3E
SPECTATE_ENTITY, // 0x3E // TODO rename to SPECTATOR_ACTION once a new enum is needed
SWING, // 0x3F
TELEPORT_TO_ENTITY, // 0x40
TEST_INSTANCE_BLOCK_ACTION, // 0x41
@@ -77,17 +77,17 @@ public final class BlockItemPacketRewriter26_1 extends StructuredItemRewriter<Cl
@Override
protected void handleItemDataComponentsToClient(final UserConnection connection, final Item item, final StructuredDataContainer container) {
upgradeData(protocol, protocol.types().structuredDataKeys(), container);
upgradeData(protocol, connection, protocol.types().structuredDataKeys(), container);
super.handleItemDataComponentsToClient(connection, item, container);
}
public static void upgradeData(final Protocol<?, ?, ?, ?> protocol, final StructuredDataKeys1_21_11 dataKeys, final StructuredDataContainer container) {
container.replace(StructuredDataKey.JUKEBOX_PLAYABLE1_21_5, StructuredDataKey.JUKEBOX_PLAYABLE26_1, jukeboxPlayable -> upgradeHolder(protocol, jukeboxPlayable.song(), "jukebox_song"));
container.replace(StructuredDataKey.INSTRUMENT1_21_5, StructuredDataKey.INSTRUMENT26_1, instrument -> upgradeHolder(protocol, instrument, "instrument"));
container.replace(StructuredDataKey.PROVIDES_TRIM_MATERIAL1_21_5, StructuredDataKey.PROVIDES_TRIM_MATERIAL26_1, providesTrimMaterial -> upgradeHolder(protocol, providesTrimMaterial.material(), "trim_material"));
container.replace(StructuredDataKey.CHICKEN_VARIANT1_21_5, StructuredDataKey.CHICKEN_VARIANT26_1, chickenVariant -> upgradeEitherVariant(protocol, chickenVariant, "chicken_variant"));
container.replace(StructuredDataKey.ZOMBIE_NAUTILUS_VARIANT1_21_11, StructuredDataKey.ZOMBIE_NAUTILUS_VARIANT26_1, nautilusVariant -> upgradeEitherVariant(protocol, nautilusVariant, "zombie_nautilus_variant"));
container.replace(StructuredDataKey.DAMAGE_TYPE1_21_11, StructuredDataKey.DAMAGE_TYPE26_1, damageType -> upgradeEitherVariant(protocol, damageType.id(), "damage_type"));
public static void upgradeData(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection, final StructuredDataKeys1_21_11 dataKeys, final StructuredDataContainer container) {
container.replace(StructuredDataKey.JUKEBOX_PLAYABLE1_21_5, StructuredDataKey.JUKEBOX_PLAYABLE26_1, jukeboxPlayable -> upgradeHolder(protocol, connection, jukeboxPlayable.song(), "jukebox_song"));
container.replace(StructuredDataKey.INSTRUMENT1_21_5, StructuredDataKey.INSTRUMENT26_1, instrument -> upgradeHolder(protocol, connection, instrument, "instrument"));
container.replace(StructuredDataKey.PROVIDES_TRIM_MATERIAL1_21_5, StructuredDataKey.PROVIDES_TRIM_MATERIAL26_1, providesTrimMaterial -> upgradeHolder(protocol, connection, providesTrimMaterial.material(), "trim_material"));
container.replace(StructuredDataKey.CHICKEN_VARIANT1_21_5, StructuredDataKey.CHICKEN_VARIANT26_1, chickenVariant -> upgradeEitherVariant(protocol, connection, chickenVariant, "chicken_variant"));
container.replace(StructuredDataKey.ZOMBIE_NAUTILUS_VARIANT1_21_11, StructuredDataKey.ZOMBIE_NAUTILUS_VARIANT26_1, nautilusVariant -> upgradeEitherVariant(protocol, connection, nautilusVariant, "zombie_nautilus_variant"));
container.replace(StructuredDataKey.DAMAGE_TYPE1_21_11, StructuredDataKey.DAMAGE_TYPE26_1, damageType -> upgradeEitherVariant(protocol, connection, damageType.id(), "damage_type"));
container.replace(StructuredDataKey.PROVIDES_BANNER_PATTERNS1_21_5, StructuredDataKey.PROVIDES_BANNER_PATTERNS26_1, key -> new ProvidesBannerPatterns(HolderSet.of(key.original())));
container.replace(StructuredDataKey.DAMAGE_RESISTANT1_21_2, StructuredDataKey.DAMAGE_RESISTANT26_1, damageResistant -> new DamageResistant26_1(HolderSet.of(damageResistant.typesTagKey().original())));
container.replaceKey(StructuredDataKey.BLOCKS_ATTACKS1_21_5, StructuredDataKey.BLOCKS_ATTACKS26_1);
@@ -103,20 +103,20 @@ public final class BlockItemPacketRewriter26_1 extends StructuredItemRewriter<Cl
}
}
private static @Nullable Integer upgradeEitherVariant(final Protocol<?, ?, ?, ?> protocol, final Either<Integer, String> eitherHolder, final String registry) {
return eitherHolder.isLeft() ? eitherHolder.left() : registryIdOrNull(protocol, registry, eitherHolder.right());
private static @Nullable Integer upgradeEitherVariant(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection, final Either<Integer, String> eitherHolder, final String registry) {
return eitherHolder.isLeft() ? eitherHolder.left() : registryIdOrNull(protocol, connection, registry, eitherHolder.right());
}
private static <T> @Nullable Holder<T> upgradeHolder(final Protocol<?, ?, ?, ?> protocol, final EitherHolder<T> eitherHolder, final String registry) {
private static <T> @Nullable Holder<T> upgradeHolder(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection, final EitherHolder<T> eitherHolder, final String registry) {
if (eitherHolder.hasHolder()) {
return eitherHolder.holder();
}
final Integer id = registryIdOrNull(protocol, registry, eitherHolder.key());
final Integer id = registryIdOrNull(protocol, connection, registry, eitherHolder.key());
return id != null ? Holder.of((int) id) : null;
}
private static @Nullable Integer registryIdOrNull(final Protocol<?, ?, ?, ?> protocol, final String registry, final String key) {
final int id = protocol.getRegistryDataRewriter().getMappings(registry).keyToId(key);
private static @Nullable Integer registryIdOrNull(final Protocol<?, ?, ?, ?> protocol, final UserConnection connection, final String registry, final String key) {
final int id = protocol.getEntityRewriter().tracker(connection).registryKeys(registry).keyToId(key);
return id != -1 ? id : null;
}
@@ -197,7 +197,7 @@ public final class Protocol1_21_4To1_21_5 extends AbstractProtocol<ClientboundPa
@Override
public void init(final UserConnection connection) {
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_21_4.PLAYER));
connection.addItemHasher(this.getClass(), new ItemHashStorage1_21_5(this));
connection.addItemHasher(this.getClass(), new ItemHashStorage1_21_5(this, connection));
connection.put(new MessageIndexStorage());
}
@@ -88,6 +88,19 @@ public final class EntityPacketRewriter1_21_5 extends EntityRewriter<Clientbound
wrapper.user().get(MessageIndexStorage.class).setIndex(0);
});
protocol.registerClientbound(ClientboundPackets1_21_2.UPDATE_MOB_EFFECT, wrapper -> {
// Add blending to nausea effect
wrapper.passthrough(Types.VAR_INT); // Entity ID
final int effectId = wrapper.passthrough(Types.VAR_INT); // Effect ID
wrapper.passthrough(Types.VAR_INT); // Amplifier
wrapper.passthrough(Types.VAR_INT); // Duration
byte flags = wrapper.read(Types.BYTE); // Flags
if (effectId == 8) { // Nausea
flags |= 0x08; // blend
}
wrapper.write(Types.BYTE, flags);
});
protocol.replaceClientbound(ClientboundPackets1_21_2.SET_PLAYER_TEAM, wrapper -> {
wrapper.passthrough(Types.STRING); // Team Name
final byte action = wrapper.passthrough(Types.BYTE); // Mode
@@ -19,6 +19,7 @@ package com.viaversion.viaversion.protocols.v1_21_4to1_21_5.storage;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.item.ItemHasher;
import com.viaversion.viaversion.api.minecraft.codec.CodecContext;
import com.viaversion.viaversion.api.minecraft.codec.CodecContext.RegistryAccess;
@@ -37,8 +38,8 @@ public class ItemHashStorage1_21_5 implements ItemHasher {
private boolean processingClientboundInventoryPacket;
private final CodecContext context;
public ItemHashStorage1_21_5(final Protocol1_21_4To1_21_5 protocol) {
final RegistryAccess registryAccess = RegistryAccess.of(protocol);
public ItemHashStorage1_21_5(final Protocol1_21_4To1_21_5 protocol, final UserConnection connection) {
final RegistryAccess registryAccess = RegistryAccess.of(protocol, connection);
this.context = new CodecRegistryContext(protocol, registryAccess, true); // always using 1.21.5 items as input
}
@@ -61,6 +61,7 @@ import com.viaversion.viaversion.rewriter.SoundRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import com.viaversion.viaversion.rewriter.block.BlockRewriter1_21_5;
import com.viaversion.viaversion.rewriter.text.NBTComponentRewriter;
import com.viaversion.viaversion.util.Limit;
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
@@ -112,7 +113,7 @@ public final class Protocol1_21_7To1_21_9 extends AbstractProtocol<ClientboundPa
wrapper.write(Types.VAR_INT, 0); // Number of block particles
});
registerServerbound(ServerboundPackets1_21_6.DEBUG_SAMPLE_SUBSCRIPTION, wrapper -> {
final int count = wrapper.read(Types.VAR_INT); // subscription count
final int count = Limit.max(wrapper.read(Types.VAR_INT), 32); // subscription count
for (int i = 0; i < count; i++) {
final int id = wrapper.read(Types.VAR_INT); // subscription registry id
if (id == 0) { // DEDICATED_SERVER_TICK_TIME
@@ -0,0 +1,257 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.protocols.v26_1to26_2;
import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.Tag;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.MappingDataBase;
import com.viaversion.viaversion.api.minecraft.RegistryType;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys1_21_11;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys26_2;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes26_2;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes26_1;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType26_1;
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
import com.viaversion.viaversion.api.type.types.version.VersionedTypes;
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.Protocol1_21_11To26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPacket26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPackets26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ServerboundPacket26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ServerboundPackets26_1;
import com.viaversion.viaversion.protocols.v1_21_4to1_21_5.rewriter.RecipeDisplayRewriter1_21_5;
import com.viaversion.viaversion.protocols.v1_21_7to1_21_9.packet.ClientboundConfigurationPackets1_21_9;
import com.viaversion.viaversion.protocols.v1_21_7to1_21_9.packet.ServerboundConfigurationPackets1_21_9;
import com.viaversion.viaversion.protocols.v26_1to26_2.rewriter.BlockItemPacketRewriter26_2;
import com.viaversion.viaversion.protocols.v26_1to26_2.rewriter.EntityPacketRewriter26_2;
import com.viaversion.viaversion.protocols.v26_1to26_2.storage.Encrypted;
import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.ParticleRewriter;
import com.viaversion.viaversion.rewriter.RecipeDisplayRewriter;
import com.viaversion.viaversion.rewriter.RegistryDataRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
import com.viaversion.viaversion.rewriter.block.BlockRewriter1_21_5;
import com.viaversion.viaversion.rewriter.text.NBTComponentRewriter;
import com.viaversion.viaversion.util.Key;
import java.util.UUID;
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
public final class Protocol26_1To26_2 extends AbstractProtocol<ClientboundPacket26_1, ClientboundPacket26_1, ServerboundPacket26_1, ServerboundPacket26_1> {
public static final MappingData MAPPINGS = new MappingDataBase("26.1", "26.2");
private final EntityPacketRewriter26_2 entityRewriter = new EntityPacketRewriter26_2(this);
private final BlockItemPacketRewriter26_2 itemRewriter = new BlockItemPacketRewriter26_2(this);
private final BlockRewriter<ClientboundPacket26_1> blockRewriter = new BlockRewriter1_21_5<>(this, ChunkType26_1::new);
private final ParticleRewriter<ClientboundPacket26_1> particleRewriter = new ParticleRewriter<>(this);
private final TagRewriter<ClientboundPacket26_1> tagRewriter = new TagRewriter<>(this);
private final NBTComponentRewriter<ClientboundPacket26_1> componentRewriter = new NBTComponentRewriter<>(this);
private final RegistryDataRewriter registryDataRewriter = new RegistryDataRewriter(this) {
@Override
public void updateEnchantmentTerm(final CompoundTag term) {
super.updateEnchantmentTerm(term);
final String condition = term.getString("condition");
if (Key.equals(condition, "entity_properties")) {
final CompoundTag predicate = term.getCompoundTag("predicate");
final CompoundTag typeSpecific = predicate.removeUnchecked("type_specific");
if (typeSpecific != null) {
updateTypeSpecificTerm(predicate, typeSpecific);
return;
}
final Tag typeTag = predicate.remove("type");
if (typeTag != null) {
predicate.put("entity_type", typeTag);
}
}
}
};
private final RecipeDisplayRewriter1_21_5<ClientboundPacket26_1> recipeRewriter = new RecipeDisplayRewriter1_21_5<>(this);
private void updateTypeSpecificTerm(final CompoundTag predicate, final CompoundTag typeSpecific) {
final String type = typeSpecific.getString("type");
final String strippedType = Key.stripMinecraftNamespace(type);
if (strippedType.equals("player") || strippedType.equals("lightning")
|| strippedType.equals("fishing_hook") || strippedType.equals("raider")) {
predicate.put("type_specific/" + strippedType, typeSpecific);
}
}
public Protocol26_1To26_2() {
super(ClientboundPacket26_1.class, ClientboundPacket26_1.class, ServerboundPacket26_1.class, ServerboundPacket26_1.class);
}
@Override
protected void registerPackets() {
super.registerPackets();
replaceClientbound(ClientboundPackets26_1.SET_PLAYER_TEAM, wrapper -> {
wrapper.passthrough(Types.STRING); // Team Name
final byte action = wrapper.passthrough(Types.BYTE); // Mode
if (action == 0 || action == 2) {
componentRewriter.passthroughAndProcess(wrapper); // Display name
final byte flags = wrapper.read(Types.BYTE);
final int nametagVisibility = wrapper.read(Types.VAR_INT);
final int collisionRule = wrapper.read(Types.VAR_INT);
final int color = wrapper.read(Types.VAR_INT);
componentRewriter.passthroughAndProcess(wrapper); // Prefix
componentRewriter.passthroughAndProcess(wrapper); // Suffix
wrapper.write(Types.VAR_INT, nametagVisibility);
wrapper.write(Types.VAR_INT, collisionRule);
wrapper.write(Types.BOOL_OPTIONAL_VAR_INT, color < 16 ? color : null); // only actual colors now
wrapper.write(Types.BYTE, flags);
}
});
registerClientbound(State.LOGIN, ClientboundLoginPackets.LOGIN_FINISHED, wrapper -> {
wrapper.passthrough(Types.UUID); // UUID
wrapper.passthrough(Types.STRING); // Name
wrapper.passthrough(Types.PROFILE_PROPERTY_ARRAY);
wrapper.write(Types.UUID, UUID.randomUUID()); // Session ID
});
registerServerbound(State.LOGIN, ServerboundLoginPackets.ENCRYPTION_KEY, wrapper -> {
// Previously also used for hiding skins on offline mode servers, now moved to the login packet.
wrapper.user().put(new Encrypted());
});
tagRewriter.addEmptyTags(RegistryType.BLOCK, "infiniburn_nether", "infiniburn_end", "infiniburn_overworld"); // from an older version, but servers may have skipped these
registryDataRewriter.addEntries("jukebox_song", Protocol1_21_11To26_1.createJukeboxPlayableEntry("bounce"));
}
@Override
protected void onMappingDataLoaded() {
EntityTypes26_2.initialize(this);
ParticleType.Fillers.fill26_2(this);
mappedTypes().structuredData.filler(this).add(StructuredDataKey.CUSTOM_DATA, StructuredDataKey.MAX_STACK_SIZE, StructuredDataKey.MAX_DAMAGE,
StructuredDataKey.UNBREAKABLE1_21_5, StructuredDataKey.RARITY, StructuredDataKey.TOOLTIP_DISPLAY, StructuredDataKey.DAMAGE_RESISTANT26_1,
StructuredDataKey.CUSTOM_NAME, StructuredDataKey.LORE, StructuredDataKey.ENCHANTMENTS1_21_5,
StructuredDataKey.CUSTOM_MODEL_DATA1_21_4, StructuredDataKey.BLOCKS_ATTACKS26_1, StructuredDataKey.PROVIDES_BANNER_PATTERNS26_1,
StructuredDataKey.REPAIR_COST, StructuredDataKey.CREATIVE_SLOT_LOCK, StructuredDataKey.ENCHANTMENT_GLINT_OVERRIDE,
StructuredDataKey.INTANGIBLE_PROJECTILE, StructuredDataKey.STORED_ENCHANTMENTS1_21_5, StructuredDataKey.DYED_COLOR1_21_5,
StructuredDataKey.MAP_COLOR, StructuredDataKey.MAP_ID, StructuredDataKey.MAP_DECORATIONS, StructuredDataKey.MAP_POST_PROCESSING,
StructuredDataKey.POTION_CONTENTS1_21_2, StructuredDataKey.SUSPICIOUS_STEW_EFFECTS, StructuredDataKey.WRITABLE_BOOK_CONTENT,
StructuredDataKey.WRITTEN_BOOK_CONTENT, StructuredDataKey.TRIM1_21_5, StructuredDataKey.DEBUG_STICK_STATE, StructuredDataKey.ENTITY_DATA1_21_9,
StructuredDataKey.BUCKET_ENTITY_DATA, StructuredDataKey.BLOCK_ENTITY_DATA1_21_9, StructuredDataKey.INSTRUMENT26_1,
StructuredDataKey.RECIPES, StructuredDataKey.LODESTONE_TRACKER, StructuredDataKey.FIREWORK_EXPLOSION, StructuredDataKey.FIREWORKS,
StructuredDataKey.PROFILE1_21_9, StructuredDataKey.NOTE_BLOCK_SOUND, StructuredDataKey.BANNER_PATTERNS, StructuredDataKey.BASE_COLOR,
StructuredDataKey.POT_DECORATIONS, StructuredDataKey.BLOCK_STATE, StructuredDataKey.BEES1_21_9, StructuredDataKey.LOCK1_21_2,
StructuredDataKey.CONTAINER_LOOT, StructuredDataKey.TOOL1_21_5, StructuredDataKey.ITEM_NAME, StructuredDataKey.OMINOUS_BOTTLE_AMPLIFIER,
StructuredDataKey.FOOD1_21_2, StructuredDataKey.JUKEBOX_PLAYABLE26_1, StructuredDataKey.ATTRIBUTE_MODIFIERS1_21_6,
StructuredDataKey.REPAIRABLE, StructuredDataKey.ENCHANTABLE, StructuredDataKey.CONSUMABLE1_21_2, StructuredDataKey.ATTACK_RANGE,
StructuredDataKey.USE_COOLDOWN, StructuredDataKey.DAMAGE, StructuredDataKey.EQUIPPABLE1_21_6, StructuredDataKey.ITEM_MODEL,
StructuredDataKey.GLIDER, StructuredDataKey.TOOLTIP_STYLE, StructuredDataKey.DEATH_PROTECTION, StructuredDataKey.WEAPON,
StructuredDataKey.POTION_DURATION_SCALE, StructuredDataKey.VILLAGER_VARIANT, StructuredDataKey.WOLF_VARIANT, StructuredDataKey.WOLF_COLLAR,
StructuredDataKey.FOX_VARIANT, StructuredDataKey.SALMON_SIZE, StructuredDataKey.PARROT_VARIANT, StructuredDataKey.TROPICAL_FISH_PATTERN,
StructuredDataKey.TROPICAL_FISH_BASE_COLOR, StructuredDataKey.TROPICAL_FISH_PATTERN_COLOR, StructuredDataKey.MOOSHROOM_VARIANT,
StructuredDataKey.RABBIT_VARIANT, StructuredDataKey.PIG_VARIANT, StructuredDataKey.FROG_VARIANT, StructuredDataKey.HORSE_VARIANT,
StructuredDataKey.PAINTING_VARIANT, StructuredDataKey.LLAMA_VARIANT, StructuredDataKey.AXOLOTL_VARIANT, StructuredDataKey.CAT_VARIANT,
StructuredDataKey.CAT_COLLAR, StructuredDataKey.SHEEP_COLOR, StructuredDataKey.SHULKER_COLOR, StructuredDataKey.PROVIDES_TRIM_MATERIAL26_1,
StructuredDataKey.BREAK_SOUND, StructuredDataKey.COW_VARIANT, StructuredDataKey.CHICKEN_VARIANT26_1, StructuredDataKey.WOLF_SOUND_VARIANT,
StructuredDataKey.USE_EFFECTS, StructuredDataKey.MINIMUM_ATTACK_CHARGE, StructuredDataKey.DAMAGE_TYPE26_1, StructuredDataKey.PIERCING_WEAPON,
StructuredDataKey.KINETIC_WEAPON, StructuredDataKey.SWING_ANIMATION, StructuredDataKey.ZOMBIE_NAUTILUS_VARIANT26_1, StructuredDataKey.ADDITIONAL_TRADE_COST,
StructuredDataKey.DYE, StructuredDataKey.PIG_SOUND_VARIANT, StructuredDataKey.COW_SOUND_VARIANT, StructuredDataKey.CHICKEN_SOUND_VARIANT, StructuredDataKey.CAT_SOUND_VARIANT);
super.onMappingDataLoaded();
}
@Override
public void init(final UserConnection connection) {
addEntityTracker(connection);
addItemHasher(connection);
}
@Override
public MappingData getMappingData() {
return MAPPINGS;
}
@Override
public EntityPacketRewriter26_2 getEntityRewriter() {
return entityRewriter;
}
@Override
public BlockItemPacketRewriter26_2 getItemRewriter() {
return itemRewriter;
}
@Override
public BlockRewriter<ClientboundPacket26_1> getBlockRewriter() {
return blockRewriter;
}
@Override
public RecipeDisplayRewriter<ClientboundPacket26_1> getRecipeRewriter() {
return recipeRewriter;
}
@Override
public RegistryDataRewriter getRegistryDataRewriter() {
return registryDataRewriter;
}
@Override
public ParticleRewriter<ClientboundPacket26_1> getParticleRewriter() {
return particleRewriter;
}
@Override
public TagRewriter<ClientboundPacket26_1> getTagRewriter() {
return tagRewriter;
}
@Override
public NBTComponentRewriter<ClientboundPacket26_1> getComponentRewriter() {
return componentRewriter;
}
@Override
public Types1_20_5<StructuredDataKeys1_21_11, EntityDataTypes26_1> types() {
return VersionedTypes.V26_1;
}
@Override
public Types1_20_5<StructuredDataKeys26_2, EntityDataTypes26_1> mappedTypes() {
return VersionedTypes.V26_2;
}
@Override
protected PacketTypesProvider<ClientboundPacket26_1, ClientboundPacket26_1, ServerboundPacket26_1, ServerboundPacket26_1> createPacketTypesProvider() {
return new SimplePacketTypesProvider<>(
packetTypeMap(unmappedClientboundPacketType, ClientboundPackets26_1.class, ClientboundConfigurationPackets1_21_9.class),
packetTypeMap(mappedClientboundPacketType, ClientboundPackets26_1.class, ClientboundConfigurationPackets1_21_9.class),
packetTypeMap(mappedServerboundPacketType, ServerboundPackets26_1.class, ServerboundConfigurationPackets1_21_9.class),
packetTypeMap(unmappedServerboundPacketType, ServerboundPackets26_1.class, ServerboundConfigurationPackets1_21_9.class)
);
}
}
@@ -0,0 +1,53 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.protocols.v26_1to26_2.rewriter;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataContainer;
import com.viaversion.viaversion.api.minecraft.data.version.StructuredDataKeys26_2;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPacket26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ServerboundPacket26_1;
import com.viaversion.viaversion.protocols.v26_1to26_2.Protocol26_1To26_2;
import com.viaversion.viaversion.rewriter.StructuredItemRewriter;
public final class BlockItemPacketRewriter26_2 extends StructuredItemRewriter<ClientboundPacket26_1, ServerboundPacket26_1, Protocol26_1To26_2> {
public BlockItemPacketRewriter26_2(final Protocol26_1To26_2 protocol) {
super(protocol);
}
@Override
protected void handleItemDataComponentsToClient(final UserConnection connection, final Item item, final StructuredDataContainer container) {
upgradeData(container);
super.handleItemDataComponentsToClient(connection, item, container);
}
@Override
protected void handleItemDataComponentsToServer(final UserConnection connection, final Item item, final StructuredDataContainer container) {
downgradeData(protocol.mappedTypes().structuredDataKeys(), container);
super.handleItemDataComponentsToServer(connection, item, container);
}
public static void upgradeData(final StructuredDataContainer container) {
}
public static void downgradeData(final StructuredDataKeys26_2 dataKeys, final StructuredDataContainer container) {
container.remove(dataKeys.sulfurCubeContent);
}
}
@@ -0,0 +1,85 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.protocols.v26_1to26_2.rewriter;
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes26_2;
import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes26_1;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPacket26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ClientboundPackets26_1;
import com.viaversion.viaversion.protocols.v1_21_11to26_1.packet.ServerboundPackets26_1;
import com.viaversion.viaversion.protocols.v26_1to26_2.Protocol26_1To26_2;
import com.viaversion.viaversion.protocols.v26_1to26_2.storage.Encrypted;
import com.viaversion.viaversion.rewriter.EntityRewriter;
public final class EntityPacketRewriter26_2 extends EntityRewriter<ClientboundPacket26_1, Protocol26_1To26_2> {
public EntityPacketRewriter26_2(final Protocol26_1To26_2 protocol) {
super(protocol);
}
@Override
protected void registerPackets() {
super.registerPackets();
protocol.registerServerbound(ServerboundPackets26_1.SPECTATE_ENTITY, wrapper -> {
final Integer entityId = wrapper.read(Types.OPTIONAL_VAR_INT);
if (entityId != null) {
wrapper.write(Types.VAR_INT, entityId);
} else {
wrapper.cancel();
}
});
protocol.appendClientbound(ClientboundPackets26_1.LOGIN, wrapper -> {
// Continuing from the registered handler
wrapper.passthrough(Types.BYTE); // Previous gamemode
wrapper.passthrough(Types.BOOLEAN); // Debug
wrapper.passthrough(Types.BOOLEAN); // Flat
wrapper.passthrough(Types.OPTIONAL_GLOBAL_POSITION); // Last death location
wrapper.passthrough(Types.VAR_INT); // Portal cooldown
wrapper.passthrough(Types.VAR_INT); // Sea level
final boolean onlineMode = wrapper.user().has(Encrypted.class);
wrapper.write(Types.BOOLEAN, onlineMode);
});
}
@Override
protected void registerRewrites() {
final EntityDataTypes26_1 entityDataTypes = protocol.mappedTypes().entityDataTypes();
dataTypeMapper().register();
registerEntityDataTypeHandler(
entityDataTypes.itemType,
entityDataTypes.blockStateType,
entityDataTypes.optionalBlockStateType,
entityDataTypes.particleType,
entityDataTypes.particlesType,
entityDataTypes.componentType,
entityDataTypes.optionalComponentType
);
filter().type(EntityTypes26_2.ABSTRACT_CUBE_MOB).addIndex(16); // baby
filter().type(EntityTypes26_2.ABSTRACT_CUBE_MOB).addIndex(17); // age locked
}
@Override
public EntityType typeFromId(final int type) {
return EntityTypes26_2.getTypeFromId(type);
}
}
@@ -0,0 +1,23 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2026 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.protocols.v26_1to26_2.storage;
import com.viaversion.viaversion.api.connection.StorableObject;
public final class Encrypted implements StorableObject {
}
@@ -256,6 +256,17 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
});
}
public void registerSetCreativeModeSlot1_20_5(S packetType) {
protocol.registerServerbound(packetType, wrapper -> {
if (protocol.getEntityRewriter() != null && !protocol.getEntityRewriter().tracker(wrapper.user()).canInstaBuild()) {
wrapper.cancel();
return;
}
wrapper.passthrough(Types.SHORT); // Slot
wrapper.write(itemType, handleItemToServer(wrapper.user(), wrapper.read(mappedItemType)));
});
}
public void registerContainerClick(S packetType) {
protocol.registerServerbound(packetType, wrapper -> {
wrapper.passthrough(Types.BYTE); // Container ID
@@ -26,9 +26,12 @@ import com.viaversion.viaversion.api.data.FullMappings;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.Mappings;
import com.viaversion.viaversion.api.data.entity.DimensionData;
import com.viaversion.viaversion.api.data.entity.EntityTracker;
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
import com.viaversion.viaversion.api.protocol.Protocol;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.rewriter.ComponentRewriter;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.data.entity.DimensionDataImpl;
@@ -52,7 +55,6 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
private final Map<String, Consumer<CompoundTag>> enchantmentEffectHandlers = new Object2ObjectArrayMap<>(); // for nested enchantment data
private final Map<String, List<RegistryEntry>> toAdd = new Object2ObjectArrayMap<>();
private final Set<String> toRemove = new HashSet<>();
protected final Map<String, KeyMappings> registryKeyMappings = new HashMap<>();
protected final Protocol<?, ?, ?, ?> protocol;
public RegistryDataRewriter(final Protocol<?, ?, ?, ?> protocol) {
@@ -78,7 +80,8 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
for (int i = 0; i < entries.length; i++) {
keys[i] = Key.stripMinecraftNamespace(entries[i].key());
}
this.registryKeyMappings.put(key, new KeyMappings(keys));
protocol.getEntityRewriter().tracker(connection).addRegistryKeys(key, new KeyMappings(keys));
switch (key) {
case "enchantment" -> updateEnchantments(connection, entries);
@@ -141,6 +144,28 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
registryEntryHandlers.put(Key.stripMinecraftNamespace(registryKey), handler);
}
@Override
public void sendMissingRegistries(final UserConnection connection) {
final EntityTracker entityTracker = protocol.getEntityRewriter().tracker(connection);
for (final Map.Entry<String, List<RegistryEntry>> entry : this.toAdd.entrySet()) {
if (entityTracker.registryKeys(entry.getKey()) != null) {
continue;
}
final List<RegistryEntry> toAdd = entry.getValue();
final RegistryEntry[] entries = new RegistryEntry[toAdd.size()];
for (int i = 0; i < toAdd.size(); i++) {
entries[i] = toAdd.get(i).copy();
}
final ClientboundPacketType packetType = protocol.getPacketTypesProvider().mappedClientboundType(State.CONFIGURATION, "REGISTRY_DATA");
final PacketWrapper registryData = PacketWrapper.create(packetType, connection);
registryData.write(Types.STRING, entry.getKey());
registryData.write(Types.REGISTRY_ENTRY_ARRAY, entries);
registryData.send(protocol.getClass());
}
}
public void addEnchantmentEffectRewriter(final String key, final Consumer<CompoundTag> rewriter) {
enchantmentEffectHandlers.put(Key.stripMinecraftNamespace(key), rewriter);
}
@@ -374,24 +399,14 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
}
final CompoundTag requirements = effectsTag.getCompoundTag("requirements");
final ListTag<CompoundTag> terms;
if (requirements != null && (terms = requirements.getListTag("terms", CompoundTag.class)) != null) {
for (final CompoundTag term : terms) {
updateEnchantmentTerm(term);
}
if (requirements != null) {
updateEnchantmentTerm(requirements);
}
}
public void updateEnchantmentTerm(final CompoundTag term) {
final String condition = term.getString("condition");
if (Key.equals(condition, "all_of") || Key.equals(condition, "any_of")) {
final ListTag<CompoundTag> terms = term.getListTag("terms", CompoundTag.class);
if (terms != null) {
for (final CompoundTag childTerm : terms) {
updateEnchantmentTerm(childTerm);
}
}
} else if (Key.equals(condition, "inverted")) {
if (Key.equals(condition, "inverted")) {
final CompoundTag childTerm = term.getCompoundTag("term");
if (childTerm != null) {
updateEnchantmentTerm(childTerm);
@@ -400,9 +415,17 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
final CompoundTag predicate = term.getCompoundTag("predicate");
if (predicate != null) {
updateType(predicate, "type", protocol.getMappingData().getEntityMappings());
updateType(predicate, "entity_type", protocol.getMappingData().getEntityMappings());
}
} else if (Key.equals(condition, "block_state_property")) {
updateType(term, "block", protocol.getMappingData().getFullBlockMappings());
} else {
final ListTag<CompoundTag> terms = term.getListTag("terms", CompoundTag.class);
if (terms != null) {
for (final CompoundTag childTerm : terms) {
updateEnchantmentTerm(childTerm);
}
}
}
}
@@ -463,6 +486,10 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
}
private void setMappedOrDummyId(final FullMappings mappings, final StringTag tag) {
if (Key.stripMinecraftNamespace(tag.getValue()).startsWith("#")) {
return;
}
String mappedType = mappings.mappedIdentifier(tag.getValue());
if (mappedType == null) {
mappedType = mappings.mappedIdentifier(0); // Dummy
@@ -495,15 +522,6 @@ public class RegistryDataRewriter implements com.viaversion.viaversion.api.rewri
return entries;
}
@Override
public @Nullable KeyMappings getMappings(final String registryKey) {
return this.registryKeyMappings.get(Key.stripMinecraftNamespace(registryKey));
}
public Map<String, KeyMappings> registryKeyMappings() {
return registryKeyMappings;
}
@Override
public boolean shouldRemoveRegistry(final String registryKey) {
return this.toRemove.contains(Key.stripMinecraftNamespace(registryKey));
@@ -161,6 +161,22 @@ public abstract class ComponentRewriterBase<C extends ClientboundPacketType> imp
});
}
public void registerSetPlayerTeam26_2(final C packetType) {
protocol.registerClientbound(packetType, wrapper -> {
wrapper.passthrough(Types.STRING); // Team Name
final byte action = wrapper.passthrough(Types.BYTE); // Mode
if (action == 0 || action == 2) {
passthroughAndProcess(wrapper); // Display name
passthroughAndProcess(wrapper); // Prefix
passthroughAndProcess(wrapper); // Suffix
wrapper.passthrough(Types.VAR_INT); // Nametag visibility
wrapper.passthrough(Types.VAR_INT); // Collision rule
wrapper.passthrough(Types.OPTIONAL_VAR_INT); // Color
wrapper.passthrough(Types.BYTE); // Flags
}
});
}
public void registerPlayerInfoUpdate1_21_4(final C packetType) {
protocol.registerClientbound(packetType, wrapper -> {
final BitSet actions = wrapper.passthrough(Types.PROFILE_ACTIONS_ENUM1_21_4);
@@ -44,8 +44,8 @@ import com.viaversion.viaversion.codec.CodecRegistryContext;
import com.viaversion.viaversion.codec.hash.HashFunction;
import com.viaversion.viaversion.codec.hash.HashOps;
import com.viaversion.viaversion.common.PlatformTestBase;
import com.viaversion.viaversion.connection.UserConnectionImpl;
import com.viaversion.viaversion.protocols.v1_21_6to1_21_7.Protocol1_21_6To1_21_7;
import com.viaversion.viaversion.rewriter.RegistryDataRewriter;
import com.viaversion.viaversion.util.KeyMappings;
import com.viaversion.viaversion.util.UUIDUtil;
import org.junit.jupiter.api.Assertions;
@@ -61,8 +61,10 @@ public class ItemHashTest extends PlatformTestBase {
@BeforeAll
static void loadContext() {
final UserConnectionImpl dummyConnection = new UserConnectionImpl(null);
protocol = Via.getManager().getProtocolManager().getProtocol(Protocol1_21_6To1_21_7.class);
context = new CodecRegistryContext(null, CodecContext.RegistryAccess.of(protocol), false);
protocol.init(dummyConnection);
context = new CodecRegistryContext(null, CodecContext.RegistryAccess.of(protocol, dummyConnection), false);
hasher = new HashOps(context, HashFunction.CRC32C);
}
@@ -71,12 +73,6 @@ public class ItemHashTest extends PlatformTestBase {
hasher.reset();
}
private HashOps hasher(final Class<? extends Protocol<?, ?, ?, ?>> protocolClass) {
final Protocol<?, ?, ?, ?> protocol = Via.getManager().getProtocolManager().getProtocol(protocolClass);
final CodecRegistryContext context = new CodecRegistryContext(null, CodecContext.RegistryAccess.of(protocol), false);
return new HashOps(context, HashFunction.CRC32C);
}
@Test
void testNumberAndKey() {
final UseCooldown useCooldown = new UseCooldown(0.5f, ":stick");
@@ -138,7 +134,7 @@ public class ItemHashTest extends PlatformTestBase {
@Test
void testRegistryHolderId() {
((RegistryDataRewriter) protocol.getRegistryDataRewriter()).registryKeyMappings().put("banner_pattern", new KeyMappings("base"));
protocol.getEntityRewriter().tracker(context.connection()).addRegistryKeys("banner_pattern", new KeyMappings("base"));
hasher.write(BannerPatternLayer.ARRAY_TYPE, new BannerPatternLayer[]{new BannerPatternLayer(Holder.of(0), 0)});
Assertions.assertEquals(606382024, hasher.hash(), "banner_pattern hash mismatch");
}
+3 -3
View File
@@ -1,9 +1,9 @@
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
projectVersion=5.9.1
projectVersion=5.10.0
# Smile emoji (note that modrinth may not have added the version on release yet)
mcVersions=26.1.2, 26.1.1, 26.1, 1.21.11, 1.21.10, 1.21.9, 1.21.8, 1.21.7, 1.21.6, 1.21.5, 1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 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, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9
mcVersionRange=1.8-26.1.2
mcVersions=26.2, 26.1.2, 26.1.1, 26.1, 1.21.11, 1.21.10, 1.21.9, 1.21.8, 1.21.7, 1.21.6, 1.21.5, 1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 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, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9
mcVersionRange=1.8-26.2
velocityVersion=3.4-3.5
# Gradle properties
+3 -3
View File
@@ -2,7 +2,7 @@ metadata.format.version = "1.1"
[versions]
gson = "2.13.2"
gson = "2.14.0"
snakeYaml = "2.6"
fastutil = "8.5.15"
vianbt = "5.2.1"
@@ -13,8 +13,8 @@ netty = "4.0.20.Final"
guava = "17.0"
junit = "6.0.3"
platformLauncher = "6.0.3"
checkerQual = "3.54.0"
platformLauncher = "6.1.0"
checkerQual = "4.2.0"
# Platforms
paper = "1.20.4-R0.1-SNAPSHOT"
Binary file not shown.
+4 -2
View File
@@ -1,8 +1,10 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionSha256Sum=bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+1 -1
View File
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Vendored
+10 -21
View File
@@ -23,8 +23,8 @@
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -51,7 +51,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -65,7 +65,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:execute
@rem Setup the command line
@@ -73,21 +73,10 @@ goto fail
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
+1 -1
View File
@@ -14,7 +14,7 @@ dependencyResolutionManagement {
pluginManagement {
// default plugin versions
plugins {
id("com.gradleup.shadow") version "9.4.1"
id("com.gradleup.shadow") version "9.4.2"
id("net.kyori.blossom") version "2.2.0"
id("org.jetbrains.gradle.plugin.idea-ext") version "1.4.1"