Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
23w45a
Dieser Commit ist enthalten in:
Ursprung
58ca2024e1
Commit
a2d287ff9f
@ -44,9 +44,14 @@ public final class Particle {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public <T> ParticleData<T> getArgument(final int id) {
|
||||
public <T> ParticleData<T> getArgument(final int index) {
|
||||
//noinspection unchecked
|
||||
return (ParticleData<T>) arguments.get(id);
|
||||
return (ParticleData<T>) arguments.get(index);
|
||||
}
|
||||
|
||||
public <T> ParticleData<T> removeArgument(final int index) {
|
||||
//noinspection unchecked
|
||||
return (ParticleData<T>) arguments.remove(index);
|
||||
}
|
||||
|
||||
public List<ParticleData<?>> getArguments() {
|
||||
@ -57,6 +62,10 @@ public final class Particle {
|
||||
arguments.add(new ParticleData<>(type, value));
|
||||
}
|
||||
|
||||
public <T> void add(final int index, final Type<T> type, final T value) {
|
||||
arguments.add(index, new ParticleData<>(type, value));
|
||||
}
|
||||
|
||||
public static final class ParticleData<T> {
|
||||
private final Type<T> type;
|
||||
private T value;
|
||||
|
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2023 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 java.util.Locale;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public enum EntityTypes1_20_3 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),
|
||||
|
||||
DISPLAY(ENTITY, null),
|
||||
BLOCK_DISPLAY(DISPLAY),
|
||||
ITEM_DISPLAY(DISPLAY),
|
||||
TEXT_DISPLAY(DISPLAY),
|
||||
INTERACTION(ENTITY),
|
||||
|
||||
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),
|
||||
SNIFFER(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),
|
||||
BREEZE(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),
|
||||
WIND_CHARGE(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;
|
||||
|
||||
EntityTypes1_20_3(final EntityType parent) {
|
||||
this.parent = parent;
|
||||
this.identifier = "minecraft:" + name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
EntityTypes1_20_3(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);
|
||||
}
|
||||
}
|
@ -85,7 +85,7 @@ public class ProtocolVersion {
|
||||
public static final ProtocolVersion v1_19_4 = register(762, "1.19.4");
|
||||
public static final ProtocolVersion v1_20 = register(763, "1.20/1.20.1", new VersionRange("1.20", 0, 1));
|
||||
public static final ProtocolVersion v1_20_2 = register(764, "1.20.2");
|
||||
public static final ProtocolVersion v1_20_3 = register(765, 161, "1.20.3");
|
||||
public static final ProtocolVersion v1_20_3 = register(765, 162, "1.20.3");
|
||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||
|
||||
public static ProtocolVersion register(int version, String name) {
|
||||
|
@ -247,9 +247,6 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Type{" +
|
||||
"outputClass=" + outputClass +
|
||||
", typeName='" + typeName + '\'' +
|
||||
'}';
|
||||
return getTypeName();
|
||||
}
|
||||
}
|
||||
|
@ -83,8 +83,9 @@ public class ParticleType extends Type<Particle> {
|
||||
public static final ParticleReader BLOCK = (buf, particle) -> {
|
||||
particle.add(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf)); // Flat Block
|
||||
};
|
||||
public static final ParticleReader ITEM = itemHandler(Type.ITEM1_13);
|
||||
public static final ParticleReader VAR_INT_ITEM = itemHandler(Type.ITEM1_13_2);
|
||||
public static final ParticleReader ITEM1_13 = itemHandler(Type.ITEM1_13);
|
||||
public static final ParticleReader ITEM1_13_2 = itemHandler(Type.ITEM1_13_2);
|
||||
public static final ParticleReader ITEM1_20_2 = itemHandler(Type.ITEM1_20_2);
|
||||
public static final ParticleReader DUST = (buf, particle) -> {
|
||||
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Red 0-1
|
||||
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Green 0-1
|
||||
@ -131,6 +132,19 @@ public class ParticleType extends Type<Particle> {
|
||||
}
|
||||
particle.add(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf)); // Arrival in ticks
|
||||
};
|
||||
public static final ParticleReader VIBRATION1_20_3 = (buf, particle) -> {
|
||||
final int sourceTypeId = Type.VAR_INT.readPrimitive(buf);
|
||||
particle.add(Type.VAR_INT, sourceTypeId);
|
||||
if (sourceTypeId == 0) { // Block
|
||||
particle.add(Type.POSITION1_14, Type.POSITION1_14.read(buf)); // Target block pos
|
||||
} else if (sourceTypeId == 1) { // Entity
|
||||
particle.add(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf)); // Target entity
|
||||
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Y offset
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Unknown vibration path position source type: " + sourceTypeId);
|
||||
}
|
||||
particle.add(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf)); // Arrival in ticks
|
||||
};
|
||||
public static final ParticleReader SCULK_CHARGE = (buf, particle) -> {
|
||||
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Roll
|
||||
};
|
||||
|
@ -855,7 +855,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
.reader(3, ParticleType.Readers.BLOCK)
|
||||
.reader(20, ParticleType.Readers.DUST)
|
||||
.reader(11, ParticleType.Readers.DUST)
|
||||
.reader(27, ParticleType.Readers.ITEM);
|
||||
.reader(27, ParticleType.Readers.ITEM1_13);
|
||||
|
||||
if (Via.getConfig().isServersideBlockConnections() && Via.getManager().getProviders().get(BlockConnectionProvider.class) instanceof PacketBlockConnectionProvider) {
|
||||
BlockConnectionStorage.init();
|
||||
|
@ -149,12 +149,12 @@ public class Protocol1_14To1_13_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
.reader("block", ParticleType.Readers.BLOCK)
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM);
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2);
|
||||
Types1_14.PARTICLE.filler(this)
|
||||
.reader("block", ParticleType.Readers.BLOCK)
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM);
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -260,7 +260,7 @@ public class Protocol1_16To1_15_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
.reader("block", ParticleType.Readers.BLOCK)
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM);
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +208,7 @@ public final class Protocol1_17To1_16_4 extends AbstractProtocol<ClientboundPack
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public final class Protocol1_18To1_17_1 extends AbstractProtocol<ClientboundPack
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION);
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ public final class Protocol1_19_3To1_19_1 extends AbstractProtocol<ClientboundPa
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_19)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
|
@ -100,7 +100,7 @@ public final class Protocol1_19_4To1_19_3 extends AbstractProtocol<ClientboundPa
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_19)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
|
@ -298,7 +298,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_19)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
|
@ -39,7 +39,7 @@ import com.viaversion.viaversion.api.Via;
|
||||
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.entities.EntityTypes1_19_4;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
@ -373,7 +373,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
}
|
||||
|
||||
private static ListTag convertJsonArray(final JsonElement element) {
|
||||
// TODO Number arrays
|
||||
// TODO Number arrays?
|
||||
final ListTag listTag = new ListTag();
|
||||
boolean singleType = true;
|
||||
for (final JsonElement entry : element.getAsJsonArray()) {
|
||||
@ -513,21 +513,23 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
|
||||
|
||||
@Override
|
||||
protected void onMappingDataLoaded() {
|
||||
super.onMappingDataLoaded();
|
||||
EntityTypes1_20_3.initialize(this);
|
||||
Types1_20_3.PARTICLE.filler(this)
|
||||
.reader("block", ParticleType.Readers.BLOCK)
|
||||
.reader("block_marker", ParticleType.Readers.BLOCK)
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION)
|
||||
.reader("item", ParticleType.Readers.ITEM1_20_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_20_3)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_19_4.PLAYER));
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_20_3.PLAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,14 +17,18 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<ClientboundPackets1_20_2, ServerboundPackets1_20_3, Protocol1_20_3To1_20_2> {
|
||||
|
||||
@ -50,8 +54,73 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
|
||||
registerTradeList1_19(ClientboundPackets1_20_2.TRADE_LIST);
|
||||
registerCreativeInvAction(ServerboundPackets1_20_3.CREATIVE_INVENTORY_ACTION);
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_19(ClientboundPackets1_20_2.SPAWN_PARTICLE);
|
||||
|
||||
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
||||
protocol.registerClientbound(ClientboundPackets1_20_2.SPAWN_PARTICLE, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT); // 0 - Particle ID
|
||||
map(Type.BOOLEAN); // 1 - Long Distance
|
||||
map(Type.DOUBLE); // 2 - X
|
||||
map(Type.DOUBLE); // 3 - Y
|
||||
map(Type.DOUBLE); // 4 - Z
|
||||
map(Type.FLOAT); // 5 - Offset X
|
||||
map(Type.FLOAT); // 6 - Offset Y
|
||||
map(Type.FLOAT); // 7 - Offset Z
|
||||
map(Type.FLOAT); // 8 - Particle Data
|
||||
map(Type.INT); // 9 - Particle Count
|
||||
handler(wrapper -> {
|
||||
final int id = wrapper.get(Type.VAR_INT, 0);
|
||||
final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings();
|
||||
if (id == particleMappings.id("vibration")) {
|
||||
final String resourceLocation = Key.stripMinecraftNamespace(wrapper.read(Type.STRING));
|
||||
wrapper.write(Type.VAR_INT, resourceLocation.equals("block") ? 0 : 1);
|
||||
}
|
||||
});
|
||||
handler(getSpawnParticleHandler(Type.VAR_INT));
|
||||
}
|
||||
});
|
||||
|
||||
new RecipeRewriter1_20_2<ClientboundPackets1_20_2>(protocol) {
|
||||
@Override
|
||||
public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception {
|
||||
// Move width and height down
|
||||
final int width = wrapper.read(Type.VAR_INT);
|
||||
final int height = wrapper.read(Type.VAR_INT);
|
||||
|
||||
wrapper.passthrough(Type.STRING); // Group
|
||||
wrapper.passthrough(Type.VAR_INT); // Crafting book category
|
||||
|
||||
wrapper.write(Type.VAR_INT, width);
|
||||
wrapper.write(Type.VAR_INT, height);
|
||||
final int ingredients = height * width;
|
||||
for (int i = 0; i < ingredients; i++) {
|
||||
handleIngredient(wrapper);
|
||||
}
|
||||
rewrite(wrapper.passthrough(itemType())); // Result
|
||||
wrapper.passthrough(Type.BOOLEAN); // Show notification
|
||||
}
|
||||
}.register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_20_2.EXPLOSION, wrapper -> {
|
||||
wrapper.passthrough(Type.DOUBLE); // X
|
||||
wrapper.passthrough(Type.DOUBLE); // Y
|
||||
wrapper.passthrough(Type.DOUBLE); // Z
|
||||
wrapper.passthrough(Type.FLOAT); // Power
|
||||
final int blocks = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < blocks; i++) {
|
||||
wrapper.passthrough(Type.BYTE); // Relative X
|
||||
wrapper.passthrough(Type.BYTE); // Relative Y
|
||||
wrapper.passthrough(Type.BYTE); // Relative Z
|
||||
}
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback X
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Y
|
||||
wrapper.passthrough(Type.FLOAT); // Knockback Z
|
||||
|
||||
wrapper.write(Type.VAR_INT, 1); // Block interaction type - Destroy
|
||||
wrapper.write(Type.VAR_INT, protocol.getMappingData().getParticleMappings().mappedId("explosion")); // Small explosion particle
|
||||
wrapper.write(Type.VAR_INT, protocol.getMappingData().getParticleMappings().mappedId("explosion_emitter")); // Large explosion particle
|
||||
wrapper.write(Type.STRING, "minecraft:entity.generic.explode"); // Explosion sound
|
||||
wrapper.write(Type.OPTIONAL_FLOAT, null); // Sound range
|
||||
});
|
||||
}
|
||||
}
|
@ -17,8 +17,10 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.data.ParticleMappings;
|
||||
import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
@ -31,6 +33,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.Protocol1_20_3To1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ClientboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
public final class EntityPacketRewriter1_20_3 extends EntityRewriter<ClientboundPackets1_20_2, Protocol1_20_3To1_20_2> {
|
||||
|
||||
@ -40,7 +43,7 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
||||
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_2.SPAWN_ENTITY, EntityTypes1_19_4.FALLING_BLOCK);
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_2.SPAWN_ENTITY, EntityTypes1_20_3.FALLING_BLOCK);
|
||||
registerMetadataRewriter(ClientboundPackets1_20_2.ENTITY_METADATA, Types1_20_2.METADATA_LIST, Types1_20_3.METADATA_LIST);
|
||||
registerRemoveEntities(ClientboundPackets1_20_2.REMOVE_ENTITIES);
|
||||
|
||||
@ -102,6 +105,21 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
||||
meta.setTypeAndValue(Types1_20_3.META_TYPES.componentType, Protocol1_20_3To1_20_2.jsonComponentToTag(meta.value()));
|
||||
} else if (type == Types1_20_2.META_TYPES.optionalComponentType) {
|
||||
meta.setTypeAndValue(Types1_20_3.META_TYPES.optionalComponentType, Protocol1_20_3To1_20_2.jsonComponentToTag(meta.value()));
|
||||
} else if (type == Types1_20_2.META_TYPES.particleType) {
|
||||
final Particle particle = (Particle) meta.getValue();
|
||||
final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings();
|
||||
if (particle.getId() == particleMappings.id("vibration")) {
|
||||
// Change the type of the resource key argument
|
||||
final String resourceLocation = particle.<String>removeArgument(0).getValue();
|
||||
if (Key.stripMinecraftNamespace(resourceLocation).equals("block")) {
|
||||
particle.add(0, Type.VAR_INT, 0);
|
||||
} else { // Entity
|
||||
particle.add(0, Type.VAR_INT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
rewriteParticle(particle);
|
||||
meta.setMetaType(Types1_20_3.META_TYPES.particleType);
|
||||
} else {
|
||||
meta.setMetaType(Types1_20_3.META_TYPES.byId(type.typeId()));
|
||||
}
|
||||
@ -114,14 +132,19 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter<Clientbound
|
||||
Types1_20_3.META_TYPES.particleType
|
||||
);
|
||||
|
||||
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||
final int blockState = meta.value();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMappingDataLoaded() {
|
||||
mapTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType typeFromId(final int type) {
|
||||
return EntityTypes1_19_4.getTypeFromId(type);
|
||||
return EntityTypes1_20_3.getTypeFromId(type);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2023 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_20_3to1_20_2.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
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.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.rewriter.RecipeRewriter1_19_4;
|
||||
|
||||
public class RecipeRewriter1_20_3<C extends ClientboundPacketType> extends RecipeRewriter1_19_4<C> {
|
||||
|
||||
public RecipeRewriter1_20_3(final Protocol<C, ?, ?, ?> protocol) {
|
||||
super(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCraftingShaped(final PacketWrapper wrapper) throws Exception {
|
||||
wrapper.passthrough(Type.STRING); // Group
|
||||
wrapper.passthrough(Type.VAR_INT); // Crafting book category
|
||||
final int ingredients = wrapper.passthrough(Type.VAR_INT) * wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < ingredients; i++) {
|
||||
handleIngredient(wrapper);
|
||||
}
|
||||
rewrite(wrapper.passthrough(itemType())); // Result
|
||||
wrapper.passthrough(Type.BOOLEAN); // Show notification
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Type<Item> itemType() {
|
||||
return Type.ITEM1_20_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Type<Item[]> itemArrayType() {
|
||||
return Type.ITEM1_20_2_ARRAY;
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ public final class Protocol1_20To1_19_4 extends AbstractProtocol<ClientboundPack
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("item", ParticleType.Readers.ITEM1_13_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_19)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);
|
||||
|
Binäre Datei nicht angezeigt.
Binäre Datei nicht angezeigt.
@ -1,5 +1,5 @@
|
||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||
projectVersion=4.9.0-23w44a-SNAPSHOT
|
||||
projectVersion=4.9.0-23w45a-SNAPSHOT
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=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
|
||||
|
@ -20,7 +20,7 @@ package com.viaversion.viaversion.template.protocols;
|
||||
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.entities.EntityTypes1_19_4;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
@ -32,8 +32,8 @@ import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.Serverb
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.template.protocols.rewriter.EntityPacketRewriter1_99;
|
||||
import com.viaversion.viaversion.template.protocols.rewriter.BlockItemPacketRewriter1_99;
|
||||
import com.viaversion.viaversion.template.protocols.rewriter.EntityPacketRewriter1_99;
|
||||
|
||||
// Placeholders to replace (in the entire package):
|
||||
// Protocol1_99To_98, EntityPacketRewriter1_99, BlockItemPacketRewriter1_99
|
||||
@ -89,7 +89,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
super.onMappingDataLoaded(); // Calls load methods on rewriters
|
||||
|
||||
// Uncomment this if the entity types enum has been newly added specificly for this Protocol
|
||||
// Entity1_19_4Types.initialize(this);
|
||||
// Entity1_20_3Types.initialize(this);
|
||||
|
||||
// Uncomment if a new particle was added = ids shifted; requires a new Types_ class copied from the last
|
||||
/*Types1_20_3.PARTICLE.filler(this)
|
||||
@ -98,8 +98,8 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
.reader("dust", ParticleType.Readers.DUST)
|
||||
.reader("falling_dust", ParticleType.Readers.BLOCK)
|
||||
.reader("dust_color_transition", ParticleType.Readers.DUST_TRANSITION)
|
||||
.reader("item", ParticleType.Readers.VAR_INT_ITEM)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION)
|
||||
.reader("item", ParticleType.Readers.ITEM1_20_2)
|
||||
.reader("vibration", ParticleType.Readers.VIBRATION1_20_3)
|
||||
.reader("sculk_charge", ParticleType.Readers.SCULK_CHARGE)
|
||||
.reader("shriek", ParticleType.Readers.SHRIEK);*/
|
||||
}
|
||||
@ -107,7 +107,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol<ClientboundPackets
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
// Register the entity tracker - used for entity id/metadata rewriting AND for tracking world data sent to the client (then used for chunk data rewriting)
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_19_4.PLAYER));
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_20_3.PLAYER));
|
||||
}
|
||||
|
||||
// Overriding these three methods is important as they are relied on various rewriter classes
|
||||
|
@ -18,10 +18,10 @@
|
||||
package com.viaversion.viaversion.template.protocols.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.rewriter.RecipeRewriter1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.packet.ServerboundPackets1_20_3;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.RecipeRewriter1_20_3;
|
||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.template.protocols.Protocol1_99To_98;
|
||||
@ -62,7 +62,7 @@ public final class BlockItemPacketRewriter1_99 extends ItemRewriter<ClientboundP
|
||||
registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.WINDOW_PROPERTY);
|
||||
registerSpawnParticle1_19(ClientboundPackets1_20_2.SPAWN_PARTICLE);
|
||||
|
||||
new RecipeRewriter1_20_2<>(protocol).register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
||||
new RecipeRewriter1_20_3<>(protocol).register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
||||
// OR do this if serialization of recipes changed and override the relevant method
|
||||
// Add new serializers to RecipeRewriter, or extend the last one for changes
|
||||
// new RecipeRewriter1_20_2<ClientboundPackets1_20_2>(this) {}.register(ClientboundPackets1_20_2.DECLARE_RECIPES);
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.template.protocols.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_3;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
@ -40,7 +40,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
@Override
|
||||
public void registerPackets() {
|
||||
// Tracks entities, applies metadata rewrites registered below, untracks entities
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_2.SPAWN_ENTITY, EntityTypes1_19_4.FALLING_BLOCK);
|
||||
registerTrackerWithData1_19(ClientboundPackets1_20_2.SPAWN_ENTITY, EntityTypes1_20_3.FALLING_BLOCK);
|
||||
registerMetadataRewriter(ClientboundPackets1_20_2.ENTITY_METADATA, /*Types1_OLD.METADATA_LIST, */Types1_20_3.METADATA_LIST); // Specify old and new metadata list if changed
|
||||
registerRemoveEntities(ClientboundPackets1_20_2.REMOVE_ENTITIES);
|
||||
|
||||
@ -101,7 +101,7 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
);
|
||||
|
||||
// Minecarts are special
|
||||
filter().filterFamily(EntityTypes1_19_4.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||
filter().filterFamily(EntityTypes1_20_3.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
|
||||
final int blockState = meta.value();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));
|
||||
});
|
||||
@ -115,6 +115,6 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter<ClientboundPa
|
||||
|
||||
@Override
|
||||
public EntityType typeFromId(final int type) {
|
||||
return EntityTypes1_19_4.getTypeFromId(type);
|
||||
return EntityTypes1_20_3.getTypeFromId(type);
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren