3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00
Dieser Commit ist enthalten in:
KennyTV 2020-06-05 00:42:39 +02:00
Ursprung eb9d913cb6
Commit 1285a0c6bf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
6 geänderte Dateien mit 228 neuen und 121 gelöschten Zeilen

Datei anzeigen

@ -31,9 +31,9 @@ public class Entity1_16Types {
FALLING_BLOCK(26, ENTITY), FALLING_BLOCK(26, ENTITY),
FIREWORK_ROCKET(27, ENTITY), FIREWORK_ROCKET(27, ENTITY),
ITEM(37, ENTITY), ITEM(37, ENTITY),
LLAMA_SPIT(42, ENTITY), LLAMA_SPIT(43, ENTITY),
TNT(62, ENTITY), TNT(63, ENTITY),
SHULKER_BULLET(69, ENTITY), SHULKER_BULLET(70, ENTITY),
FISHING_BOBBER(106, ENTITY), FISHING_BOBBER(106, ENTITY),
LIVINGENTITY(-1, ENTITY), LIVINGENTITY(-1, ENTITY),
@ -48,54 +48,54 @@ public class Entity1_16Types {
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT), ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE), ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
VILLAGER(91, ABSTRACT_AGEABLE), VILLAGER(92, ABSTRACT_AGEABLE),
WANDERING_TRADER(93, ABSTRACT_AGEABLE), WANDERING_TRADER(94, ABSTRACT_AGEABLE),
// Animals // Animals
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE), ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
DOLPHIN(13, ABSTRACT_INSENTIENT), DOLPHIN(13, ABSTRACT_INSENTIENT),
CHICKEN(9, ABSTRACT_ANIMAL), CHICKEN(9, ABSTRACT_ANIMAL),
COW(11, ABSTRACT_ANIMAL), COW(11, ABSTRACT_ANIMAL),
MOOSHROOM(52, COW), MOOSHROOM(53, COW),
PANDA(55, ABSTRACT_INSENTIENT), PANDA(56, ABSTRACT_INSENTIENT),
PIG(58, ABSTRACT_ANIMAL), PIG(59, ABSTRACT_ANIMAL),
POLAR_BEAR(61, ABSTRACT_ANIMAL), POLAR_BEAR(62, ABSTRACT_ANIMAL),
RABBIT(64, ABSTRACT_ANIMAL), RABBIT(65, ABSTRACT_ANIMAL),
SHEEP(67, ABSTRACT_ANIMAL), SHEEP(68, ABSTRACT_ANIMAL),
TURTLE(89, ABSTRACT_ANIMAL), TURTLE(90, ABSTRACT_ANIMAL),
FOX(28, ABSTRACT_ANIMAL), FOX(28, ABSTRACT_ANIMAL),
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL), ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
CAT(7, ABSTRACT_TAMEABLE_ANIMAL), CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
OCELOT(53, ABSTRACT_TAMEABLE_ANIMAL), OCELOT(54, ABSTRACT_TAMEABLE_ANIMAL),
WOLF(98, ABSTRACT_TAMEABLE_ANIMAL), WOLF(99, ABSTRACT_TAMEABLE_ANIMAL),
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL), ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
PARROT(56, ABSTRACT_PARROT), PARROT(57, 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(14, CHESTED_HORSE), DONKEY(14, CHESTED_HORSE),
MULE(51, CHESTED_HORSE), MULE(52, CHESTED_HORSE),
LLAMA(41, CHESTED_HORSE), LLAMA(42, CHESTED_HORSE),
TRADER_LLAMA(87, CHESTED_HORSE), TRADER_LLAMA(88, CHESTED_HORSE),
HORSE(33, ABSTRACT_HORSE), HORSE(33, ABSTRACT_HORSE),
SKELETON_HORSE(72, ABSTRACT_HORSE), SKELETON_HORSE(73, ABSTRACT_HORSE),
ZOMBIE_HORSE(101, ABSTRACT_HORSE), ZOMBIE_HORSE(102, ABSTRACT_HORSE),
// Golem // Golem
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE), ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
SNOW_GOLEM(75, ABSTRACT_GOLEM), SNOW_GOLEM(76, ABSTRACT_GOLEM),
IRON_GOLEM(36, ABSTRACT_GOLEM), IRON_GOLEM(36, ABSTRACT_GOLEM),
SHULKER(68, ABSTRACT_GOLEM), SHULKER(69, ABSTRACT_GOLEM),
// Fish // Fish
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE), ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
COD(10, ABSTRACT_FISHES), COD(10, ABSTRACT_FISHES),
PUFFERFISH(63, ABSTRACT_FISHES), PUFFERFISH(64, ABSTRACT_FISHES),
SALMON(66, ABSTRACT_FISHES), SALMON(67, ABSTRACT_FISHES),
TROPICAL_FISH(88, ABSTRACT_FISHES), TROPICAL_FISH(89, ABSTRACT_FISHES),
// Monsters // Monsters
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE), ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
@ -104,101 +104,101 @@ public class Entity1_16Types {
ENDERMITE(21, ABSTRACT_MONSTER), ENDERMITE(21, ABSTRACT_MONSTER),
ENDERMAN(20, ABSTRACT_MONSTER), ENDERMAN(20, ABSTRACT_MONSTER),
GIANT(30, ABSTRACT_MONSTER), GIANT(30, ABSTRACT_MONSTER),
SILVERFISH(70, ABSTRACT_MONSTER), SILVERFISH(71, ABSTRACT_MONSTER),
VEX(90, ABSTRACT_MONSTER), VEX(91, ABSTRACT_MONSTER),
WITCH(94, ABSTRACT_MONSTER), WITCH(95, ABSTRACT_MONSTER),
WITHER(95, ABSTRACT_MONSTER), WITHER(96, ABSTRACT_MONSTER),
RAVAGER(65, ABSTRACT_MONSTER), RAVAGER(66, ABSTRACT_MONSTER),
PIGLIN(59, ABSTRACT_MONSTER), PIGLIN(60, ABSTRACT_MONSTER),
HOGLIN(32, ABSTRACT_ANIMAL), HOGLIN(32, ABSTRACT_ANIMAL),
STRIDER(81, ABSTRACT_ANIMAL), STRIDER(82, ABSTRACT_ANIMAL),
ZOGLIN(99, ABSTRACT_MONSTER), ZOGLIN(100, 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(22, ABSTRACT_EVO_ILLU_ILLAGER), EVOKER(22, ABSTRACT_EVO_ILLU_ILLAGER),
ILLUSIONER(35, ABSTRACT_EVO_ILLU_ILLAGER), ILLUSIONER(35, ABSTRACT_EVO_ILLU_ILLAGER),
VINDICATOR(92, ABSTRACT_ILLAGER_BASE), VINDICATOR(93, ABSTRACT_ILLAGER_BASE),
PILLAGER(60, ABSTRACT_ILLAGER_BASE), PILLAGER(61, ABSTRACT_ILLAGER_BASE),
// Skeletons // Skeletons
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER), ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
SKELETON(71, ABSTRACT_SKELETON), SKELETON(72, ABSTRACT_SKELETON),
STRAY(80, ABSTRACT_SKELETON), STRAY(81, ABSTRACT_SKELETON),
WITHER_SKELETON(96, ABSTRACT_SKELETON), WITHER_SKELETON(97, ABSTRACT_SKELETON),
// Guardians // Guardians
GUARDIAN(31, ABSTRACT_MONSTER), GUARDIAN(31, ABSTRACT_MONSTER),
ELDER_GUARDIAN(17, GUARDIAN), ELDER_GUARDIAN(17, GUARDIAN),
// Spiders // Spiders
SPIDER(78, ABSTRACT_MONSTER), SPIDER(79, ABSTRACT_MONSTER),
CAVE_SPIDER(8, SPIDER), CAVE_SPIDER(8, SPIDER),
// Zombies // Zombies
ZOMBIE(100, ABSTRACT_MONSTER), ZOMBIE(101, ABSTRACT_MONSTER),
DROWNED(16, ZOMBIE), DROWNED(16, ZOMBIE),
HUSK(34, ZOMBIE), HUSK(34, ZOMBIE),
ZOMBIFIED_PIGLIN(103, ZOMBIE), ZOMBIFIED_PIGLIN(104, ZOMBIE),
ZOMBIE_VILLAGER(102, ZOMBIE), ZOMBIE_VILLAGER(103, ZOMBIE),
// Flying entities // Flying entities
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT), ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
GHAST(29, ABSTRACT_FLYING), GHAST(29, ABSTRACT_FLYING),
PHANTOM(57, ABSTRACT_FLYING), PHANTOM(58, ABSTRACT_FLYING),
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT), ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
BAT(3, ABSTRACT_AMBIENT), BAT(3, ABSTRACT_AMBIENT),
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT), ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
SQUID(79, ABSTRACT_WATERMOB), SQUID(80, ABSTRACT_WATERMOB),
// Slimes // Slimes
SLIME(73, ABSTRACT_INSENTIENT), SLIME(74, ABSTRACT_INSENTIENT),
MAGMA_CUBE(43, SLIME), MAGMA_CUBE(44, SLIME),
// Hangable objects // Hangable objects
ABSTRACT_HANGING(-1, ENTITY), ABSTRACT_HANGING(-1, ENTITY),
LEASH_KNOT(40, ABSTRACT_HANGING), LEASH_KNOT(40, ABSTRACT_HANGING),
ITEM_FRAME(38, ABSTRACT_HANGING), ITEM_FRAME(38, ABSTRACT_HANGING),
PAINTING(54, ABSTRACT_HANGING), PAINTING(55, ABSTRACT_HANGING),
ABSTRACT_LIGHTNING(-1, ENTITY), ABSTRACT_LIGHTNING(-1, ENTITY),
LIGHTNING_BOLT(104, ABSTRACT_LIGHTNING), LIGHTNING_BOLT(41, ABSTRACT_LIGHTNING),
// Arrows // Arrows
ABSTRACT_ARROW(-1, ENTITY), ABSTRACT_ARROW(-1, ENTITY),
ARROW(2, ABSTRACT_ARROW), ARROW(2, ABSTRACT_ARROW),
SPECTRAL_ARROW(77, ABSTRACT_ARROW), SPECTRAL_ARROW(78, ABSTRACT_ARROW),
TRIDENT(86, ABSTRACT_ARROW), TRIDENT(87, ABSTRACT_ARROW),
// Fireballs // Fireballs
ABSTRACT_FIREBALL(-1, ENTITY), ABSTRACT_FIREBALL(-1, ENTITY),
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL), DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
FIREBALL(39, ABSTRACT_FIREBALL), FIREBALL(39, ABSTRACT_FIREBALL),
SMALL_FIREBALL(74, ABSTRACT_FIREBALL), SMALL_FIREBALL(75, ABSTRACT_FIREBALL),
WITHER_SKULL(97, ABSTRACT_FIREBALL), WITHER_SKULL(98, ABSTRACT_FIREBALL),
// Projectiles // Projectiles
PROJECTILE_ABSTRACT(-1, ENTITY), PROJECTILE_ABSTRACT(-1, ENTITY),
SNOWBALL(76, PROJECTILE_ABSTRACT), SNOWBALL(77, PROJECTILE_ABSTRACT),
ENDER_PEARL(83, PROJECTILE_ABSTRACT), ENDER_PEARL(84, PROJECTILE_ABSTRACT),
EGG(82, PROJECTILE_ABSTRACT), EGG(83, PROJECTILE_ABSTRACT),
POTION(85, PROJECTILE_ABSTRACT), POTION(86, PROJECTILE_ABSTRACT),
EXPERIENCE_BOTTLE(84, PROJECTILE_ABSTRACT), EXPERIENCE_BOTTLE(85, 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(45, CHESTED_MINECART_ABSTRACT), CHEST_MINECART(46, CHESTED_MINECART_ABSTRACT),
HOPPER_MINECART(48, CHESTED_MINECART_ABSTRACT), HOPPER_MINECART(49, CHESTED_MINECART_ABSTRACT),
MINECART(44, MINECART_ABSTRACT), MINECART(45, MINECART_ABSTRACT),
FURNACE_MINECART(47, MINECART_ABSTRACT), FURNACE_MINECART(48, MINECART_ABSTRACT),
COMMAND_BLOCK_MINECART(46, MINECART_ABSTRACT), COMMAND_BLOCK_MINECART(47, MINECART_ABSTRACT),
TNT_MINECART(50, MINECART_ABSTRACT), TNT_MINECART(51, MINECART_ABSTRACT),
SPAWNER_MINECART(49, MINECART_ABSTRACT), SPAWNER_MINECART(50, MINECART_ABSTRACT),
BOAT(6, ENTITY); BOAT(6, ENTITY);
private static final Map<Integer, EntityType> TYPES = new HashMap<>(); private static final Map<Integer, EntityType> TYPES = new HashMap<>();

Datei anzeigen

@ -80,7 +80,7 @@ public class ProtocolVersion {
register(v1_15 = new ProtocolVersion(573, "1.15")); register(v1_15 = new ProtocolVersion(573, "1.15"));
register(v1_15_1 = new ProtocolVersion(575, "1.15.1")); register(v1_15_1 = new ProtocolVersion(575, "1.15.1"));
register(v1_15_2 = new ProtocolVersion(578, "1.15.2")); register(v1_15_2 = new ProtocolVersion(578, "1.15.2"));
register(v1_16 = new ProtocolVersion(719, "1.16")); register(v1_16 = new ProtocolVersion(721, "1.16"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

Datei anzeigen

@ -37,7 +37,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
InventoryPackets.register(this); InventoryPackets.register(this);
tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId); tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
tagRewriter.register(0x5C, 0x5C); tagRewriter.register(0x5C, 0x5B);
// Login Success // Login Success
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() { registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
@ -52,7 +52,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
}); });
// Chat Message // Chat Message
registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() { registerOutgoing(State.PLAY, 0x0F, 0x0E, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.STRING); map(Type.STRING);
@ -62,19 +62,11 @@ public class Protocol1_16To1_15_2 extends Protocol {
}); });
SoundRewriter soundRewriter = new SoundRewriter(this, id -> MappingData.soundMappings.getNewId(id)); SoundRewriter soundRewriter = new SoundRewriter(this, id -> MappingData.soundMappings.getNewId(id));
soundRewriter.registerSound(0x51, 0x51); soundRewriter.registerSound(0x51, 0x50);
soundRewriter.registerSound(0x52, 0x52); soundRewriter.registerSound(0x52, 0x51);
// Edit Book
registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
}
});
// Advancements // Advancements
registerOutgoing(State.PLAY, 0x58, 0x58, new PacketRemapper() { registerOutgoing(State.PLAY, 0x58, 0x57, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -112,23 +104,63 @@ public class Protocol1_16To1_15_2 extends Protocol {
} }
}); });
registerOutgoing(State.PLAY, 0x43, 0x44); registerOutgoing(State.PLAY, 0x04, 0x03);
registerOutgoing(State.PLAY, 0x06, 0x05);
registerOutgoing(State.PLAY, 0x45, 0x46); registerOutgoing(State.PLAY, 0x07, 0x06);
registerOutgoing(State.PLAY, 0x46, 0x47); registerOutgoing(State.PLAY, 0x09, 0x08);
registerOutgoing(State.PLAY, 0x0A, 0x09);
registerOutgoing(State.PLAY, 0x48, 0x49); registerOutgoing(State.PLAY, 0x0D, 0x0C);
registerOutgoing(State.PLAY, 0x49, 0x4A); registerOutgoing(State.PLAY, 0x0E, 0x0D);
registerOutgoing(State.PLAY, 0x4A, 0x4B); registerOutgoing(State.PLAY, 0x11, 0x10);
registerOutgoing(State.PLAY, 0x4B, 0x4C); registerOutgoing(State.PLAY, 0x12, 0x11);
registerOutgoing(State.PLAY, 0x4C, 0x4D); registerOutgoing(State.PLAY, 0x13, 0x12);
registerOutgoing(State.PLAY, 0x4D, 0x4E); registerOutgoing(State.PLAY, 0x14, 0x13);
registerOutgoing(State.PLAY, 0x4E, 0x43); registerOutgoing(State.PLAY, 0x19, 0x18);
registerOutgoing(State.PLAY, 0x1A, 0x19);
registerOutgoing(State.PLAY, 0x1B, 0x1A);
registerOutgoing(State.PLAY, 0x1C, 0x1B);
registerOutgoing(State.PLAY, 0x1D, 0x1C);
registerOutgoing(State.PLAY, 0x1E, 0x1D);
registerOutgoing(State.PLAY, 0x1F, 0x1E);
registerOutgoing(State.PLAY, 0x20, 0x1F);
registerOutgoing(State.PLAY, 0x21, 0x20);
registerOutgoing(State.PLAY, 0x25, 0x24);
registerOutgoing(State.PLAY, 0x27, 0x26);
registerOutgoing(State.PLAY, 0x29, 0x28);
registerOutgoing(State.PLAY, 0x2A, 0x29);
registerOutgoing(State.PLAY, 0x2B, 0x2A);
registerOutgoing(State.PLAY, 0x2C, 0x2B);
registerOutgoing(State.PLAY, 0x2D, 0x2C);
registerOutgoing(State.PLAY, 0x2E, 0x2D);
registerOutgoing(State.PLAY, 0x30, 0x2F);
registerOutgoing(State.PLAY, 0x31, 0x30);
registerOutgoing(State.PLAY, 0x32, 0x31);
registerOutgoing(State.PLAY, 0x33, 0x32);
registerOutgoing(State.PLAY, 0x34, 0x33);
registerOutgoing(State.PLAY, 0x35, 0x34);
registerOutgoing(State.PLAY, 0x36, 0x35);
registerOutgoing(State.PLAY, 0x37, 0x36);
registerOutgoing(State.PLAY, 0x39, 0x38);
registerOutgoing(State.PLAY, 0x3A, 0x39);
registerOutgoing(State.PLAY, 0x3C, 0x3B);
registerOutgoing(State.PLAY, 0x3D, 0x3C);
registerOutgoing(State.PLAY, 0x3E, 0x3D);
registerOutgoing(State.PLAY, 0x3F, 0x3E);
registerOutgoing(State.PLAY, 0x40, 0x3F);
registerOutgoing(State.PLAY, 0x41, 0x40);
registerOutgoing(State.PLAY, 0x42, 0x41);
registerOutgoing(State.PLAY, 0x4E, 0x42);
registerOutgoing(State.PLAY, 0x4F, 0x4E);
registerOutgoing(State.PLAY, 0x50, 0x4F);
registerOutgoing(State.PLAY, 0x53, 0x52);
registerOutgoing(State.PLAY, 0x54, 0x53);
registerOutgoing(State.PLAY, 0x55, 0x54);
registerOutgoing(State.PLAY, 0x56, 0x55);
registerOutgoing(State.PLAY, 0x57, 0x56);
registerOutgoing(State.PLAY, 0x5A, 0x59);
cancelIncoming(State.PLAY, 0x0F); // Generate jisaw cancelIncoming(State.PLAY, 0x0F); // Generate jisaw
cancelIncoming(State.PLAY, 0x28); // Jigsaw update cancelIncoming(State.PLAY, 0x28); // Jigsaw update
registerIncoming(State.PLAY, 0x0F, 0x10); registerIncoming(State.PLAY, 0x0F, 0x10);
registerIncoming(State.PLAY, 0x10, 0x11); registerIncoming(State.PLAY, 0x10, 0x11);
registerIncoming(State.PLAY, 0x11, 0x12); registerIncoming(State.PLAY, 0x11, 0x12);
@ -151,7 +183,6 @@ public class Protocol1_16To1_15_2 extends Protocol {
registerIncoming(State.PLAY, 0x22, 0x23); registerIncoming(State.PLAY, 0x22, 0x23);
registerIncoming(State.PLAY, 0x23, 0x24); registerIncoming(State.PLAY, 0x23, 0x24);
registerIncoming(State.PLAY, 0x24, 0x25); registerIncoming(State.PLAY, 0x24, 0x25);
registerIncoming(State.PLAY, 0x28, 0x29); registerIncoming(State.PLAY, 0x28, 0x29);
registerIncoming(State.PLAY, 0x29, 0x2A); registerIncoming(State.PLAY, 0x29, 0x2A);
registerIncoming(State.PLAY, 0x2A, 0x2B); registerIncoming(State.PLAY, 0x2A, 0x2B);

Datei anzeigen

@ -1,7 +1,10 @@
package us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets; package us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets;
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.FloatTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.LongTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.StringTag;
import us.myles.ViaVersion.api.PacketWrapper; import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
@ -19,6 +22,8 @@ import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.metadata.MetadataRewri
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import java.util.UUID;
public class EntityPackets { public class EntityPackets {
private static final PacketHandler DIMENSION_HANDLER = wrapper -> { private static final PacketHandler DIMENSION_HANDLER = wrapper -> {
@ -47,39 +52,102 @@ public class EntityPackets {
static { static {
ListTag list = new ListTag("dimension", CompoundTag.class); ListTag list = new ListTag("dimension", CompoundTag.class);
list.add(createDimensionEntry("minecraft:overworld")); list.add(createOverworldEntry());
list.add(createDimensionEntry("minecraft:the_nether")); list.add(createNetherEntry());
list.add(createDimensionEntry("minecraft:the_end")); list.add(createEndEntry());
DIMENSIONS_TAG.put(list); DIMENSIONS_TAG.put(list);
} }
private static CompoundTag createDimensionEntry(String dimension) { private static CompoundTag createOverworldEntry() {
CompoundTag tag = new CompoundTag(""); CompoundTag tag = new CompoundTag("");
tag.put(new StringTag("key", dimension)); tag.put(new StringTag("key", "minecraft:overworld"));
tag.put(new StringTag("element", dimension)); CompoundTag elementTag = new CompoundTag("element");
elementTag.put(new ByteTag("natural", (byte) 1));
elementTag.put(new FloatTag("ambient_light", 0));
elementTag.put(new ByteTag("shrunk", (byte) 0));
elementTag.put(new ByteTag("ultrawarm", (byte) 0));
elementTag.put(new ByteTag("has_ceiling", (byte) 0));
elementTag.put(new ByteTag("has_skylight", (byte) 1));
tag.put(elementTag);
return tag;
}
private static CompoundTag createNetherEntry() {
CompoundTag tag = new CompoundTag("");
tag.put(new StringTag("key", "minecraft:the_nether"));
CompoundTag elementTag = new CompoundTag("element");
elementTag.put(new ByteTag("natural", (byte) 0));
elementTag.put(new LongTag("fixed_time", 18000));
elementTag.put(new FloatTag("ambient_light", 0.1F));
elementTag.put(new ByteTag("shrunk", (byte) 1));
elementTag.put(new ByteTag("ultrawarm", (byte) 1));
elementTag.put(new ByteTag("has_ceiling", (byte) 1));
elementTag.put(new ByteTag("has_skylight", (byte) 0));
tag.put(elementTag);
return tag;
}
private static CompoundTag createEndEntry() {
CompoundTag tag = new CompoundTag("");
tag.put(new StringTag("key", "minecraft:the_nether"));
CompoundTag elementTag = new CompoundTag("element");
elementTag.put(new ByteTag("natural", (byte) 0));
elementTag.put(new LongTag("fixed_time", 60000));
elementTag.put(new FloatTag("ambient_light", 0));
elementTag.put(new ByteTag("shrunk", (byte) 0));
elementTag.put(new ByteTag("ultrawarm", (byte) 0));
elementTag.put(new ByteTag("has_ceiling", (byte) 0));
elementTag.put(new ByteTag("has_skylight", (byte) 0));
tag.put(elementTag);
return tag; return tag;
} }
public static void register(Protocol protocol) { public static void register(Protocol protocol) {
MetadataRewriter1_16To1_15_2 metadataRewriter = protocol.get(MetadataRewriter1_16To1_15_2.class); MetadataRewriter1_16To1_15_2 metadataRewriter = protocol.get(MetadataRewriter1_16To1_15_2.class);
// Spawn lightning -> Spawn entity
protocol.registerOutgoing(State.PLAY, 0x02, 0x00, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
int entityId = wrapper.passthrough(Type.VAR_INT);
wrapper.user().get(EntityTracker1_16.class).addEntity(entityId, Entity1_16Types.EntityType.LIGHTNING_BOLT);
wrapper.write(Type.UUID, UUID.randomUUID()); // uuid
wrapper.write(Type.VAR_INT, Entity1_16Types.EntityType.LIGHTNING_BOLT.getId()); // entity type
wrapper.read(Type.BYTE); // remove type
wrapper.passthrough(Type.DOUBLE); // x
wrapper.passthrough(Type.DOUBLE); // y
wrapper.passthrough(Type.DOUBLE); // z
wrapper.write(Type.BYTE, (byte) 0); // yaw
wrapper.write(Type.BYTE, (byte) 0); // pitch
wrapper.write(Type.INT, 0); // data
wrapper.write(Type.SHORT, (short) 0); // velocity
wrapper.write(Type.SHORT, (short) 0); // velocity
wrapper.write(Type.SHORT, (short) 0); // velocity
});
}
});
// Spawn entity // Spawn entity
metadataRewriter.registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_16To1_15_2::getNewBlockStateId); metadataRewriter.registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_16To1_15_2::getNewBlockStateId);
// Spawn mob packet // Spawn mob packet
metadataRewriter.registerTracker(0x03, 0x03); metadataRewriter.registerTracker(0x03, 0x02);
// Spawn player packet // Spawn player packet
metadataRewriter.registerTracker(0x05, 0x05, Entity1_16Types.EntityType.PLAYER); metadataRewriter.registerTracker(0x05, 0x04, Entity1_16Types.EntityType.PLAYER);
// Metadata // Metadata
metadataRewriter.registerMetadataRewriter(0x44, 0x45, Types1_14.METADATA_LIST); metadataRewriter.registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST);
// Entity Destroy // Entity Destroy
metadataRewriter.registerEntityDestroy(0x38, 0x38); metadataRewriter.registerEntityDestroy(0x38, 0x37);
// Respawn // Respawn
protocol.registerOutgoing(State.PLAY, 0x3B, 0x3B, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x3B, 0x3A, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(DIMENSION_HANDLER); handler(DIMENSION_HANDLER);
@ -99,7 +167,7 @@ public class EntityPackets {
}); });
// Join Game // Join Game
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x26, 0x25, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.INT); // Entity ID map(Type.INT); // Entity ID
@ -138,7 +206,7 @@ public class EntityPackets {
}); });
// Entity Properties // Entity Properties
protocol.registerOutgoing(State.PLAY, 0x59, 0x59, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x59, 0x58, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {

Datei anzeigen

@ -22,7 +22,7 @@ public class InventoryPackets {
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer); ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
// Open Window // Open Window
protocol.registerOutgoing(State.PLAY, 0x2F, 0x2F, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x2F, 0x2E, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.VAR_INT); map(Type.VAR_INT);
@ -39,7 +39,7 @@ public class InventoryPackets {
}); });
// Window Property // Window Property
protocol.registerOutgoing(State.PLAY, 0x16, 0x16, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x16, 0x15, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.UNSIGNED_BYTE); // Window id map(Type.UNSIGNED_BYTE); // Window id
@ -59,13 +59,13 @@ public class InventoryPackets {
}); });
// Set cooldown // Set cooldown
itemRewriter.registerSetCooldown(0x18, 0x18, InventoryPackets::getNewItemId); itemRewriter.registerSetCooldown(0x18, 0x17, InventoryPackets::getNewItemId);
// Window items packet // Window items packet
itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x15, 0x15); itemRewriter.registerWindowItems(Type.FLAT_VAR_INT_ITEM_ARRAY, 0x15, 0x14);
// Trade list packet // Trade list packet
protocol.registerOutgoing(State.PLAY, 0x28, 0x28, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x28, 0x27, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -101,13 +101,13 @@ public class InventoryPackets {
}); });
// Set slot packet // Set slot packet
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x17); itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x16);
// Entity Equipment Packet // Entity Equipment Packet
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x48); itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47);
// Declare Recipes // Declare Recipes
protocol.registerOutgoing(State.PLAY, 0x5B, 0x5B, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x5B, 0x5A, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -171,6 +171,14 @@ public class InventoryPackets {
// Creative Inventory Action // Creative Inventory Action
itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x27); itemRewriter.registerCreativeInvAction(Type.FLAT_VAR_INT_ITEM, 0x26, 0x27);
// Edit Book
protocol.registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
}
});
} }
public static void toClient(Item item) { public static void toClient(Item item) {

Datei anzeigen

@ -27,19 +27,19 @@ public class WorldPackets {
BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_16To1_15_2::getNewBlockStateId, Protocol1_16To1_15_2::getNewBlockId); BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14, Protocol1_16To1_15_2::getNewBlockStateId, Protocol1_16To1_15_2::getNewBlockId);
// Block action // Block action
blockRewriter.registerBlockAction(0x0B, 0x0B); blockRewriter.registerBlockAction(0x0B, 0x0A);
// Block Change // Block Change
blockRewriter.registerBlockChange(0x0C, 0x0C); blockRewriter.registerBlockChange(0x0C, 0x0B);
// Multi Block Change // Multi Block Change
blockRewriter.registerMultiBlockChange(0x10, 0x10); blockRewriter.registerMultiBlockChange(0x10, 0x0F);
// Acknowledge player digging // Acknowledge player digging
blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x08); blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x07);
// Chunk Data // Chunk Data
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x22, 0x21, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
@ -97,10 +97,10 @@ public class WorldPackets {
}); });
// Effect // Effect
blockRewriter.registerEffect(0x23, 0x23, 1010, 2001, InventoryPackets::getNewItemId); blockRewriter.registerEffect(0x23, 0x22, 1010, 2001, InventoryPackets::getNewItemId);
// Spawn Particle // Spawn Particle
blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x24, 3, 23, 32, blockRewriter.registerSpawnParticle(Type.DOUBLE, 0x24, 0x23, 3, 23, 32,
WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM); WorldPackets::getNewParticleId, InventoryPackets::toClient, Type.FLAT_VAR_INT_ITEM);
} }