Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01:00
Start working on 22w42a
Dieser Commit ist enthalten in:
Ursprung
c5738a2203
Commit
14b11bdd10
@ -42,4 +42,6 @@ public interface BlockEntity {
|
|||||||
int typeId();
|
int typeId();
|
||||||
|
|
||||||
@Nullable CompoundTag tag();
|
@Nullable CompoundTag tag();
|
||||||
|
|
||||||
|
BlockEntity withTypeId(int typeId);
|
||||||
}
|
}
|
||||||
|
@ -56,4 +56,9 @@ public final class BlockEntityImpl implements BlockEntity {
|
|||||||
public CompoundTag tag() {
|
public CompoundTag tag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity withTypeId(int typeId) {
|
||||||
|
return new BlockEntityImpl(packedXZ, y, typeId, tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,275 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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 org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public enum Entity1_19_3Types 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),
|
||||||
|
FIREWORK_ROCKET(ENTITY),
|
||||||
|
ITEM(ENTITY),
|
||||||
|
LLAMA_SPIT(ENTITY),
|
||||||
|
TNT(ENTITY),
|
||||||
|
SHULKER_BULLET(ENTITY),
|
||||||
|
FISHING_BOBBER(ENTITY),
|
||||||
|
|
||||||
|
LIVINGENTITY(ENTITY, null),
|
||||||
|
ARMOR_STAND(LIVINGENTITY),
|
||||||
|
MARKER(ENTITY),
|
||||||
|
PLAYER(LIVINGENTITY),
|
||||||
|
|
||||||
|
ABSTRACT_INSENTIENT(LIVINGENTITY, null),
|
||||||
|
ENDER_DRAGON(ABSTRACT_INSENTIENT),
|
||||||
|
|
||||||
|
BEE(ABSTRACT_INSENTIENT),
|
||||||
|
|
||||||
|
ABSTRACT_CREATURE(ABSTRACT_INSENTIENT, null),
|
||||||
|
|
||||||
|
ABSTRACT_AGEABLE(ABSTRACT_CREATURE, null),
|
||||||
|
VILLAGER(ABSTRACT_AGEABLE),
|
||||||
|
WANDERING_TRADER(ABSTRACT_AGEABLE),
|
||||||
|
|
||||||
|
// Animals
|
||||||
|
ABSTRACT_ANIMAL(ABSTRACT_AGEABLE, null),
|
||||||
|
AXOLOTL(ABSTRACT_ANIMAL),
|
||||||
|
DOLPHIN(ABSTRACT_INSENTIENT),
|
||||||
|
CHICKEN(ABSTRACT_ANIMAL),
|
||||||
|
COW(ABSTRACT_ANIMAL),
|
||||||
|
MOOSHROOM(COW),
|
||||||
|
PANDA(ABSTRACT_INSENTIENT),
|
||||||
|
PIG(ABSTRACT_ANIMAL),
|
||||||
|
POLAR_BEAR(ABSTRACT_ANIMAL),
|
||||||
|
RABBIT(ABSTRACT_ANIMAL),
|
||||||
|
SHEEP(ABSTRACT_ANIMAL),
|
||||||
|
TURTLE(ABSTRACT_ANIMAL),
|
||||||
|
FOX(ABSTRACT_ANIMAL),
|
||||||
|
FROG(ABSTRACT_ANIMAL),
|
||||||
|
GOAT(ABSTRACT_ANIMAL),
|
||||||
|
|
||||||
|
ABSTRACT_TAMEABLE_ANIMAL(ABSTRACT_ANIMAL, null),
|
||||||
|
CAT(ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
|
OCELOT(ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
|
WOLF(ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
|
|
||||||
|
ABSTRACT_PARROT(ABSTRACT_TAMEABLE_ANIMAL, null),
|
||||||
|
PARROT(ABSTRACT_PARROT),
|
||||||
|
|
||||||
|
// Horses
|
||||||
|
ABSTRACT_HORSE(ABSTRACT_ANIMAL, null),
|
||||||
|
CHESTED_HORSE(ABSTRACT_HORSE, null),
|
||||||
|
DONKEY(CHESTED_HORSE),
|
||||||
|
MULE(CHESTED_HORSE),
|
||||||
|
LLAMA(CHESTED_HORSE),
|
||||||
|
TRADER_LLAMA(CHESTED_HORSE),
|
||||||
|
HORSE(ABSTRACT_HORSE),
|
||||||
|
SKELETON_HORSE(ABSTRACT_HORSE),
|
||||||
|
ZOMBIE_HORSE(ABSTRACT_HORSE),
|
||||||
|
CAMEL(ABSTRACT_HORSE),
|
||||||
|
|
||||||
|
// Golem
|
||||||
|
ABSTRACT_GOLEM(ABSTRACT_CREATURE, null),
|
||||||
|
SNOW_GOLEM(ABSTRACT_GOLEM),
|
||||||
|
IRON_GOLEM(ABSTRACT_GOLEM),
|
||||||
|
SHULKER(ABSTRACT_GOLEM),
|
||||||
|
|
||||||
|
// Fish
|
||||||
|
ABSTRACT_FISHES(ABSTRACT_CREATURE, null),
|
||||||
|
COD(ABSTRACT_FISHES),
|
||||||
|
PUFFERFISH(ABSTRACT_FISHES),
|
||||||
|
SALMON(ABSTRACT_FISHES),
|
||||||
|
TROPICAL_FISH(ABSTRACT_FISHES),
|
||||||
|
|
||||||
|
// Monsters
|
||||||
|
ABSTRACT_MONSTER(ABSTRACT_CREATURE, null),
|
||||||
|
BLAZE(ABSTRACT_MONSTER),
|
||||||
|
CREEPER(ABSTRACT_MONSTER),
|
||||||
|
ENDERMITE(ABSTRACT_MONSTER),
|
||||||
|
ENDERMAN(ABSTRACT_MONSTER),
|
||||||
|
GIANT(ABSTRACT_MONSTER),
|
||||||
|
SILVERFISH(ABSTRACT_MONSTER),
|
||||||
|
VEX(ABSTRACT_MONSTER),
|
||||||
|
WITCH(ABSTRACT_MONSTER),
|
||||||
|
WITHER(ABSTRACT_MONSTER),
|
||||||
|
RAVAGER(ABSTRACT_MONSTER),
|
||||||
|
|
||||||
|
ABSTRACT_PIGLIN(ABSTRACT_MONSTER, null),
|
||||||
|
|
||||||
|
PIGLIN(ABSTRACT_PIGLIN),
|
||||||
|
PIGLIN_BRUTE(ABSTRACT_PIGLIN),
|
||||||
|
|
||||||
|
HOGLIN(ABSTRACT_ANIMAL),
|
||||||
|
STRIDER(ABSTRACT_ANIMAL),
|
||||||
|
TADPOLE(ABSTRACT_FISHES),
|
||||||
|
ZOGLIN(ABSTRACT_MONSTER),
|
||||||
|
WARDEN(ABSTRACT_MONSTER),
|
||||||
|
|
||||||
|
// Illagers
|
||||||
|
ABSTRACT_ILLAGER_BASE(ABSTRACT_MONSTER, null),
|
||||||
|
ABSTRACT_EVO_ILLU_ILLAGER(ABSTRACT_ILLAGER_BASE, null),
|
||||||
|
EVOKER(ABSTRACT_EVO_ILLU_ILLAGER),
|
||||||
|
ILLUSIONER(ABSTRACT_EVO_ILLU_ILLAGER),
|
||||||
|
VINDICATOR(ABSTRACT_ILLAGER_BASE),
|
||||||
|
PILLAGER(ABSTRACT_ILLAGER_BASE),
|
||||||
|
|
||||||
|
// Skeletons
|
||||||
|
ABSTRACT_SKELETON(ABSTRACT_MONSTER, null),
|
||||||
|
SKELETON(ABSTRACT_SKELETON),
|
||||||
|
STRAY(ABSTRACT_SKELETON),
|
||||||
|
WITHER_SKELETON(ABSTRACT_SKELETON),
|
||||||
|
|
||||||
|
// Guardians
|
||||||
|
GUARDIAN(ABSTRACT_MONSTER),
|
||||||
|
ELDER_GUARDIAN(GUARDIAN),
|
||||||
|
|
||||||
|
// Spiders
|
||||||
|
SPIDER(ABSTRACT_MONSTER),
|
||||||
|
CAVE_SPIDER(SPIDER),
|
||||||
|
|
||||||
|
// Zombies
|
||||||
|
ZOMBIE(ABSTRACT_MONSTER),
|
||||||
|
DROWNED(ZOMBIE),
|
||||||
|
HUSK(ZOMBIE),
|
||||||
|
ZOMBIFIED_PIGLIN(ZOMBIE),
|
||||||
|
ZOMBIE_VILLAGER(ZOMBIE),
|
||||||
|
|
||||||
|
// Flying entities
|
||||||
|
ABSTRACT_FLYING(ABSTRACT_INSENTIENT, null),
|
||||||
|
GHAST(ABSTRACT_FLYING),
|
||||||
|
PHANTOM(ABSTRACT_FLYING),
|
||||||
|
|
||||||
|
ABSTRACT_AMBIENT(ABSTRACT_INSENTIENT, null),
|
||||||
|
BAT(ABSTRACT_AMBIENT),
|
||||||
|
ALLAY(ABSTRACT_CREATURE),
|
||||||
|
|
||||||
|
ABSTRACT_WATERMOB(ABSTRACT_INSENTIENT, null),
|
||||||
|
SQUID(ABSTRACT_WATERMOB),
|
||||||
|
GLOW_SQUID(SQUID),
|
||||||
|
|
||||||
|
// Slimes
|
||||||
|
SLIME(ABSTRACT_INSENTIENT),
|
||||||
|
MAGMA_CUBE(SLIME),
|
||||||
|
|
||||||
|
// Hangable objects
|
||||||
|
ABSTRACT_HANGING(ENTITY, null),
|
||||||
|
LEASH_KNOT(ABSTRACT_HANGING),
|
||||||
|
ITEM_FRAME(ABSTRACT_HANGING),
|
||||||
|
GLOW_ITEM_FRAME(ITEM_FRAME),
|
||||||
|
PAINTING(ABSTRACT_HANGING),
|
||||||
|
|
||||||
|
ABSTRACT_LIGHTNING(ENTITY, null),
|
||||||
|
LIGHTNING_BOLT(ABSTRACT_LIGHTNING),
|
||||||
|
|
||||||
|
// Arrows
|
||||||
|
ABSTRACT_ARROW(ENTITY, null),
|
||||||
|
ARROW(ABSTRACT_ARROW),
|
||||||
|
SPECTRAL_ARROW(ABSTRACT_ARROW),
|
||||||
|
TRIDENT(ABSTRACT_ARROW),
|
||||||
|
|
||||||
|
// Fireballs
|
||||||
|
ABSTRACT_FIREBALL(ENTITY, null),
|
||||||
|
DRAGON_FIREBALL(ABSTRACT_FIREBALL),
|
||||||
|
FIREBALL(ABSTRACT_FIREBALL),
|
||||||
|
SMALL_FIREBALL(ABSTRACT_FIREBALL),
|
||||||
|
WITHER_SKULL(ABSTRACT_FIREBALL),
|
||||||
|
|
||||||
|
// Projectiles
|
||||||
|
PROJECTILE_ABSTRACT(ENTITY, null),
|
||||||
|
SNOWBALL(PROJECTILE_ABSTRACT),
|
||||||
|
ENDER_PEARL(PROJECTILE_ABSTRACT),
|
||||||
|
EGG(PROJECTILE_ABSTRACT),
|
||||||
|
POTION(PROJECTILE_ABSTRACT),
|
||||||
|
EXPERIENCE_BOTTLE(PROJECTILE_ABSTRACT),
|
||||||
|
|
||||||
|
// Vehicles
|
||||||
|
MINECART_ABSTRACT(ENTITY, null),
|
||||||
|
CHESTED_MINECART_ABSTRACT(MINECART_ABSTRACT, null),
|
||||||
|
CHEST_MINECART(CHESTED_MINECART_ABSTRACT),
|
||||||
|
HOPPER_MINECART(CHESTED_MINECART_ABSTRACT),
|
||||||
|
MINECART(MINECART_ABSTRACT),
|
||||||
|
FURNACE_MINECART(MINECART_ABSTRACT),
|
||||||
|
COMMAND_BLOCK_MINECART(MINECART_ABSTRACT),
|
||||||
|
TNT_MINECART(MINECART_ABSTRACT),
|
||||||
|
SPAWNER_MINECART(MINECART_ABSTRACT),
|
||||||
|
BOAT(ENTITY),
|
||||||
|
CHEST_BOAT(BOAT);
|
||||||
|
|
||||||
|
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
|
||||||
|
private final EntityType parent;
|
||||||
|
private final String identifier;
|
||||||
|
private int id = -1;
|
||||||
|
|
||||||
|
Entity1_19_3Types(final EntityType parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity1_19_3Types(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, ENTITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initialize(final Protocol<?, ?, ?, ?> protocol) {
|
||||||
|
EntityTypeUtil.initialize(values(), TYPES, protocol, (type, id) -> type.id = id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.metadata.types;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
||||||
|
|
||||||
|
public final class MetaTypes1_19_3 extends AbstractMetaTypes {
|
||||||
|
|
||||||
|
public final MetaType byteType = add(0, Type.BYTE);
|
||||||
|
public final MetaType varIntType = add(1, Type.VAR_INT);
|
||||||
|
public final MetaType longType = add(2, Type.LONG);
|
||||||
|
public final MetaType floatType = add(3, Type.FLOAT);
|
||||||
|
public final MetaType stringType = add(4, Type.STRING);
|
||||||
|
public final MetaType componentType = add(5, Type.COMPONENT);
|
||||||
|
public final MetaType optionalComponentType = add(6, Type.OPTIONAL_COMPONENT);
|
||||||
|
public final MetaType itemType = add(7, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
public final MetaType booleanType = add(8, Type.BOOLEAN);
|
||||||
|
public final MetaType rotationType = add(9, Type.ROTATION);
|
||||||
|
public final MetaType positionType = add(10, Type.POSITION1_14);
|
||||||
|
public final MetaType optionalPositionType = add(11, Type.OPTIONAL_POSITION_1_14);
|
||||||
|
public final MetaType directionType = add(12, Type.VAR_INT);
|
||||||
|
public final MetaType optionalUUIDType = add(13, Type.OPTIONAL_UUID);
|
||||||
|
public final MetaType blockStateType = add(14, Type.VAR_INT);
|
||||||
|
public final MetaType nbtType = add(15, Type.NBT);
|
||||||
|
public final MetaType particleType;
|
||||||
|
public final MetaType villagerDatatType = add(17, Type.VILLAGER_DATA);
|
||||||
|
public final MetaType optionalVarIntType = add(18, Type.OPTIONAL_VAR_INT);
|
||||||
|
public final MetaType poseType = add(19, Type.VAR_INT);
|
||||||
|
public final MetaType catVariantType = add(20, Type.VAR_INT);
|
||||||
|
public final MetaType frogVariantType = add(21, Type.VAR_INT);
|
||||||
|
public final MetaType optionalGlobalPosition = add(22, Type.OPTIONAL_GLOBAL_POSITION);
|
||||||
|
public final MetaType paintingVariantType = add(23, Type.VAR_INT);
|
||||||
|
|
||||||
|
public MetaTypes1_19_3(final ParticleType particleType) {
|
||||||
|
super(24);
|
||||||
|
this.particleType = add(16, particleType);
|
||||||
|
}
|
||||||
|
}
|
@ -82,6 +82,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
||||||
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
||||||
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
public static final ProtocolVersion v1_19_1 = register(760, "1.19.1/2", new VersionRange("1.19", 1, 2));
|
||||||
|
public static final ProtocolVersion v1_19_3 = register(761, 104, "1.19.3");
|
||||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||||
|
|
||||||
public static ProtocolVersion register(int version, String name) {
|
public static ProtocolVersion register(int version, String name) {
|
||||||
|
@ -87,6 +87,7 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
|
|||||||
public static final ByteType BYTE = new ByteType();
|
public static final ByteType BYTE = new ByteType();
|
||||||
public static final UnsignedByteType UNSIGNED_BYTE = new UnsignedByteType();
|
public static final UnsignedByteType UNSIGNED_BYTE = new UnsignedByteType();
|
||||||
public static final Type<byte[]> BYTE_ARRAY_PRIMITIVE = new ByteArrayType();
|
public static final Type<byte[]> BYTE_ARRAY_PRIMITIVE = new ByteArrayType();
|
||||||
|
public static final Type<byte[]> OPTIONAL_BYTE_ARRAY_PRIMITIVE = new ByteArrayType.OptionalByteArrayType();
|
||||||
public static final Type<byte[]> SHORT_BYTE_ARRAY = new ShortByteArrayType();
|
public static final Type<byte[]> SHORT_BYTE_ARRAY = new ShortByteArrayType();
|
||||||
public static final Type<byte[]> REMAINING_BYTES = new RemainingBytesType();
|
public static final Type<byte[]> REMAINING_BYTES = new RemainingBytesType();
|
||||||
|
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.type.types;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.BitSet;
|
||||||
|
|
||||||
|
public class BitSetType extends Type<BitSet> {
|
||||||
|
|
||||||
|
private final int length;
|
||||||
|
private final int bytesLength;
|
||||||
|
|
||||||
|
public BitSetType(final int length) {
|
||||||
|
super(BitSet.class);
|
||||||
|
this.length = length;
|
||||||
|
this.bytesLength = -Math.floorDiv(-length, 8); // Ceiled quotient
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BitSet read(ByteBuf buffer) {
|
||||||
|
final byte[] bytes = new byte[bytesLength];
|
||||||
|
buffer.readBytes(bytes);
|
||||||
|
return BitSet.valueOf(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buffer, BitSet object) {
|
||||||
|
Preconditions.checkArgument(object.length() <= length, "BitSet of length " + object.length() + " larger than max length " + length);
|
||||||
|
final byte[] bytes = object.toByteArray();
|
||||||
|
buffer.writeBytes(Arrays.copyOf(bytes, bytesLength));
|
||||||
|
}
|
||||||
|
}
|
@ -23,16 +23,27 @@
|
|||||||
package com.viaversion.viaversion.api.type.types;
|
package com.viaversion.viaversion.api.type.types;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.viaversion.viaversion.api.type.OptionalType;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
public class ByteArrayType extends Type<byte[]> {
|
public class ByteArrayType extends Type<byte[]> {
|
||||||
|
|
||||||
|
private final int length;
|
||||||
|
|
||||||
|
public ByteArrayType(final int length) {
|
||||||
|
super(byte[].class);
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
|
|
||||||
public ByteArrayType() {
|
public ByteArrayType() {
|
||||||
super(byte[].class);
|
super(byte[].class);
|
||||||
|
this.length = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buffer, byte[] object) throws Exception {
|
public void write(ByteBuf buffer, byte[] object) throws Exception {
|
||||||
|
Preconditions.checkArgument(length == -1 || length == object.length, "Length does not match expected length");
|
||||||
Type.VAR_INT.writePrimitive(buffer, object.length);
|
Type.VAR_INT.writePrimitive(buffer, object.length);
|
||||||
buffer.writeBytes(object);
|
buffer.writeBytes(object);
|
||||||
}
|
}
|
||||||
@ -41,8 +52,16 @@ public class ByteArrayType extends Type<byte[]> {
|
|||||||
public byte[] read(ByteBuf buffer) throws Exception {
|
public byte[] read(ByteBuf buffer) throws Exception {
|
||||||
int length = Type.VAR_INT.readPrimitive(buffer);
|
int length = Type.VAR_INT.readPrimitive(buffer);
|
||||||
Preconditions.checkArgument(buffer.isReadable(length), "Length is fewer than readable bytes");
|
Preconditions.checkArgument(buffer.isReadable(length), "Length is fewer than readable bytes");
|
||||||
|
Preconditions.checkArgument(this.length == -1 || this.length == length, "Length does not match expected length");
|
||||||
byte[] array = new byte[length];
|
byte[] array = new byte[length];
|
||||||
buffer.readBytes(array);
|
buffer.readBytes(array);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class OptionalByteArrayType extends OptionalType<byte[]> {
|
||||||
|
|
||||||
|
public OptionalByteArrayType() {
|
||||||
|
super(Type.BYTE_ARRAY_PRIMITIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.type.types.version;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_3;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.types.minecraft.MetaListType;
|
||||||
|
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class Types1_19_3 {
|
||||||
|
|
||||||
|
public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading
|
||||||
|
public static final MetaTypes1_19_3 META_TYPES = new MetaTypes1_19_3(PARTICLE);
|
||||||
|
public static final Type<Metadata> METADATA = new MetadataType(META_TYPES);
|
||||||
|
public static final Type<List<Metadata>> METADATA_LIST = new MetaListType(METADATA);
|
||||||
|
}
|
@ -68,6 +68,7 @@ import com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To
|
|||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.Protocol1_19_1To1_19;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2;
|
||||||
@ -176,6 +177,8 @@ public class ProtocolManagerImpl implements ProtocolManager {
|
|||||||
|
|
||||||
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18_2);
|
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18_2);
|
||||||
registerProtocol(new Protocol1_19_1To1_19(), ProtocolVersion.v1_19_1, ProtocolVersion.v1_19);
|
registerProtocol(new Protocol1_19_1To1_19(), ProtocolVersion.v1_19_1, ProtocolVersion.v1_19);
|
||||||
|
|
||||||
|
registerProtocol(new Protocol1_19_3To1_19_1(), ProtocolVersion.v1_19_3, ProtocolVersion.v1_19_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ public class InventoryPackets extends ItemRewriter<Protocol1_15To1_14_4> {
|
|||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerSetCooldown(ClientboundPackets1_14.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_14.COOLDOWN);
|
||||||
registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
registerWindowItems(ClientboundPackets1_14.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
registerTradeList(ClientboundPackets1_14.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
registerTradeList(ClientboundPackets1_14.TRADE_LIST);
|
||||||
registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot(ClientboundPackets1_14.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerEntityEquipment(ClientboundPackets1_14.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
registerEntityEquipment(ClientboundPackets1_14.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerAdvancements(ClientboundPackets1_14.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_14.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
@ -35,9 +35,9 @@ public class InventoryPackets extends ItemRewriter<Protocol1_16_2To1_16_1> {
|
|||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerSetCooldown(ClientboundPackets1_16.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_16.COOLDOWN);
|
||||||
registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
registerWindowItems(ClientboundPackets1_16.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
registerTradeList(ClientboundPackets1_16.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
registerTradeList(ClientboundPackets1_16.TRADE_LIST);
|
||||||
registerSetSlot(ClientboundPackets1_16.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot(ClientboundPackets1_16.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerEntityEquipmentArray(ClientboundPackets1_16.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
registerEntityEquipmentArray(ClientboundPackets1_16.ENTITY_EQUIPMENT);
|
||||||
registerAdvancements(ClientboundPackets1_16.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_16.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_16.UNLOCK_RECIPES, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_16.UNLOCK_RECIPES, new PacketRemapper() {
|
||||||
|
@ -109,7 +109,7 @@ public class InventoryPackets extends ItemRewriter<Protocol1_16To1_15_2> {
|
|||||||
|
|
||||||
registerSetCooldown(ClientboundPackets1_15.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_15.COOLDOWN);
|
||||||
registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
registerWindowItems(ClientboundPackets1_15.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
registerTradeList(ClientboundPackets1_15.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
registerTradeList(ClientboundPackets1_15.TRADE_LIST);
|
||||||
registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot(ClientboundPackets1_15.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_15.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_17To1_16_4> {
|
|||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
|
||||||
registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
|
||||||
registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
registerTradeList(ClientboundPackets1_16_2.TRADE_LIST);
|
||||||
registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT);
|
||||||
registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
||||||
|
|
||||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
|
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
|
||||||
|
@ -35,11 +35,11 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_18To1_17_1> {
|
|||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerSetCooldown(ClientboundPackets1_17_1.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_17_1.COOLDOWN);
|
||||||
registerWindowItems1_17_1(ClientboundPackets1_17_1.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, Type.FLAT_VAR_INT_ITEM);
|
registerWindowItems1_17_1(ClientboundPackets1_17_1.WINDOW_ITEMS);
|
||||||
registerTradeList(ClientboundPackets1_17_1.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
|
registerTradeList(ClientboundPackets1_17_1.TRADE_LIST);
|
||||||
registerSetSlot1_17_1(ClientboundPackets1_17_1.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot1_17_1(ClientboundPackets1_17_1.SET_SLOT);
|
||||||
registerAdvancements(ClientboundPackets1_17_1.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_17_1.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerEntityEquipmentArray(ClientboundPackets1_17_1.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
registerEntityEquipmentArray(ClientboundPackets1_17_1.ENTITY_EQUIPMENT);
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_17_1.EFFECT, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_17_1.EFFECT, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
@ -99,7 +99,7 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_18To1_17_1> {
|
|||||||
|
|
||||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17_1.DECLARE_RECIPES);
|
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17_1.DECLARE_RECIPES);
|
||||||
|
|
||||||
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW);
|
||||||
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
|
|
||||||
|
public enum ClientboundPackets1_19_3 implements ClientboundPacketType {
|
||||||
|
|
||||||
|
SPAWN_ENTITY, // 0x00
|
||||||
|
SPAWN_EXPERIENCE_ORB, // 0x01
|
||||||
|
SPAWN_PLAYER, // 0x02
|
||||||
|
ENTITY_ANIMATION, // 0x03
|
||||||
|
STATISTICS, // 0x04
|
||||||
|
BLOCK_CHANGED_ACK, // 0x05
|
||||||
|
BLOCK_BREAK_ANIMATION, // 0x06
|
||||||
|
BLOCK_ENTITY_DATA, // 0x07
|
||||||
|
BLOCK_ACTION, // 0x08
|
||||||
|
BLOCK_CHANGE, // 0x09
|
||||||
|
BOSSBAR, // 0x0A
|
||||||
|
SERVER_DIFFICULTY, // 0x0B
|
||||||
|
CLEAR_TITLES, // 0x0D
|
||||||
|
TAB_COMPLETE, // 0x0E
|
||||||
|
DECLARE_COMMANDS, // 0x0F
|
||||||
|
CLOSE_WINDOW, // 0x10
|
||||||
|
WINDOW_ITEMS, // 0x11
|
||||||
|
WINDOW_PROPERTY, // 0x12
|
||||||
|
SET_SLOT, // 0x13
|
||||||
|
COOLDOWN, // 0x14
|
||||||
|
CUSTOM_CHAT_COMPLETIONS, // 0x15
|
||||||
|
PLUGIN_MESSAGE, // 0x16
|
||||||
|
NAMED_SOUND, // 0x17
|
||||||
|
DELETE_CHAT_MESSAGE, // 0x18
|
||||||
|
DISCONNECT, // 0x19
|
||||||
|
DISGUISED_CHAT,
|
||||||
|
ENTITY_STATUS, // 0x1A
|
||||||
|
EXPLOSION, // 0x1B
|
||||||
|
UNLOAD_CHUNK, // 0x1C
|
||||||
|
GAME_EVENT, // 0x1D
|
||||||
|
OPEN_HORSE_WINDOW, // 0x1E
|
||||||
|
WORLD_BORDER_INIT, // 0x1F
|
||||||
|
KEEP_ALIVE, // 0x20
|
||||||
|
CHUNK_DATA, // 0x21
|
||||||
|
EFFECT, // 0x22
|
||||||
|
SPAWN_PARTICLE, // 0x23
|
||||||
|
UPDATE_LIGHT, // 0x24
|
||||||
|
JOIN_GAME, // 0x25
|
||||||
|
MAP_DATA, // 0x26
|
||||||
|
TRADE_LIST, // 0x27
|
||||||
|
ENTITY_POSITION, // 0x28
|
||||||
|
ENTITY_POSITION_AND_ROTATION, // 0x29
|
||||||
|
ENTITY_ROTATION, // 0x2A
|
||||||
|
VEHICLE_MOVE, // 0x2B
|
||||||
|
OPEN_BOOK, // 0x2C
|
||||||
|
OPEN_WINDOW, // 0x2D
|
||||||
|
OPEN_SIGN_EDITOR, // 0x2E
|
||||||
|
PING, // 0x2F
|
||||||
|
CRAFT_RECIPE_RESPONSE, // 0x30
|
||||||
|
PLAYER_ABILITIES, // 0x31
|
||||||
|
PLAYER_CHAT, // 0x33
|
||||||
|
COMBAT_END, // 0x34
|
||||||
|
COMBAT_ENTER, // 0x35
|
||||||
|
COMBAT_KILL, // 0x36
|
||||||
|
PLAYER_INFO_REMOVE, // 0x37
|
||||||
|
PLAYER_INFO_UPDATE,
|
||||||
|
FACE_PLAYER, // 0x38
|
||||||
|
PLAYER_POSITION, // 0x39
|
||||||
|
UNLOCK_RECIPES, // 0x3A
|
||||||
|
REMOVE_ENTITIES, // 0x3B
|
||||||
|
REMOVE_ENTITY_EFFECT, // 0x3C
|
||||||
|
RESOURCE_PACK, // 0x3D
|
||||||
|
RESPAWN, // 0x3E
|
||||||
|
ENTITY_HEAD_LOOK, // 0x3F
|
||||||
|
MULTI_BLOCK_CHANGE, // 0x40
|
||||||
|
SELECT_ADVANCEMENTS_TAB, // 0x41
|
||||||
|
SERVER_DATA, // 0x42
|
||||||
|
ACTIONBAR, // 0x43
|
||||||
|
WORLD_BORDER_CENTER, // 0x44
|
||||||
|
WORLD_BORDER_LERP_SIZE, // 0x45
|
||||||
|
WORLD_BORDER_SIZE, // 0x46
|
||||||
|
WORLD_BORDER_WARNING_DELAY, // 0x47
|
||||||
|
WORLD_BORDER_WARNING_DISTANCE, // 0x48
|
||||||
|
CAMERA, // 0x49
|
||||||
|
HELD_ITEM_CHANGE, // 0x4A
|
||||||
|
UPDATE_VIEW_POSITION, // 0x4B
|
||||||
|
UPDATE_VIEW_DISTANCE, // 0x4C
|
||||||
|
SPAWN_POSITION, // 0x4D
|
||||||
|
DISPLAY_SCOREBOARD, // 0x4F
|
||||||
|
ENTITY_METADATA, // 0x50
|
||||||
|
ATTACH_ENTITY, // 0x51
|
||||||
|
ENTITY_VELOCITY, // 0x52
|
||||||
|
ENTITY_EQUIPMENT, // 0x53
|
||||||
|
SET_EXPERIENCE, // 0x54
|
||||||
|
UPDATE_HEALTH, // 0x55
|
||||||
|
SCOREBOARD_OBJECTIVE, // 0x56
|
||||||
|
SET_PASSENGERS, // 0x57
|
||||||
|
TEAMS, // 0x58
|
||||||
|
UPDATE_SCORE, // 0x59
|
||||||
|
SET_SIMULATION_DISTANCE, // 0x5A
|
||||||
|
TITLE_SUBTITLE, // 0x5B
|
||||||
|
TIME_UPDATE, // 0x5C
|
||||||
|
TITLE_TEXT, // 0x5D
|
||||||
|
TITLE_TIMES, // 0x5E
|
||||||
|
ENTITY_SOUND, // 0x5F
|
||||||
|
SOUND, // 0x60
|
||||||
|
STOP_SOUND, // 0x61
|
||||||
|
SYSTEM_CHAT, // 0x62
|
||||||
|
TAB_LIST, // 0x63
|
||||||
|
NBT_QUERY, // 0x64
|
||||||
|
COLLECT_ITEM, // 0x65
|
||||||
|
ENTITY_TELEPORT, // 0x66
|
||||||
|
ADVANCEMENTS, // 0x67
|
||||||
|
ENTITY_PROPERTIES, // 0x68
|
||||||
|
UPDATE_ENABLED_FEATURES,
|
||||||
|
ENTITY_EFFECT, // 0x69
|
||||||
|
DECLARE_RECIPES, // 0x6A
|
||||||
|
TAGS; // 0x6B
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,342 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
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.PlayerMessageSignature;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||||
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||||
|
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.types.BitSetType;
|
||||||
|
import com.viaversion.viaversion.api.type.types.ByteArrayType;
|
||||||
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
|
import com.viaversion.viaversion.libs.kyori.adventure.text.Component;
|
||||||
|
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.EntityPackets;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.packets.InventoryPackets;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.storage.ReceivedMessagesStorage;
|
||||||
|
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
|
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public final class Protocol1_19_3To1_19_1 extends AbstractProtocol<ClientboundPackets1_19_1, ClientboundPackets1_19_3, ServerboundPackets1_19_1, ServerboundPackets1_19_3> {
|
||||||
|
|
||||||
|
public static final MappingData MAPPINGS = new MappingDataBase("1.19", "1.19.3", true);
|
||||||
|
private static final BitSetType PROFILE_ACTIONS_ENUM_TYPE = new BitSetType(5);
|
||||||
|
private static final ByteArrayType MESSAGE_SIGNATURE_BYTES_TYPE = new ByteArrayType(256);
|
||||||
|
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||||
|
private static final byte[] EMPTY_BYTES = new byte[0];
|
||||||
|
private final EntityPackets entityRewriter = new EntityPackets(this);
|
||||||
|
private final InventoryPackets itemRewriter = new InventoryPackets(this);
|
||||||
|
|
||||||
|
public Protocol1_19_3To1_19_1() {
|
||||||
|
super(ClientboundPackets1_19_1.class, ClientboundPackets1_19_3.class, ServerboundPackets1_19_1.class, ServerboundPackets1_19_3.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerPackets() {
|
||||||
|
// TODO login probably fucked
|
||||||
|
// TODO entities
|
||||||
|
// TODO packet enum ids
|
||||||
|
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||||
|
tagRewriter.registerGeneric(ClientboundPackets1_19_1.TAGS);
|
||||||
|
|
||||||
|
entityRewriter.register();
|
||||||
|
itemRewriter.register();
|
||||||
|
|
||||||
|
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||||
|
soundRewriter.registerSound(ClientboundPackets1_19_1.SOUND);
|
||||||
|
soundRewriter.registerSound(ClientboundPackets1_19_1.ENTITY_SOUND);
|
||||||
|
|
||||||
|
new StatisticsRewriter(this).register(ClientboundPackets1_19_1.STATISTICS);
|
||||||
|
|
||||||
|
final CommandRewriter commandRewriter = new CommandRewriter(this);
|
||||||
|
registerClientbound(ClientboundPackets1_19_1.DECLARE_COMMANDS, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int size = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
final byte flags = wrapper.passthrough(Type.BYTE);
|
||||||
|
wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE); // Children indices
|
||||||
|
if ((flags & 0x08) != 0) {
|
||||||
|
wrapper.passthrough(Type.VAR_INT); // Redirect node index
|
||||||
|
}
|
||||||
|
|
||||||
|
final int nodeType = flags & 0x03;
|
||||||
|
if (nodeType == 1 || nodeType == 2) { // Literal/argument node
|
||||||
|
wrapper.passthrough(Type.STRING); // Name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeType == 2) { // Argument node
|
||||||
|
final int argumentTypeId = wrapper.read(Type.VAR_INT);
|
||||||
|
final int mappedArgumentTypeId = MAPPINGS.getArgumentTypeMappings().mappings().getNewId(argumentTypeId);
|
||||||
|
Preconditions.checkArgument(mappedArgumentTypeId != -1, "Unknown command argument type id: " + argumentTypeId);
|
||||||
|
wrapper.write(Type.VAR_INT, mappedArgumentTypeId);
|
||||||
|
|
||||||
|
final String identifier = MAPPINGS.getArgumentTypeMappings().identifier(argumentTypeId);
|
||||||
|
commandRewriter.handleArgument(wrapper, identifier);
|
||||||
|
switch (identifier) {
|
||||||
|
case "minecraft:item_enchantment":
|
||||||
|
wrapper.write(Type.STRING, "minecraft:enchantment");
|
||||||
|
break;
|
||||||
|
case "minecraft:mob_effect":
|
||||||
|
wrapper.write(Type.STRING, "minecraft:mob_effect");
|
||||||
|
break;
|
||||||
|
case "minecraft:entity_summon":
|
||||||
|
wrapper.write(Type.STRING, "minecraft:entity_type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & 0x10) != 0) {
|
||||||
|
wrapper.passthrough(Type.STRING); // Suggestion type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.passthrough(Type.VAR_INT); // Root node index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerClientbound(ClientboundPackets1_19_1.PLAYER_INFO, ClientboundPackets1_19_3.PLAYER_INFO_UPDATE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int action = wrapper.read(Type.VAR_INT);
|
||||||
|
if (action == 4) { // Remove player
|
||||||
|
// Write into new packet type
|
||||||
|
final int entries = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
final UUID[] uuidsToRemove = new UUID[entries];
|
||||||
|
for (int i = 0; i < entries; i++) {
|
||||||
|
uuidsToRemove[i] = wrapper.read(Type.UUID);
|
||||||
|
}
|
||||||
|
wrapper.write(Type.UUID_ARRAY, uuidsToRemove);
|
||||||
|
wrapper.setPacketType(ClientboundPackets1_19_3.PLAYER_INFO_REMOVE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final BitSet set = new BitSet(5);
|
||||||
|
if (action == 0) {
|
||||||
|
// Includes profile key, gamemode, latency, and display name update - also update listed
|
||||||
|
set.set(0, 5);
|
||||||
|
} else {
|
||||||
|
// Update listed added at 3, initialize chat added at index 1
|
||||||
|
set.set(action > 2 ? action + 2 : action + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(PROFILE_ACTIONS_ENUM_TYPE, set);
|
||||||
|
final int entries = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < entries; i++) {
|
||||||
|
wrapper.passthrough(Type.UUID); // UUID
|
||||||
|
if (action == 0) { // Add player
|
||||||
|
wrapper.passthrough(Type.STRING); // Player Name
|
||||||
|
|
||||||
|
final int properties = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
for (int j = 0; j < properties; j++) {
|
||||||
|
wrapper.passthrough(Type.STRING); // Name
|
||||||
|
wrapper.passthrough(Type.STRING); // Value
|
||||||
|
if (wrapper.passthrough(Type.BOOLEAN)) {
|
||||||
|
wrapper.passthrough(Type.STRING); // Signature
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final int gamemode = wrapper.read(Type.VAR_INT);
|
||||||
|
final int ping = wrapper.read(Type.VAR_INT);
|
||||||
|
final JsonElement displayName = wrapper.passthrough(Type.BOOLEAN) ? wrapper.read(Type.COMPONENT) : null;
|
||||||
|
final ProfileKey profileKey = wrapper.read(Type.OPTIONAL_PROFILE_KEY);
|
||||||
|
|
||||||
|
// Salvage signed chat
|
||||||
|
wrapper.write(Type.UUID, UUID.randomUUID());
|
||||||
|
wrapper.write(Type.OPTIONAL_PROFILE_KEY, profileKey);
|
||||||
|
|
||||||
|
wrapper.write(Type.VAR_INT, gamemode);
|
||||||
|
wrapper.write(Type.BOOLEAN, true); // Also update listed
|
||||||
|
wrapper.write(Type.VAR_INT, ping);
|
||||||
|
wrapper.write(Type.OPTIONAL_COMPONENT, displayName);
|
||||||
|
} else if (action == 1 || action == 2) { // Update gamemode/update latency
|
||||||
|
wrapper.passthrough(Type.VAR_INT);
|
||||||
|
} else if (action == 3) { // Update display name
|
||||||
|
final JsonElement displayName = wrapper.passthrough(Type.BOOLEAN) ? wrapper.read(Type.COMPONENT) : null;
|
||||||
|
wrapper.write(Type.OPTIONAL_COMPONENT, displayName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registerClientbound(ClientboundPackets1_19_1.SERVER_DATA, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.OPTIONAL_COMPONENT); // Motd
|
||||||
|
map(Type.OPTIONAL_STRING); // Encoded icon
|
||||||
|
read(Type.BOOLEAN); // Remove previews chat
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Aaaaand once more
|
||||||
|
registerClientbound(ClientboundPackets1_19_1.PLAYER_CHAT, ClientboundPackets1_19_3.DISGUISED_CHAT, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
read(Type.OPTIONAL_BYTE_ARRAY_PRIMITIVE); // Previous signature
|
||||||
|
handler(wrapper -> {
|
||||||
|
final PlayerMessageSignature signature = wrapper.read(Type.PLAYER_MESSAGE_SIGNATURE);
|
||||||
|
|
||||||
|
final String plainText = wrapper.read(Type.STRING);
|
||||||
|
JsonElement component = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||||
|
final JsonElement unsignedComponent = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||||
|
if (unsignedComponent != null) {
|
||||||
|
component = unsignedComponent;
|
||||||
|
}
|
||||||
|
if (component == null) {
|
||||||
|
component = GsonComponentSerializer.gson().serializeToTree(Component.text(plainText));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Store message signature for last seen
|
||||||
|
if (!signature.uuid().equals(ZERO_UUID) && signature.signatureBytes().length != 0) {
|
||||||
|
final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class);
|
||||||
|
messagesStorage.add(signature);
|
||||||
|
if (messagesStorage.tickUnacknowledged() > 64) {
|
||||||
|
messagesStorage.resetUnacknowledgedCount();
|
||||||
|
|
||||||
|
// Send chat acknowledgement
|
||||||
|
final PacketWrapper chatAckPacket = wrapper.create(ServerboundPackets1_19_1.CHAT_ACK);
|
||||||
|
chatAckPacket.write(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY, messagesStorage.lastSignatures());
|
||||||
|
chatAckPacket.write(Type.OPTIONAL_PLAYER_MESSAGE_SIGNATURE, null);
|
||||||
|
chatAckPacket.sendToServer(Protocol1_19_3To1_19_1.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wrapper.read(Type.LONG); // Timestamp
|
||||||
|
wrapper.read(Type.LONG); // Salt
|
||||||
|
wrapper.read(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY); // Last seen
|
||||||
|
final int filterMaskType = wrapper.read(Type.VAR_INT);
|
||||||
|
if (filterMaskType == 2) { // Partially filtered
|
||||||
|
wrapper.read(Type.LONG_ARRAY_PRIMITIVE); // Mask
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(Type.COMPONENT, component);
|
||||||
|
// Keep chat type at the end
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(ServerboundPackets1_19_3.CHAT_COMMAND, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Command
|
||||||
|
map(Type.LONG); // Timestamp
|
||||||
|
map(Type.LONG); // Salt
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int signatures = wrapper.passthrough(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < signatures; i++) {
|
||||||
|
wrapper.passthrough(Type.STRING); // Argument name
|
||||||
|
final byte[] signature = wrapper.read(MESSAGE_SIGNATURE_BYTES_TYPE);
|
||||||
|
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature);
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(Type.BOOLEAN, false); // No signed preview
|
||||||
|
|
||||||
|
final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class);
|
||||||
|
messagesStorage.resetUnacknowledgedCount();
|
||||||
|
wrapper.write(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY, messagesStorage.lastSignatures());
|
||||||
|
wrapper.write(Type.OPTIONAL_PLAYER_MESSAGE_SIGNATURE, null); // No last unacknowledged
|
||||||
|
});
|
||||||
|
read(Type.VAR_INT); // Offset
|
||||||
|
read(new BitSetType(20)); // Acknowledged
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registerServerbound(ServerboundPackets1_19_3.CHAT_MESSAGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Command
|
||||||
|
map(Type.LONG); // Timestamp
|
||||||
|
map(Type.LONG); // Salt
|
||||||
|
handler(wrapper -> {
|
||||||
|
final byte[] signature = wrapper.read(Type.BOOLEAN) ? wrapper.read(MESSAGE_SIGNATURE_BYTES_TYPE) : null;
|
||||||
|
wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, signature != null ? signature : EMPTY_BYTES);
|
||||||
|
wrapper.write(Type.BOOLEAN, false); // No signed preview
|
||||||
|
|
||||||
|
final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class);
|
||||||
|
messagesStorage.resetUnacknowledgedCount();
|
||||||
|
wrapper.write(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY, messagesStorage.lastSignatures());
|
||||||
|
wrapper.write(Type.OPTIONAL_PLAYER_MESSAGE_SIGNATURE, null); // No last unacknowledged
|
||||||
|
});
|
||||||
|
read(Type.VAR_INT); // Offset
|
||||||
|
read(new BitSetType(20)); // Acknowledged
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Name
|
||||||
|
read(Type.UUID); // Session UUID
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelClientbound(ClientboundPackets1_19_1.DELETE_CHAT_MESSAGE);
|
||||||
|
cancelClientbound(ClientboundPackets1_19_1.PLAYER_CHAT_HEADER);
|
||||||
|
cancelClientbound(ClientboundPackets1_19_1.CHAT_PREVIEW);
|
||||||
|
cancelClientbound(ClientboundPackets1_19_1.SET_DISPLAY_CHAT_PREVIEW);
|
||||||
|
cancelServerbound(ServerboundPackets1_19_3.CHAT_ACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMappingDataLoaded() {
|
||||||
|
entityRewriter.onMappingDataLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final UserConnection user) {
|
||||||
|
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MappingData getMappingData() {
|
||||||
|
return MAPPINGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityRewriter getEntityRewriter() {
|
||||||
|
return entityRewriter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemRewriter getItemRewriter() {
|
||||||
|
return itemRewriter;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
|
|
||||||
|
public enum ServerboundPackets1_19_3 implements ServerboundPacketType {
|
||||||
|
|
||||||
|
TELEPORT_CONFIRM, // 0x00
|
||||||
|
QUERY_BLOCK_NBT, // 0x01
|
||||||
|
SET_DIFFICULTY, // 0x02
|
||||||
|
CHAT_ACK, // 0x03
|
||||||
|
CHAT_COMMAND, // 0x04
|
||||||
|
CHAT_MESSAGE, // 0x05
|
||||||
|
CLIENT_STATUS, // 0x07
|
||||||
|
CLIENT_SETTINGS, // 0x08
|
||||||
|
TAB_COMPLETE, // 0x09
|
||||||
|
CLICK_WINDOW_BUTTON, // 0x0A
|
||||||
|
CLICK_WINDOW, // 0x0B
|
||||||
|
CLOSE_WINDOW, // 0x0C
|
||||||
|
PLUGIN_MESSAGE, // 0x0D
|
||||||
|
EDIT_BOOK, // 0x0E
|
||||||
|
ENTITY_NBT_REQUEST, // 0x0F
|
||||||
|
INTERACT_ENTITY, // 0x10
|
||||||
|
GENERATE_JIGSAW, // 0x11
|
||||||
|
KEEP_ALIVE, // 0x12
|
||||||
|
LOCK_DIFFICULTY, // 0x13
|
||||||
|
PLAYER_POSITION, // 0x14
|
||||||
|
PLAYER_POSITION_AND_ROTATION, // 0x15
|
||||||
|
PLAYER_ROTATION, // 0x16
|
||||||
|
PLAYER_MOVEMENT, // 0x17
|
||||||
|
VEHICLE_MOVE, // 0x18
|
||||||
|
STEER_BOAT, // 0x19
|
||||||
|
PICK_ITEM, // 0x1A
|
||||||
|
CRAFT_RECIPE_REQUEST, // 0x1B
|
||||||
|
PLAYER_ABILITIES, // 0x1C
|
||||||
|
PLAYER_DIGGING, // 0x1D
|
||||||
|
ENTITY_ACTION, // 0x1E
|
||||||
|
STEER_VEHICLE, // 0x1F
|
||||||
|
PONG, // 0x20
|
||||||
|
RECIPE_BOOK_DATA, // 0x21
|
||||||
|
SEEN_RECIPE, // 0x22
|
||||||
|
RENAME_ITEM, // 0x23
|
||||||
|
RESOURCE_PACK_STATUS, // 0x24
|
||||||
|
ADVANCEMENT_TAB, // 0x25
|
||||||
|
SELECT_TRADE, // 0x26
|
||||||
|
SET_BEACON_EFFECT, // 0x27
|
||||||
|
HELD_ITEM_CHANGE, // 0x28
|
||||||
|
UPDATE_COMMAND_BLOCK, // 0x29
|
||||||
|
UPDATE_COMMAND_BLOCK_MINECART, // 0x2A
|
||||||
|
CREATIVE_INVENTORY_ACTION, // 0x2B
|
||||||
|
UPDATE_JIGSAW_BLOCK, // 0x2C
|
||||||
|
UPDATE_STRUCTURE_BLOCK, // 0x2D
|
||||||
|
UPDATE_SIGN, // 0x2E
|
||||||
|
ANIMATION, // 0x2F
|
||||||
|
SPECTATE, // 0x30
|
||||||
|
PLAYER_BLOCK_PLACEMENT, // 0x31
|
||||||
|
USE_ITEM; // 0x32
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1.packets;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_3Types;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
||||||
|
import com.viaversion.viaversion.api.type.types.version.Types1_19_3;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1;
|
||||||
|
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||||
|
|
||||||
|
public final class EntityPackets extends EntityRewriter<Protocol1_19_3To1_19_1> {
|
||||||
|
|
||||||
|
public EntityPackets(final Protocol1_19_3To1_19_1 protocol) {
|
||||||
|
super(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerPackets() {
|
||||||
|
registerTrackerWithData1_19(ClientboundPackets1_19_1.SPAWN_ENTITY, Entity1_19_3Types.FALLING_BLOCK);
|
||||||
|
registerMetadataRewriter(ClientboundPackets1_19_1.ENTITY_METADATA, Types1_19.METADATA_LIST, Types1_19_3.METADATA_LIST);
|
||||||
|
registerRemoveEntities(ClientboundPackets1_19_1.REMOVE_ENTITIES);
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_1.JOIN_GAME, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.INT); // Entity id
|
||||||
|
map(Type.BOOLEAN); // Hardcore
|
||||||
|
map(Type.UNSIGNED_BYTE); // Gamemode
|
||||||
|
map(Type.BYTE); // Previous Gamemode
|
||||||
|
map(Type.STRING_ARRAY); // World List
|
||||||
|
map(Type.NBT); // Dimension registry
|
||||||
|
map(Type.STRING); // Dimension key
|
||||||
|
map(Type.STRING); // World
|
||||||
|
handler(dimensionDataHandler());
|
||||||
|
handler(biomeSizeTracker());
|
||||||
|
handler(worldDataTrackerHandlerByKey());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_1.RESPAWN, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Dimension
|
||||||
|
map(Type.STRING); // World
|
||||||
|
handler(worldDataTrackerHandlerByKey());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerRewrites() {
|
||||||
|
filter().handler((event, meta) -> {
|
||||||
|
final int id = meta.metaType().typeId();
|
||||||
|
meta.setMetaType(Types1_19_3.META_TYPES.byId(id >= 2 ? id + 1 : id)); // long added
|
||||||
|
});
|
||||||
|
registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.blockStateType, Types1_19_3.META_TYPES.particleType);
|
||||||
|
|
||||||
|
filter().filterFamily(Entity1_19_3Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||||
|
// Convert to new block id
|
||||||
|
final int data = (int) meta.getValue();
|
||||||
|
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMappingDataLoaded() {
|
||||||
|
mapTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityType typeFromId(final int type) {
|
||||||
|
return Entity1_19_3Types.getTypeFromId(type);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1.packets;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.Protocol1_19_3To1_19_1;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ServerboundPackets1_19_3;
|
||||||
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
|
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||||
|
|
||||||
|
public final class InventoryPackets extends ItemRewriter<Protocol1_19_3To1_19_1> {
|
||||||
|
|
||||||
|
public InventoryPackets(Protocol1_19_3To1_19_1 protocol) {
|
||||||
|
super(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerPackets() {
|
||||||
|
final BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
|
||||||
|
blockRewriter.registerBlockAction(ClientboundPackets1_19_1.BLOCK_ACTION);
|
||||||
|
blockRewriter.registerBlockChange(ClientboundPackets1_19_1.BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_1.MULTI_BLOCK_CHANGE);
|
||||||
|
blockRewriter.registerEffect(ClientboundPackets1_19_1.EFFECT, 1010, 2001);
|
||||||
|
blockRewriter.registerChunkData1_19(ClientboundPackets1_19_1.CHUNK_DATA, Chunk1_18Type::new);
|
||||||
|
blockRewriter.registerBlockEntityData(ClientboundPackets1_19_1.BLOCK_ENTITY_DATA);
|
||||||
|
|
||||||
|
registerSetCooldown(ClientboundPackets1_19_1.COOLDOWN);
|
||||||
|
registerWindowItems1_17_1(ClientboundPackets1_19_1.WINDOW_ITEMS);
|
||||||
|
registerSetSlot1_17_1(ClientboundPackets1_19_1.SET_SLOT);
|
||||||
|
registerAdvancements(ClientboundPackets1_19_1.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerEntityEquipmentArray(ClientboundPackets1_19_1.ENTITY_EQUIPMENT);
|
||||||
|
registerClickWindow1_17_1(ServerboundPackets1_19_3.CLICK_WINDOW);
|
||||||
|
registerTradeList1_19(ClientboundPackets1_19_1.TRADE_LIST);
|
||||||
|
registerCreativeInvAction(ServerboundPackets1_19_3.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_19_1.WINDOW_PROPERTY);
|
||||||
|
registerSpawnParticle1_19(ClientboundPackets1_19_1.SPAWN_PARTICLE);
|
||||||
|
|
||||||
|
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_19_1.DECLARE_RECIPES);
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_19_1.EXPLOSION, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.FLOAT, Type.DOUBLE); // X
|
||||||
|
map(Type.FLOAT, Type.DOUBLE); // Y
|
||||||
|
map(Type.FLOAT, Type.DOUBLE); // Z
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaBackwards - https://github.com/ViaVersion/ViaBackwards
|
||||||
|
* Copyright (C) 2016-2022 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.protocol1_19_3to1_19_1.storage;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public final class ReceivedMessagesStorage implements StorableObject {
|
||||||
|
private final PlayerMessageSignature[] signatures = new PlayerMessageSignature[5];
|
||||||
|
private PlayerMessageSignature lastSignature;
|
||||||
|
private int size;
|
||||||
|
private int unacknowledged;
|
||||||
|
|
||||||
|
public boolean add(final PlayerMessageSignature signature) {
|
||||||
|
if (signature.equals(this.lastSignature)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastSignature = signature;
|
||||||
|
PlayerMessageSignature toPush = signature;
|
||||||
|
for (int i = 0; i < this.size; ++i) {
|
||||||
|
final PlayerMessageSignature entry = this.signatures[i];
|
||||||
|
this.signatures[i] = toPush;
|
||||||
|
toPush = entry;
|
||||||
|
if (entry.uuid().equals(signature.uuid())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.size < this.signatures.length) {
|
||||||
|
this.signatures[this.size++] = toPush;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerMessageSignature[] lastSignatures() {
|
||||||
|
return Arrays.copyOf(this.signatures, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int tickUnacknowledged() {
|
||||||
|
return unacknowledged++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetUnacknowledgedCount() {
|
||||||
|
unacknowledged = 0;
|
||||||
|
}
|
||||||
|
}
|
@ -37,10 +37,10 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_19To1_18_2> {
|
|||||||
@Override
|
@Override
|
||||||
public void registerPackets() {
|
public void registerPackets() {
|
||||||
registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
|
registerSetCooldown(ClientboundPackets1_18.COOLDOWN);
|
||||||
registerWindowItems1_17_1(ClientboundPackets1_18.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, Type.FLAT_VAR_INT_ITEM);
|
registerWindowItems1_17_1(ClientboundPackets1_18.WINDOW_ITEMS);
|
||||||
registerSetSlot1_17_1(ClientboundPackets1_18.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot1_17_1(ClientboundPackets1_18.SET_SLOT);
|
||||||
registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
registerAdvancements(ClientboundPackets1_18.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerEntityEquipmentArray(ClientboundPackets1_18.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
|
registerEntityEquipmentArray(ClientboundPackets1_18.ENTITY_EQUIPMENT);
|
||||||
protocol.registerClientbound(ClientboundPackets1_18.SPAWN_PARTICLE, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_18.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -58,7 +58,7 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_19To1_18_2> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
registerClickWindow1_17_1(ServerboundPackets1_19.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
registerClickWindow1_17_1(ServerboundPackets1_19.CLICK_WINDOW);
|
||||||
registerCreativeInvAction(ServerboundPackets1_19.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
registerCreativeInvAction(ServerboundPackets1_19.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_18.WINDOW_PROPERTY);
|
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_18.WINDOW_PROPERTY);
|
||||||
|
@ -17,12 +17,23 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.rewriter;
|
package com.viaversion.viaversion.rewriter;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.viaversion.viaversion.api.data.Mappings;
|
||||||
|
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||||
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||||
import com.viaversion.viaversion.api.minecraft.Position;
|
import com.viaversion.viaversion.api.minecraft.Position;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.util.MathUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockRewriter {
|
public class BlockRewriter {
|
||||||
private final Protocol protocol;
|
private final Protocol protocol;
|
||||||
@ -121,4 +132,56 @@ public class BlockRewriter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerChunkData1_19(ClientboundPacketType packetType, ChunkTypeSupplier chunkTypeSupplier) {
|
||||||
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
|
||||||
|
Preconditions.checkArgument(tracker.biomesSent() != 0, "Biome count not set");
|
||||||
|
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != 0, "Section height not set");
|
||||||
|
final Type<Chunk> chunkType = chunkTypeSupplier.supply(tracker.currentWorldSectionHeight(),
|
||||||
|
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()),
|
||||||
|
MathUtil.ceilLog2(tracker.biomesSent()));
|
||||||
|
final Chunk chunk = wrapper.passthrough(chunkType);
|
||||||
|
for (final ChunkSection section : chunk.getSections()) {
|
||||||
|
final DataPalette blockPalette = section.palette(PaletteType.BLOCKS);
|
||||||
|
for (int i = 0; i < blockPalette.size(); i++) {
|
||||||
|
final int id = blockPalette.idByIndex(i);
|
||||||
|
blockPalette.setIdByIndex(i, protocol.getMappingData().getNewBlockStateId(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Mappings blockEntityMappings = protocol.getMappingData().getBlockEntityMappings();
|
||||||
|
if (blockEntityMappings != null) {
|
||||||
|
List<BlockEntity> blockEntities = chunk.blockEntities();
|
||||||
|
for (int i = 0; i < blockEntities.size(); i++) {
|
||||||
|
final BlockEntity blockEntity = blockEntities.get(i);
|
||||||
|
blockEntities.set(i, blockEntity.withTypeId(protocol.getMappingData().getBlockEntityMappings().getNewIdOrDefault(blockEntity.typeId(), blockEntity.typeId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerBlockEntityData(ClientboundPacketType packetType) {
|
||||||
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.POSITION1_14);
|
||||||
|
handler(wrapper -> {
|
||||||
|
final int blockEntityId = wrapper.read(Type.VAR_INT);
|
||||||
|
wrapper.write(Type.VAR_INT, protocol.getMappingData().getBlockEntityMappings().getNewIdOrDefault(blockEntityId, blockEntityId));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface ChunkTypeSupplier {
|
||||||
|
|
||||||
|
Type<Chunk> supply(int ySectionCount, int globalPaletteBlockBits, int globalPaletteBiomeBits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,12 @@ public class CommandRewriter {
|
|||||||
this.parserHandlers.put("minecraft:resource_or_tag", wrapper -> {
|
this.parserHandlers.put("minecraft:resource_or_tag", wrapper -> {
|
||||||
wrapper.passthrough(Type.STRING); // Resource location/tag
|
wrapper.passthrough(Type.STRING); // Resource location/tag
|
||||||
});
|
});
|
||||||
|
this.parserHandlers.put("minecraft:resource_or_tag_key", wrapper -> {
|
||||||
|
wrapper.passthrough(Type.STRING); // Resource location
|
||||||
|
});
|
||||||
|
this.parserHandlers.put("minecraft:resource_key", wrapper -> {
|
||||||
|
wrapper.passthrough(Type.STRING); // Resource location/tag
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleArgument(PacketWrapper wrapper, String argumentType) throws Exception {
|
public void handleArgument(PacketWrapper wrapper, String argumentType) throws Exception {
|
||||||
|
@ -40,6 +40,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
|||||||
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
import com.viaversion.viaversion.api.rewriter.RewriterBase;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.Particle;
|
import com.viaversion.viaversion.api.type.types.Particle;
|
||||||
|
import com.viaversion.viaversion.data.entity.DimensionDataImpl;
|
||||||
import com.viaversion.viaversion.rewriter.meta.MetaFilter;
|
import com.viaversion.viaversion.rewriter.meta.MetaFilter;
|
||||||
import com.viaversion.viaversion.rewriter.meta.MetaHandlerEvent;
|
import com.viaversion.viaversion.rewriter.meta.MetaHandlerEvent;
|
||||||
import com.viaversion.viaversion.rewriter.meta.MetaHandlerEventImpl;
|
import com.viaversion.viaversion.rewriter.meta.MetaHandlerEventImpl;
|
||||||
@ -47,7 +48,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -475,6 +478,26 @@ public abstract class EntityRewriter<T extends Protocol> extends RewriterBase<T>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a handler to cache dimension data, later used to get height values and other important info.
|
||||||
|
*
|
||||||
|
* @return handler to cache dimension data
|
||||||
|
*/
|
||||||
|
public PacketHandler dimensionDataHandler() {
|
||||||
|
return wrapper -> {
|
||||||
|
final CompoundTag tag = wrapper.get(Type.NBT, 0);
|
||||||
|
final ListTag dimensions = ((CompoundTag) tag.get("minecraft:dimension_type")).get("value");
|
||||||
|
final Map<String, DimensionData> dimensionDataMap = new HashMap<>(dimensions.size());
|
||||||
|
for (final Tag dimension : dimensions) {
|
||||||
|
final CompoundTag dimensionCompound = (CompoundTag) dimension;
|
||||||
|
final CompoundTag element = dimensionCompound.get("element");
|
||||||
|
final String name = (String) dimensionCompound.get("name").getValue();
|
||||||
|
dimensionDataMap.put(name, new DimensionDataImpl(element));
|
||||||
|
}
|
||||||
|
tracker(wrapper.user()).setDimensions(dimensionDataMap);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Sub 1.14.1 methods
|
// Sub 1.14.1 methods
|
||||||
|
|
||||||
|
@ -66,21 +66,19 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerWindowItems1_17_1(ClientboundPacketType packetType, Type<Item[]> itemsType, Type<Item> carriedItemType) {
|
public void registerWindowItems1_17_1(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Window id
|
map(Type.UNSIGNED_BYTE); // Window id
|
||||||
map(Type.VAR_INT); // State id
|
map(Type.VAR_INT); // State id
|
||||||
map(itemsType); // Items
|
|
||||||
map(carriedItemType); // Carried item
|
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
Item[] items = wrapper.get(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, 0);
|
Item[] items = wrapper.passthrough(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT);
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
handleItemToClient(item);
|
handleItemToClient(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleItemToClient(wrapper.get(Type.FLAT_VAR_INT_ITEM, 0));
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Carried item
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -98,15 +96,15 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSetSlot1_17_1(ClientboundPacketType packetType, Type<Item> type) {
|
public void registerSetSlot1_17_1(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.UNSIGNED_BYTE); // Window id
|
map(Type.UNSIGNED_BYTE); // Window id
|
||||||
map(Type.VAR_INT); // State id
|
map(Type.VAR_INT); // State id
|
||||||
map(Type.SHORT); // Slot id
|
map(Type.SHORT); // Slot id
|
||||||
map(type); // Item
|
map(Type.FLAT_VAR_INT_ITEM); // Item
|
||||||
handler(itemToClientHandler(type));
|
handler(itemToClientHandler(Type.FLAT_VAR_INT_ITEM));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -126,7 +124,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1.16+
|
// 1.16+
|
||||||
public void registerEntityEquipmentArray(ClientboundPacketType packetType, Type<Item> type) {
|
public void registerEntityEquipmentArray(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -137,7 +135,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
do {
|
do {
|
||||||
slot = wrapper.passthrough(Type.BYTE);
|
slot = wrapper.passthrough(Type.BYTE);
|
||||||
// & 0x7F into an extra variable if slot is needed
|
// & 0x7F into an extra variable if slot is needed
|
||||||
handleItemToClient(wrapper.passthrough(type));
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
} while ((slot & 0xFFFFFF80) != 0);
|
} while ((slot & 0xFFFFFF80) != 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -172,7 +170,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerClickWindow1_17_1(ServerboundPacketType packetType, Type<Item> type) {
|
public void registerClickWindow1_17_1(ServerboundPacketType packetType) {
|
||||||
protocol.registerServerbound(packetType, new PacketRemapper() {
|
protocol.registerServerbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -187,11 +185,11 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
int length = wrapper.passthrough(Type.VAR_INT);
|
int length = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
wrapper.passthrough(Type.SHORT); // Slot
|
wrapper.passthrough(Type.SHORT); // Slot
|
||||||
handleItemToServer(wrapper.passthrough(type));
|
handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carried item
|
// Carried item
|
||||||
handleItemToServer(wrapper.passthrough(type));
|
handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -210,7 +208,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1.14.4+
|
// 1.14.4+
|
||||||
public void registerTradeList(ClientboundPacketType packetType, Type<Item> type) {
|
public void registerTradeList(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -218,11 +216,11 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
wrapper.passthrough(Type.VAR_INT);
|
wrapper.passthrough(Type.VAR_INT);
|
||||||
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Input
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Input
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Output
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Output
|
||||||
|
|
||||||
if (wrapper.passthrough(Type.BOOLEAN)) { // Has second item
|
if (wrapper.passthrough(Type.BOOLEAN)) { // Has second item
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Second Item
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Second Item
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||||
@ -240,7 +238,7 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerTradeList1_19(ClientboundPacketType packetType, Type<Item> type) {
|
public void registerTradeList1_19(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
@ -248,9 +246,9 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
wrapper.passthrough(Type.VAR_INT); // Container id
|
wrapper.passthrough(Type.VAR_INT); // Container id
|
||||||
int size = wrapper.passthrough(Type.VAR_INT);
|
int size = wrapper.passthrough(Type.VAR_INT);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Input
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Input
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Output
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Output
|
||||||
handleItemToClient(wrapper.passthrough(type)); // Second Item
|
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); // Second Item
|
||||||
|
|
||||||
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
wrapper.passthrough(Type.BOOLEAN); // Trade disabled
|
||||||
wrapper.passthrough(Type.INT); // Number of tools uses
|
wrapper.passthrough(Type.INT); // Number of tools uses
|
||||||
@ -343,21 +341,21 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSpawnParticle1_19(ClientboundPacketType packetType, Type<Item> itemType, Type<?> coordType) {
|
public void registerSpawnParticle1_19(ClientboundPacketType packetType) {
|
||||||
protocol.registerClientbound(packetType, new PacketRemapper() {
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Particle ID
|
map(Type.VAR_INT); // 0 - Particle ID
|
||||||
map(Type.BOOLEAN); // 1 - Long Distance
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
map(coordType); // 2 - X
|
map(Type.DOUBLE); // 2 - X
|
||||||
map(coordType); // 3 - Y
|
map(Type.DOUBLE); // 3 - Y
|
||||||
map(coordType); // 4 - Z
|
map(Type.DOUBLE); // 4 - Z
|
||||||
map(Type.FLOAT); // 5 - Offset X
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
map(Type.FLOAT); // 6 - Offset Y
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
map(Type.FLOAT); // 7 - Offset Z
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
map(Type.FLOAT); // 8 - Particle Data
|
map(Type.FLOAT); // 8 - Particle Data
|
||||||
map(Type.INT); // 9 - Particle Count
|
map(Type.INT); // 9 - Particle Count
|
||||||
handler(getSpawnParticleHandler(Type.VAR_INT, itemType));
|
handler(getSpawnParticleHandler(Type.VAR_INT, Type.FLAT_VAR_INT_ITEM));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
26698
common/src/main/resources/assets/viaversion/data/mapping-1.19.3.json
Normale Datei
26698
common/src/main/resources/assets/viaversion/data/mapping-1.19.3.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"argumenttypes": {
|
||||||
|
"minecraft:item_enchantment": "minecraft:resource_or_tag_key",
|
||||||
|
"minecraft:mob_effect": "minecraft:resource_or_tag_key",
|
||||||
|
"minecraft:entity_summon": "minecraft:resource_or_tag_key"
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||||
projectVersion=4.5.0-SNAPSHOT
|
projectVersion=4.5.0-22w42a-SNAPSHOT
|
||||||
|
|
||||||
# Gradle properties
|
# Gradle properties
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren