Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 00:50:13 +01:00
22w11a
Dieser Commit ist enthalten in:
Ursprung
a12dfa405f
Commit
365b3a8a38
@ -102,4 +102,6 @@ public interface MappingData {
|
|||||||
@Nullable Mappings getSoundMappings();
|
@Nullable Mappings getSoundMappings();
|
||||||
|
|
||||||
@Nullable Mappings getStatisticsMappings();
|
@Nullable Mappings getStatisticsMappings();
|
||||||
|
|
||||||
|
@Nullable Mappings getArgumentTypeMappings();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ public class MappingDataBase implements MappingData {
|
|||||||
protected Mappings blockEntityMappings;
|
protected Mappings blockEntityMappings;
|
||||||
protected Mappings soundMappings;
|
protected Mappings soundMappings;
|
||||||
protected Mappings statisticsMappings;
|
protected Mappings statisticsMappings;
|
||||||
|
protected Mappings argumentTypeMappings;
|
||||||
protected Map<RegistryType, List<TagData>> tags;
|
protected Map<RegistryType, List<TagData>> tags;
|
||||||
protected boolean loadItems = true;
|
protected boolean loadItems = true;
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ public class MappingDataBase implements MappingData {
|
|||||||
blockEntityMappings = loadFromArray(oldMappings, newMappings, diffmapping, "blockentities");
|
blockEntityMappings = loadFromArray(oldMappings, newMappings, diffmapping, "blockentities");
|
||||||
soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds");
|
soundMappings = loadFromArray(oldMappings, newMappings, diffmapping, "sounds");
|
||||||
statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics");
|
statisticsMappings = loadFromArray(oldMappings, newMappings, diffmapping, "statistics");
|
||||||
|
argumentTypeMappings = loadFromArray(oldMappings, newMappings, diffmapping, "argumenttypes");
|
||||||
|
|
||||||
Mappings particles = loadFromArray(oldMappings, newMappings, diffmapping, "particles");
|
Mappings particles = loadFromArray(oldMappings, newMappings, diffmapping, "particles");
|
||||||
if (particles != null) {
|
if (particles != null) {
|
||||||
@ -191,6 +193,11 @@ public class MappingDataBase implements MappingData {
|
|||||||
return statisticsMappings;
|
return statisticsMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable Mappings getArgumentTypeMappings() {
|
||||||
|
return argumentTypeMappings;
|
||||||
|
}
|
||||||
|
|
||||||
protected @Nullable Mappings loadFromArray(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {
|
protected @Nullable Mappings loadFromArray(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {
|
||||||
if (!oldMappings.has(key) || !newMappings.has(key)) return null;
|
if (!oldMappings.has(key) || !newMappings.has(key)) return null;
|
||||||
|
|
||||||
|
@ -35,16 +35,16 @@ public enum Entity1_19Types implements EntityType {
|
|||||||
EYE_OF_ENDER(26, ENTITY),
|
EYE_OF_ENDER(26, ENTITY),
|
||||||
FALLING_BLOCK(27, ENTITY),
|
FALLING_BLOCK(27, ENTITY),
|
||||||
FIREWORK_ROCKET(28, ENTITY),
|
FIREWORK_ROCKET(28, ENTITY),
|
||||||
ITEM(41, ENTITY),
|
ITEM(42, ENTITY),
|
||||||
LLAMA_SPIT(47, ENTITY),
|
LLAMA_SPIT(48, ENTITY),
|
||||||
TNT(69, ENTITY),
|
TNT(70, ENTITY),
|
||||||
SHULKER_BULLET(76, ENTITY),
|
SHULKER_BULLET(77, ENTITY),
|
||||||
FISHING_BOBBER(113, ENTITY),
|
FISHING_BOBBER(114, ENTITY),
|
||||||
|
|
||||||
LIVINGENTITY(-1, ENTITY),
|
LIVINGENTITY(-1, ENTITY),
|
||||||
ARMOR_STAND(1, LIVINGENTITY),
|
ARMOR_STAND(1, LIVINGENTITY),
|
||||||
MARKER(49, ENTITY),
|
MARKER(50, ENTITY),
|
||||||
PLAYER(112, LIVINGENTITY),
|
PLAYER(113, LIVINGENTITY),
|
||||||
|
|
||||||
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
||||||
ENDER_DRAGON(20, ABSTRACT_INSENTIENT),
|
ENDER_DRAGON(20, ABSTRACT_INSENTIENT),
|
||||||
@ -54,8 +54,8 @@ public enum Entity1_19Types implements EntityType {
|
|||||||
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
|
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
|
||||||
|
|
||||||
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
|
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
|
||||||
VILLAGER(98, ABSTRACT_AGEABLE),
|
VILLAGER(100, ABSTRACT_AGEABLE),
|
||||||
WANDERING_TRADER(100, ABSTRACT_AGEABLE),
|
WANDERING_TRADER(102, ABSTRACT_AGEABLE),
|
||||||
|
|
||||||
// Animals
|
// Animals
|
||||||
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
|
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
|
||||||
@ -63,47 +63,48 @@ public enum Entity1_19Types implements EntityType {
|
|||||||
DOLPHIN(14, ABSTRACT_INSENTIENT),
|
DOLPHIN(14, ABSTRACT_INSENTIENT),
|
||||||
CHICKEN(10, ABSTRACT_ANIMAL),
|
CHICKEN(10, ABSTRACT_ANIMAL),
|
||||||
COW(12, ABSTRACT_ANIMAL),
|
COW(12, ABSTRACT_ANIMAL),
|
||||||
MOOSHROOM(58, COW),
|
MOOSHROOM(59, COW),
|
||||||
PANDA(61, ABSTRACT_INSENTIENT),
|
PANDA(62, ABSTRACT_INSENTIENT),
|
||||||
PIG(64, ABSTRACT_ANIMAL),
|
PIG(65, ABSTRACT_ANIMAL),
|
||||||
POLAR_BEAR(68, ABSTRACT_ANIMAL),
|
POLAR_BEAR(69, ABSTRACT_ANIMAL),
|
||||||
RABBIT(71, ABSTRACT_ANIMAL),
|
RABBIT(72, ABSTRACT_ANIMAL),
|
||||||
SHEEP(74, ABSTRACT_ANIMAL),
|
SHEEP(75, ABSTRACT_ANIMAL),
|
||||||
TURTLE(96, ABSTRACT_ANIMAL),
|
TURTLE(98, ABSTRACT_ANIMAL),
|
||||||
FOX(29, ABSTRACT_ANIMAL),
|
FOX(29, ABSTRACT_ANIMAL),
|
||||||
GOAT(34, ABSTRACT_ANIMAL),
|
FROG(30, ABSTRACT_ANIMAL),
|
||||||
|
GOAT(35, ABSTRACT_ANIMAL),
|
||||||
|
|
||||||
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
|
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
|
||||||
CAT(8, ABSTRACT_TAMEABLE_ANIMAL),
|
CAT(8, ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
OCELOT(59, ABSTRACT_TAMEABLE_ANIMAL),
|
OCELOT(60, ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
WOLF(106, ABSTRACT_TAMEABLE_ANIMAL),
|
WOLF(107, ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
|
|
||||||
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
|
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
|
||||||
PARROT(62, ABSTRACT_PARROT),
|
PARROT(63, ABSTRACT_PARROT),
|
||||||
|
|
||||||
// Horses
|
// Horses
|
||||||
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
|
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
|
||||||
CHESTED_HORSE(-1, ABSTRACT_HORSE),
|
CHESTED_HORSE(-1, ABSTRACT_HORSE),
|
||||||
DONKEY(15, CHESTED_HORSE),
|
DONKEY(15, CHESTED_HORSE),
|
||||||
MULE(57, CHESTED_HORSE),
|
MULE(58, CHESTED_HORSE),
|
||||||
LLAMA(46, CHESTED_HORSE),
|
LLAMA(47, CHESTED_HORSE),
|
||||||
TRADER_LLAMA(94, CHESTED_HORSE),
|
TRADER_LLAMA(96, CHESTED_HORSE),
|
||||||
HORSE(37, ABSTRACT_HORSE),
|
HORSE(38, ABSTRACT_HORSE),
|
||||||
SKELETON_HORSE(79, ABSTRACT_HORSE),
|
SKELETON_HORSE(80, ABSTRACT_HORSE),
|
||||||
ZOMBIE_HORSE(109, ABSTRACT_HORSE),
|
ZOMBIE_HORSE(110, ABSTRACT_HORSE),
|
||||||
|
|
||||||
// Golem
|
// Golem
|
||||||
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
|
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
|
||||||
SNOW_GOLEM(82, ABSTRACT_GOLEM),
|
SNOW_GOLEM(83, ABSTRACT_GOLEM),
|
||||||
IRON_GOLEM(40, ABSTRACT_GOLEM),
|
IRON_GOLEM(41, ABSTRACT_GOLEM),
|
||||||
SHULKER(75, ABSTRACT_GOLEM),
|
SHULKER(76, ABSTRACT_GOLEM),
|
||||||
|
|
||||||
// Fish
|
// Fish
|
||||||
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
|
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
|
||||||
COD(11, ABSTRACT_FISHES),
|
COD(11, ABSTRACT_FISHES),
|
||||||
PUFFERFISH(70, ABSTRACT_FISHES),
|
PUFFERFISH(71, ABSTRACT_FISHES),
|
||||||
SALMON(73, ABSTRACT_FISHES),
|
SALMON(74, ABSTRACT_FISHES),
|
||||||
TROPICAL_FISH(95, ABSTRACT_FISHES),
|
TROPICAL_FISH(97, ABSTRACT_FISHES),
|
||||||
|
|
||||||
// Monsters
|
// Monsters
|
||||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||||
@ -111,109 +112,109 @@ public enum Entity1_19Types implements EntityType {
|
|||||||
CREEPER(13, ABSTRACT_MONSTER),
|
CREEPER(13, ABSTRACT_MONSTER),
|
||||||
ENDERMITE(22, ABSTRACT_MONSTER),
|
ENDERMITE(22, ABSTRACT_MONSTER),
|
||||||
ENDERMAN(21, ABSTRACT_MONSTER),
|
ENDERMAN(21, ABSTRACT_MONSTER),
|
||||||
GIANT(31, ABSTRACT_MONSTER),
|
GIANT(32, ABSTRACT_MONSTER),
|
||||||
SILVERFISH(77, ABSTRACT_MONSTER),
|
SILVERFISH(78, ABSTRACT_MONSTER),
|
||||||
VEX(97, ABSTRACT_MONSTER),
|
VEX(99, ABSTRACT_MONSTER),
|
||||||
WITCH(102, ABSTRACT_MONSTER),
|
WITCH(103, ABSTRACT_MONSTER),
|
||||||
WITHER(103, ABSTRACT_MONSTER),
|
WITHER(104, ABSTRACT_MONSTER),
|
||||||
RAVAGER(72, ABSTRACT_MONSTER),
|
RAVAGER(73, ABSTRACT_MONSTER),
|
||||||
WARDEN(101, ABSTRACT_MONSTER),
|
|
||||||
|
|
||||||
ABSTRACT_PIGLIN(-1, ABSTRACT_MONSTER),
|
ABSTRACT_PIGLIN(-1, ABSTRACT_MONSTER),
|
||||||
|
|
||||||
PIGLIN(65, ABSTRACT_PIGLIN),
|
PIGLIN(66, ABSTRACT_PIGLIN),
|
||||||
PIGLIN_BRUTE(66, ABSTRACT_PIGLIN),
|
PIGLIN_BRUTE(67, ABSTRACT_PIGLIN),
|
||||||
|
|
||||||
HOGLIN(36, ABSTRACT_ANIMAL),
|
HOGLIN(37, ABSTRACT_ANIMAL),
|
||||||
STRIDER(88, ABSTRACT_ANIMAL),
|
STRIDER(89, ABSTRACT_ANIMAL),
|
||||||
ZOGLIN(107, ABSTRACT_MONSTER),
|
TADPOLE(89, ABSTRACT_FISHES),
|
||||||
|
ZOGLIN(108, ABSTRACT_MONSTER),
|
||||||
|
|
||||||
// Illagers
|
// Illagers
|
||||||
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
|
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
|
||||||
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
|
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
|
||||||
EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
|
EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||||
ILLUSIONER(39, ABSTRACT_EVO_ILLU_ILLAGER),
|
ILLUSIONER(40, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||||
VINDICATOR(99, ABSTRACT_ILLAGER_BASE),
|
VINDICATOR(101, ABSTRACT_ILLAGER_BASE),
|
||||||
PILLAGER(67, ABSTRACT_ILLAGER_BASE),
|
PILLAGER(68, ABSTRACT_ILLAGER_BASE),
|
||||||
|
|
||||||
// Skeletons
|
// Skeletons
|
||||||
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
|
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
|
||||||
SKELETON(78, ABSTRACT_SKELETON),
|
SKELETON(79, ABSTRACT_SKELETON),
|
||||||
STRAY(87, ABSTRACT_SKELETON),
|
STRAY(88, ABSTRACT_SKELETON),
|
||||||
WITHER_SKELETON(104, ABSTRACT_SKELETON),
|
WITHER_SKELETON(105, ABSTRACT_SKELETON),
|
||||||
|
|
||||||
// Guardians
|
// Guardians
|
||||||
GUARDIAN(35, ABSTRACT_MONSTER),
|
GUARDIAN(36, ABSTRACT_MONSTER),
|
||||||
ELDER_GUARDIAN(18, GUARDIAN),
|
ELDER_GUARDIAN(18, GUARDIAN),
|
||||||
|
|
||||||
// Spiders
|
// Spiders
|
||||||
SPIDER(85, ABSTRACT_MONSTER),
|
SPIDER(86, ABSTRACT_MONSTER),
|
||||||
CAVE_SPIDER(9, SPIDER),
|
CAVE_SPIDER(9, SPIDER),
|
||||||
|
|
||||||
// Zombies
|
// Zombies
|
||||||
ZOMBIE(108, ABSTRACT_MONSTER),
|
ZOMBIE(109, ABSTRACT_MONSTER),
|
||||||
DROWNED(17, ZOMBIE),
|
DROWNED(17, ZOMBIE),
|
||||||
HUSK(38, ZOMBIE),
|
HUSK(39, ZOMBIE),
|
||||||
ZOMBIFIED_PIGLIN(111, ZOMBIE),
|
ZOMBIFIED_PIGLIN(112, ZOMBIE),
|
||||||
ZOMBIE_VILLAGER(110, ZOMBIE),
|
ZOMBIE_VILLAGER(111, ZOMBIE),
|
||||||
|
|
||||||
// Flying entities
|
// Flying entities
|
||||||
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
|
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
|
||||||
GHAST(30, ABSTRACT_FLYING),
|
GHAST(31, ABSTRACT_FLYING),
|
||||||
PHANTOM(63, ABSTRACT_FLYING),
|
PHANTOM(64, ABSTRACT_FLYING),
|
||||||
|
|
||||||
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
|
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
|
||||||
BAT(4, ABSTRACT_AMBIENT),
|
BAT(4, ABSTRACT_AMBIENT),
|
||||||
|
|
||||||
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
|
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
|
||||||
SQUID(86, ABSTRACT_WATERMOB),
|
SQUID(87, ABSTRACT_WATERMOB),
|
||||||
GLOW_SQUID(33, SQUID),
|
GLOW_SQUID(34, SQUID),
|
||||||
|
|
||||||
// Slimes
|
// Slimes
|
||||||
SLIME(80, ABSTRACT_INSENTIENT),
|
SLIME(81, ABSTRACT_INSENTIENT),
|
||||||
MAGMA_CUBE(48, SLIME),
|
MAGMA_CUBE(49, SLIME),
|
||||||
|
|
||||||
// Hangable objects
|
// Hangable objects
|
||||||
ABSTRACT_HANGING(-1, ENTITY),
|
ABSTRACT_HANGING(-1, ENTITY),
|
||||||
LEASH_KNOT(44, ABSTRACT_HANGING),
|
LEASH_KNOT(45, ABSTRACT_HANGING),
|
||||||
ITEM_FRAME(42, ABSTRACT_HANGING),
|
ITEM_FRAME(43, ABSTRACT_HANGING),
|
||||||
GLOW_ITEM_FRAME(32, ITEM_FRAME),
|
GLOW_ITEM_FRAME(33, ITEM_FRAME),
|
||||||
PAINTING(60, ABSTRACT_HANGING),
|
PAINTING(61, ABSTRACT_HANGING),
|
||||||
|
|
||||||
ABSTRACT_LIGHTNING(-1, ENTITY),
|
ABSTRACT_LIGHTNING(-1, ENTITY),
|
||||||
LIGHTNING_BOLT(45, ABSTRACT_LIGHTNING),
|
LIGHTNING_BOLT(46, ABSTRACT_LIGHTNING),
|
||||||
|
|
||||||
// Arrows
|
// Arrows
|
||||||
ABSTRACT_ARROW(-1, ENTITY),
|
ABSTRACT_ARROW(-1, ENTITY),
|
||||||
ARROW(2, ABSTRACT_ARROW),
|
ARROW(2, ABSTRACT_ARROW),
|
||||||
SPECTRAL_ARROW(84, ABSTRACT_ARROW),
|
SPECTRAL_ARROW(85, ABSTRACT_ARROW),
|
||||||
TRIDENT(93, ABSTRACT_ARROW),
|
TRIDENT(95, ABSTRACT_ARROW),
|
||||||
|
|
||||||
// Fireballs
|
// Fireballs
|
||||||
ABSTRACT_FIREBALL(-1, ENTITY),
|
ABSTRACT_FIREBALL(-1, ENTITY),
|
||||||
DRAGON_FIREBALL(16, ABSTRACT_FIREBALL),
|
DRAGON_FIREBALL(16, ABSTRACT_FIREBALL),
|
||||||
FIREBALL(43, ABSTRACT_FIREBALL),
|
FIREBALL(44, ABSTRACT_FIREBALL),
|
||||||
SMALL_FIREBALL(81, ABSTRACT_FIREBALL),
|
SMALL_FIREBALL(82, ABSTRACT_FIREBALL),
|
||||||
WITHER_SKULL(105, ABSTRACT_FIREBALL),
|
WITHER_SKULL(106, ABSTRACT_FIREBALL),
|
||||||
|
|
||||||
// Projectiles
|
// Projectiles
|
||||||
PROJECTILE_ABSTRACT(-1, ENTITY),
|
PROJECTILE_ABSTRACT(-1, ENTITY),
|
||||||
SNOWBALL(83, PROJECTILE_ABSTRACT),
|
SNOWBALL(84, PROJECTILE_ABSTRACT),
|
||||||
ENDER_PEARL(90, PROJECTILE_ABSTRACT),
|
ENDER_PEARL(92, PROJECTILE_ABSTRACT),
|
||||||
EGG(89, PROJECTILE_ABSTRACT),
|
EGG(91, PROJECTILE_ABSTRACT),
|
||||||
POTION(92, PROJECTILE_ABSTRACT),
|
POTION(94, PROJECTILE_ABSTRACT),
|
||||||
EXPERIENCE_BOTTLE(91, PROJECTILE_ABSTRACT),
|
EXPERIENCE_BOTTLE(93, PROJECTILE_ABSTRACT),
|
||||||
|
|
||||||
// Vehicles
|
// Vehicles
|
||||||
MINECART_ABSTRACT(-1, ENTITY),
|
MINECART_ABSTRACT(-1, ENTITY),
|
||||||
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT),
|
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT),
|
||||||
CHEST_MINECART(51, CHESTED_MINECART_ABSTRACT),
|
CHEST_MINECART(52, CHESTED_MINECART_ABSTRACT),
|
||||||
HOPPER_MINECART(54, CHESTED_MINECART_ABSTRACT),
|
HOPPER_MINECART(55, CHESTED_MINECART_ABSTRACT),
|
||||||
MINECART(50, MINECART_ABSTRACT),
|
MINECART(51, MINECART_ABSTRACT),
|
||||||
FURNACE_MINECART(53, MINECART_ABSTRACT),
|
FURNACE_MINECART(54, MINECART_ABSTRACT),
|
||||||
COMMAND_BLOCK_MINECART(52, MINECART_ABSTRACT),
|
COMMAND_BLOCK_MINECART(53, MINECART_ABSTRACT),
|
||||||
TNT_MINECART(56, MINECART_ABSTRACT),
|
TNT_MINECART(57, MINECART_ABSTRACT),
|
||||||
SPAWNER_MINECART(55, MINECART_ABSTRACT),
|
SPAWNER_MINECART(56, MINECART_ABSTRACT),
|
||||||
BOAT(7, ENTITY);
|
BOAT(7, ENTITY);
|
||||||
|
|
||||||
private static final EntityType[] TYPES;
|
private static final EntityType[] TYPES;
|
||||||
|
@ -80,7 +80,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_17_1 = register(756, "1.17.1");
|
public static final ProtocolVersion v1_17_1 = register(756, "1.17.1");
|
||||||
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
|
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
|
||||||
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, 69, "1.19");
|
public static final ProtocolVersion v1_19 = register(759, 74, "1.19");
|
||||||
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) {
|
||||||
|
@ -171,9 +171,9 @@ public class ProtocolManagerImpl implements ProtocolManager {
|
|||||||
registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
|
registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
|
||||||
registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
|
registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
|
||||||
registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
|
registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
|
||||||
//registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18); //TODO
|
registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18);
|
||||||
|
|
||||||
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18);
|
registerProtocol(new Protocol1_19To1_18_2(), ProtocolVersion.v1_19, ProtocolVersion.v1_18_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,9 +26,10 @@ public enum ClientboundPackets1_19 implements ClientboundPacketType {
|
|||||||
SPAWN_MOB, // 0x02
|
SPAWN_MOB, // 0x02
|
||||||
SPAWN_PAINTING, // 0x03
|
SPAWN_PAINTING, // 0x03
|
||||||
SPAWN_PLAYER, // 0x04
|
SPAWN_PLAYER, // 0x04
|
||||||
|
ADD_VIBRATION_SIGNAL, // 0x05
|
||||||
ENTITY_ANIMATION, // 0x06
|
ENTITY_ANIMATION, // 0x06
|
||||||
STATISTICS, // 0x07
|
STATISTICS, // 0x07
|
||||||
ACKNOWLEDGE_PLAYER_DIGGING, // 0x08
|
BLOCK_CHANGED_ACK, // 0x08
|
||||||
BLOCK_BREAK_ANIMATION, // 0x09
|
BLOCK_BREAK_ANIMATION, // 0x09
|
||||||
BLOCK_ENTITY_DATA, // 0x0A
|
BLOCK_ENTITY_DATA, // 0x0A
|
||||||
BLOCK_ACTION, // 0x0B
|
BLOCK_ACTION, // 0x0B
|
||||||
|
@ -17,28 +17,31 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2;
|
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||||
import com.viaversion.viaversion.api.data.MappingData;
|
|
||||||
import com.viaversion.viaversion.api.data.MappingDataBase;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.RegistryType;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19Types;
|
||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
import com.viaversion.viaversion.api.type.types.minecraft.ParticleType;
|
||||||
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
||||||
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
import com.viaversion.viaversion.data.entity.EntityTrackerBase;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.data.MappingData;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.EntityPackets;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.EntityPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.InventoryPackets;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.InventoryPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.WorldPackets;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets.WorldPackets;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.storage.SequenceStorage;
|
||||||
|
import com.viaversion.viaversion.rewriter.CommandRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||||
|
|
||||||
public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPackets1_18, ClientboundPackets1_19, ServerboundPackets1_17, ServerboundPackets1_17> {
|
public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPackets1_18, ClientboundPackets1_19, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||||
|
|
||||||
public static final MappingData MAPPINGS = new MappingDataBase("1.18", "1.19");
|
public static final MappingData MAPPINGS = new MappingData();
|
||||||
private final EntityPackets entityRewriter = new EntityPackets(this);
|
private final EntityPackets entityRewriter = new EntityPackets(this);
|
||||||
private final InventoryPackets itemRewriter = new InventoryPackets(this);
|
private final InventoryPackets itemRewriter = new InventoryPackets(this);
|
||||||
|
|
||||||
@ -49,21 +52,60 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
|
|||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
final TagRewriter tagRewriter = new TagRewriter(this);
|
final TagRewriter tagRewriter = new TagRewriter(this);
|
||||||
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:fall_damage_resetting"); //TODO
|
/*tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:fall_damage_resetting"); //TODO check if needed
|
||||||
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:fall_damage_resetting", "minecraft:sculk_replaceable",
|
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:fall_damage_resetting", "minecraft:sculk_replaceable",
|
||||||
"minecraft:ancient_city_replaceables", "minecraft:deepslate_blocks", "minecraft:sculk_replaceable_world_gen", "minecraft:skip_occlude_vibration_when_above");
|
"minecraft:ancient_city_replaceables", "minecraft:deepslate_blocks", "minecraft:sculk_replaceable_world_gen", "minecraft:skip_occlude_vibration_when_above");
|
||||||
tagRewriter.addEmptyTag(RegistryType.GAME_EVENT, "minecraft:warden_events_can_listen");
|
tagRewriter.addEmptyTag(RegistryType.GAME_EVENT, "minecraft:warden_events_can_listen");*/
|
||||||
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
|
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
|
||||||
|
|
||||||
entityRewriter.register();
|
entityRewriter.register();
|
||||||
itemRewriter.register();
|
itemRewriter.register();
|
||||||
WorldPackets.register(this);
|
WorldPackets.register(this);
|
||||||
|
|
||||||
cancelClientbound(ClientboundPackets1_18.ADD_VIBRATION_SIGNAL);
|
//cancelClientbound(ClientboundPackets1_18.ADD_VIBRATION_SIGNAL); //TODO experimental snapshot
|
||||||
|
|
||||||
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
final SoundRewriter soundRewriter = new SoundRewriter(this);
|
||||||
soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
|
soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
|
||||||
soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
|
soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
|
||||||
|
|
||||||
|
final CommandRewriter commandRewriter = new CommandRewriter(this);
|
||||||
|
registerClientbound(ClientboundPackets1_18.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 String argumentType = wrapper.read(Type.STRING);
|
||||||
|
final int argumentTypeId = MAPPINGS.argumentTypeIds().getInt(argumentType.replace("minecraft:", ""));
|
||||||
|
if (argumentTypeId == -1) {
|
||||||
|
Via.getPlatform().getLogger().warning("Unknown command argument type: " + argumentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.write(Type.VAR_INT, argumentTypeId);
|
||||||
|
commandRewriter.handleArgument(wrapper, argumentType);
|
||||||
|
|
||||||
|
if ((flags & 0x10) != 0) {
|
||||||
|
wrapper.passthrough(Type.STRING); // Suggestion type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.passthrough(Type.VAR_INT); // Root node index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,6 +124,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final UserConnection user) {
|
public void init(final UserConnection user) {
|
||||||
|
user.put(new SequenceStorage());
|
||||||
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
|
addEntityTracker(user, new EntityTrackerBase(user, Entity1_19Types.PLAYER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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_19to1_18_2.data;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.viaversion.viaversion.api.data.MappingDataBase;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
public final class MappingData extends MappingDataBase {
|
||||||
|
|
||||||
|
private final Object2IntMap<String> argumentTypeIds = new Object2IntOpenHashMap<>();
|
||||||
|
|
||||||
|
public MappingData() {
|
||||||
|
super("1.18", "1.19");
|
||||||
|
argumentTypeIds.defaultReturnValue(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadExtras(final JsonObject oldMappings, final JsonObject newMappings, @Nullable final JsonObject diffMappings) {
|
||||||
|
int i = 0;
|
||||||
|
for (final JsonElement element : newMappings.getAsJsonArray("argumenttypes")) {
|
||||||
|
final String id = element.getAsString();
|
||||||
|
argumentTypeIds.put(id, i++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object2IntMap<String> argumentTypeIds() {
|
||||||
|
return argumentTypeIds;
|
||||||
|
}
|
||||||
|
}
|
@ -17,11 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets;
|
package com.viaversion.viaversion.protocols.protocol1_19to1_18_2.packets;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||||
|
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.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||||
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_19to1_18_2.storage.SequenceStorage;
|
||||||
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||||
|
|
||||||
public final class InventoryPackets extends ItemRewriter<Protocol1_19To1_18_2> {
|
public final class InventoryPackets extends ItemRewriter<Protocol1_19To1_18_2> {
|
||||||
@ -38,11 +41,63 @@ public final class InventoryPackets extends ItemRewriter<Protocol1_19To1_18_2> {
|
|||||||
registerSetSlot1_17_1(ClientboundPackets1_18.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
registerSetSlot1_17_1(ClientboundPackets1_18.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
|
||||||
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, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerSpawnParticle(ClientboundPackets1_18.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
|
protocol.registerClientbound(ClientboundPackets1_18.SPAWN_PARTICLE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT, Type.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(getSpawnParticleHandler(Type.FLAT_VAR_INT_ITEM));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
registerClickWindow1_17_1(ServerboundPackets1_17.CLICK_WINDOW, Type.FLAT_VAR_INT_ITEM);
|
||||||
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
|
||||||
|
|
||||||
|
protocol.registerServerbound(ServerboundPackets1_17.PLAYER_DIGGING, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // Action
|
||||||
|
map(Type.POSITION1_14); // Block position
|
||||||
|
map(Type.UNSIGNED_BYTE); // Direction
|
||||||
|
handler(sequenceHandler());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
protocol.registerServerbound(ServerboundPackets1_17.PLAYER_BLOCK_PLACEMENT, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // Hand
|
||||||
|
map(Type.POSITION1_14); // Block position
|
||||||
|
map(Type.VAR_INT); // Direction
|
||||||
|
map(Type.FLOAT); // X
|
||||||
|
map(Type.FLOAT); // Y
|
||||||
|
map(Type.FLOAT); // Z
|
||||||
|
map(Type.BOOLEAN); // Inside
|
||||||
|
handler(sequenceHandler());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
protocol.registerServerbound(ServerboundPackets1_17.USE_ITEM, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // Hand
|
||||||
|
handler(sequenceHandler());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_18.DECLARE_RECIPES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PacketHandler sequenceHandler() {
|
||||||
|
return wrapper -> {
|
||||||
|
final int sequence = wrapper.read(Type.VAR_INT);
|
||||||
|
wrapper.user().get(SequenceStorage.class).setSequence(sequence);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,9 @@ 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.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.types.Chunk1_18Type;
|
||||||
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_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_19to1_18_2.storage.SequenceStorage;
|
||||||
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
import com.viaversion.viaversion.rewriter.BlockRewriter;
|
||||||
import com.viaversion.viaversion.util.MathUtil;
|
import com.viaversion.viaversion.util.MathUtil;
|
||||||
|
|
||||||
@ -37,9 +39,19 @@ public final class WorldPackets {
|
|||||||
blockRewriter.registerBlockAction(ClientboundPackets1_18.BLOCK_ACTION);
|
blockRewriter.registerBlockAction(ClientboundPackets1_18.BLOCK_ACTION);
|
||||||
blockRewriter.registerBlockChange(ClientboundPackets1_18.BLOCK_CHANGE);
|
blockRewriter.registerBlockChange(ClientboundPackets1_18.BLOCK_CHANGE);
|
||||||
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_18.MULTI_BLOCK_CHANGE);
|
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_18.MULTI_BLOCK_CHANGE);
|
||||||
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING);
|
|
||||||
blockRewriter.registerEffect(ClientboundPackets1_18.EFFECT, 1010, 2001);
|
blockRewriter.registerEffect(ClientboundPackets1_18.EFFECT, 1010, 2001);
|
||||||
|
|
||||||
|
protocol.registerClientbound(ClientboundPackets1_18.ACKNOWLEDGE_PLAYER_DIGGING, ClientboundPackets1_19.BLOCK_CHANGED_ACK, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
read(Type.POSITION1_14);
|
||||||
|
read(Type.VAR_INT);
|
||||||
|
read(Type.VAR_INT);
|
||||||
|
read(Type.BOOLEAN);
|
||||||
|
handler(wrapper -> wrapper.write(Type.VAR_INT, wrapper.user().get(SequenceStorage.class).sequence()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_18.CHUNK_DATA, new PacketRemapper() {
|
protocol.registerClientbound(ClientboundPackets1_18.CHUNK_DATA, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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_19to1_18_2.storage;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.connection.StorableObject;
|
||||||
|
|
||||||
|
public final class SequenceStorage implements StorableObject {
|
||||||
|
|
||||||
|
private int sequence;
|
||||||
|
|
||||||
|
public void setSequence(final int sequence) {
|
||||||
|
this.sequence = sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int sequence() {
|
||||||
|
return sequence;
|
||||||
|
}
|
||||||
|
}
|
@ -30,11 +30,11 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Abstract rewriter for the declare commands packet to handle argument type name and content changes.
|
* Abstract rewriter for the declare commands packet to handle argument type name and content changes.
|
||||||
*/
|
*/
|
||||||
public abstract class CommandRewriter {
|
public class CommandRewriter {
|
||||||
protected final Protocol protocol;
|
protected final Protocol protocol;
|
||||||
protected final Map<String, CommandArgumentConsumer> parserHandlers = new HashMap<>();
|
protected final Map<String, CommandArgumentConsumer> parserHandlers = new HashMap<>();
|
||||||
|
|
||||||
protected CommandRewriter(Protocol protocol) {
|
public CommandRewriter(Protocol protocol) {
|
||||||
this.protocol = protocol;
|
this.protocol = protocol;
|
||||||
|
|
||||||
// Register default parsers
|
// Register default parsers
|
||||||
|
@ -299,6 +299,25 @@ public abstract class ItemRewriter<T extends Protocol> extends RewriterBase<T> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerSpawnParticle1_19(ClientboundPacketType packetType, Type<Item> itemType, Type<?> coordType) {
|
||||||
|
protocol.registerClientbound(packetType, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT); // 0 - Particle ID
|
||||||
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
|
map(coordType); // 2 - X
|
||||||
|
map(coordType); // 3 - Y
|
||||||
|
map(coordType); // 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(getSpawnParticleHandler(itemType));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public PacketHandler getSpawnParticleHandler(Type<Item> itemType) {
|
public PacketHandler getSpawnParticleHandler(Type<Item> itemType) {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
int id = wrapper.get(Type.INT, 0);
|
int id = wrapper.get(Type.INT, 0);
|
||||||
|
@ -23676,5 +23676,53 @@
|
|||||||
"campfire",
|
"campfire",
|
||||||
"beehive",
|
"beehive",
|
||||||
"sculk_sensor"
|
"sculk_sensor"
|
||||||
|
],
|
||||||
|
"argumenttypes": [
|
||||||
|
"brigadier:bool",
|
||||||
|
"brigadier:float",
|
||||||
|
"brigadier:double",
|
||||||
|
"brigadier:integer",
|
||||||
|
"brigadier:long",
|
||||||
|
"brigadier:string",
|
||||||
|
"entity",
|
||||||
|
"game_profile",
|
||||||
|
"block_pos",
|
||||||
|
"column_pos",
|
||||||
|
"vec3",
|
||||||
|
"vec2",
|
||||||
|
"block_state",
|
||||||
|
"block_predicate",
|
||||||
|
"item_stack",
|
||||||
|
"item_predicate",
|
||||||
|
"color",
|
||||||
|
"component",
|
||||||
|
"message",
|
||||||
|
"nbt_compound_tag",
|
||||||
|
"nbt_tag",
|
||||||
|
"nbt_path",
|
||||||
|
"objective",
|
||||||
|
"objective_criteria",
|
||||||
|
"operation",
|
||||||
|
"particle",
|
||||||
|
"angle",
|
||||||
|
"rotation",
|
||||||
|
"scoreboard_slot",
|
||||||
|
"score_holder",
|
||||||
|
"swizzle",
|
||||||
|
"team",
|
||||||
|
"item_slot",
|
||||||
|
"resource_location",
|
||||||
|
"mob_effect",
|
||||||
|
"function",
|
||||||
|
"entity_anchor",
|
||||||
|
"int_range",
|
||||||
|
"float_range",
|
||||||
|
"item_enchantment",
|
||||||
|
"entity_summon",
|
||||||
|
"dimension",
|
||||||
|
"time",
|
||||||
|
"uuid",
|
||||||
|
"resource",
|
||||||
|
"resource_or_tag"
|
||||||
]
|
]
|
||||||
}
|
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren