Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Commit
5293417900
@ -31,9 +31,9 @@ public class Entity1_16Types {
|
||||
FALLING_BLOCK(26, ENTITY),
|
||||
FIREWORK_ROCKET(27, ENTITY),
|
||||
ITEM(37, ENTITY),
|
||||
LLAMA_SPIT(42, ENTITY),
|
||||
TNT(62, ENTITY),
|
||||
SHULKER_BULLET(69, ENTITY),
|
||||
LLAMA_SPIT(43, ENTITY),
|
||||
TNT(63, ENTITY),
|
||||
SHULKER_BULLET(70, ENTITY),
|
||||
FISHING_BOBBER(106, ENTITY),
|
||||
|
||||
LIVINGENTITY(-1, ENTITY),
|
||||
@ -48,54 +48,54 @@ public class Entity1_16Types {
|
||||
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
|
||||
|
||||
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
|
||||
VILLAGER(91, ABSTRACT_AGEABLE),
|
||||
WANDERING_TRADER(93, ABSTRACT_AGEABLE),
|
||||
VILLAGER(92, ABSTRACT_AGEABLE),
|
||||
WANDERING_TRADER(94, ABSTRACT_AGEABLE),
|
||||
|
||||
// Animals
|
||||
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
|
||||
DOLPHIN(13, ABSTRACT_INSENTIENT),
|
||||
CHICKEN(9, ABSTRACT_ANIMAL),
|
||||
COW(11, ABSTRACT_ANIMAL),
|
||||
MOOSHROOM(52, COW),
|
||||
PANDA(55, ABSTRACT_INSENTIENT),
|
||||
PIG(58, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(61, ABSTRACT_ANIMAL),
|
||||
RABBIT(64, ABSTRACT_ANIMAL),
|
||||
SHEEP(67, ABSTRACT_ANIMAL),
|
||||
TURTLE(89, ABSTRACT_ANIMAL),
|
||||
MOOSHROOM(53, COW),
|
||||
PANDA(56, ABSTRACT_INSENTIENT),
|
||||
PIG(59, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(62, ABSTRACT_ANIMAL),
|
||||
RABBIT(65, ABSTRACT_ANIMAL),
|
||||
SHEEP(68, ABSTRACT_ANIMAL),
|
||||
TURTLE(90, ABSTRACT_ANIMAL),
|
||||
FOX(28, ABSTRACT_ANIMAL),
|
||||
|
||||
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
|
||||
CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
OCELOT(53, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(98, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
OCELOT(54, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(99, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
|
||||
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
PARROT(56, ABSTRACT_PARROT),
|
||||
PARROT(57, ABSTRACT_PARROT),
|
||||
|
||||
// Horses
|
||||
ABSTRACT_HORSE(-1, ABSTRACT_ANIMAL),
|
||||
CHESTED_HORSE(-1, ABSTRACT_HORSE),
|
||||
DONKEY(14, CHESTED_HORSE),
|
||||
MULE(51, CHESTED_HORSE),
|
||||
LLAMA(41, CHESTED_HORSE),
|
||||
TRADER_LLAMA(87, CHESTED_HORSE),
|
||||
MULE(52, CHESTED_HORSE),
|
||||
LLAMA(42, CHESTED_HORSE),
|
||||
TRADER_LLAMA(88, CHESTED_HORSE),
|
||||
HORSE(33, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(72, ABSTRACT_HORSE),
|
||||
ZOMBIE_HORSE(101, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(73, ABSTRACT_HORSE),
|
||||
ZOMBIE_HORSE(102, ABSTRACT_HORSE),
|
||||
|
||||
// Golem
|
||||
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
|
||||
SNOW_GOLEM(75, ABSTRACT_GOLEM),
|
||||
SNOW_GOLEM(76, ABSTRACT_GOLEM),
|
||||
IRON_GOLEM(36, ABSTRACT_GOLEM),
|
||||
SHULKER(68, ABSTRACT_GOLEM),
|
||||
SHULKER(69, ABSTRACT_GOLEM),
|
||||
|
||||
// Fish
|
||||
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
|
||||
COD(10, ABSTRACT_FISHES),
|
||||
PUFFERFISH(63, ABSTRACT_FISHES),
|
||||
SALMON(66, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(88, ABSTRACT_FISHES),
|
||||
PUFFERFISH(64, ABSTRACT_FISHES),
|
||||
SALMON(67, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(89, ABSTRACT_FISHES),
|
||||
|
||||
// Monsters
|
||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||
@ -104,101 +104,101 @@ public class Entity1_16Types {
|
||||
ENDERMITE(21, ABSTRACT_MONSTER),
|
||||
ENDERMAN(20, ABSTRACT_MONSTER),
|
||||
GIANT(30, ABSTRACT_MONSTER),
|
||||
SILVERFISH(70, ABSTRACT_MONSTER),
|
||||
VEX(90, ABSTRACT_MONSTER),
|
||||
WITCH(94, ABSTRACT_MONSTER),
|
||||
WITHER(95, ABSTRACT_MONSTER),
|
||||
RAVAGER(65, ABSTRACT_MONSTER),
|
||||
PIGLIN(59, ABSTRACT_MONSTER),
|
||||
SILVERFISH(71, ABSTRACT_MONSTER),
|
||||
VEX(91, ABSTRACT_MONSTER),
|
||||
WITCH(95, ABSTRACT_MONSTER),
|
||||
WITHER(96, ABSTRACT_MONSTER),
|
||||
RAVAGER(66, ABSTRACT_MONSTER),
|
||||
PIGLIN(60, ABSTRACT_MONSTER),
|
||||
|
||||
HOGLIN(32, ABSTRACT_ANIMAL),
|
||||
STRIDER(81, ABSTRACT_ANIMAL),
|
||||
ZOGLIN(99, ABSTRACT_MONSTER),
|
||||
STRIDER(82, ABSTRACT_ANIMAL),
|
||||
ZOGLIN(100, ABSTRACT_MONSTER),
|
||||
|
||||
// Illagers
|
||||
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
|
||||
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
|
||||
EVOKER(22, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
ILLUSIONER(35, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
VINDICATOR(92, ABSTRACT_ILLAGER_BASE),
|
||||
PILLAGER(60, ABSTRACT_ILLAGER_BASE),
|
||||
VINDICATOR(93, ABSTRACT_ILLAGER_BASE),
|
||||
PILLAGER(61, ABSTRACT_ILLAGER_BASE),
|
||||
|
||||
// Skeletons
|
||||
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
|
||||
SKELETON(71, ABSTRACT_SKELETON),
|
||||
STRAY(80, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(96, ABSTRACT_SKELETON),
|
||||
SKELETON(72, ABSTRACT_SKELETON),
|
||||
STRAY(81, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(97, ABSTRACT_SKELETON),
|
||||
|
||||
// Guardians
|
||||
GUARDIAN(31, ABSTRACT_MONSTER),
|
||||
ELDER_GUARDIAN(17, GUARDIAN),
|
||||
|
||||
// Spiders
|
||||
SPIDER(78, ABSTRACT_MONSTER),
|
||||
SPIDER(79, ABSTRACT_MONSTER),
|
||||
CAVE_SPIDER(8, SPIDER),
|
||||
|
||||
// Zombies
|
||||
ZOMBIE(100, ABSTRACT_MONSTER),
|
||||
ZOMBIE(101, ABSTRACT_MONSTER),
|
||||
DROWNED(16, ZOMBIE),
|
||||
HUSK(34, ZOMBIE),
|
||||
ZOMBIFIED_PIGLIN(103, ZOMBIE),
|
||||
ZOMBIE_VILLAGER(102, ZOMBIE),
|
||||
ZOMBIFIED_PIGLIN(104, ZOMBIE),
|
||||
ZOMBIE_VILLAGER(103, ZOMBIE),
|
||||
|
||||
// Flying entities
|
||||
ABSTRACT_FLYING(-1, ABSTRACT_INSENTIENT),
|
||||
GHAST(29, ABSTRACT_FLYING),
|
||||
PHANTOM(57, ABSTRACT_FLYING),
|
||||
PHANTOM(58, ABSTRACT_FLYING),
|
||||
|
||||
ABSTRACT_AMBIENT(-1, ABSTRACT_INSENTIENT),
|
||||
BAT(3, ABSTRACT_AMBIENT),
|
||||
|
||||
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
|
||||
SQUID(79, ABSTRACT_WATERMOB),
|
||||
SQUID(80, ABSTRACT_WATERMOB),
|
||||
|
||||
// Slimes
|
||||
SLIME(73, ABSTRACT_INSENTIENT),
|
||||
MAGMA_CUBE(43, SLIME),
|
||||
SLIME(74, ABSTRACT_INSENTIENT),
|
||||
MAGMA_CUBE(44, SLIME),
|
||||
|
||||
// Hangable objects
|
||||
ABSTRACT_HANGING(-1, ENTITY),
|
||||
LEASH_KNOT(40, ABSTRACT_HANGING),
|
||||
ITEM_FRAME(38, ABSTRACT_HANGING),
|
||||
PAINTING(54, ABSTRACT_HANGING),
|
||||
PAINTING(55, ABSTRACT_HANGING),
|
||||
|
||||
ABSTRACT_LIGHTNING(-1, ENTITY),
|
||||
LIGHTNING_BOLT(104, ABSTRACT_LIGHTNING),
|
||||
LIGHTNING_BOLT(41, ABSTRACT_LIGHTNING),
|
||||
|
||||
// Arrows
|
||||
ABSTRACT_ARROW(-1, ENTITY),
|
||||
ARROW(2, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(77, ABSTRACT_ARROW),
|
||||
TRIDENT(86, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(78, ABSTRACT_ARROW),
|
||||
TRIDENT(87, ABSTRACT_ARROW),
|
||||
|
||||
// Fireballs
|
||||
ABSTRACT_FIREBALL(-1, ENTITY),
|
||||
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
|
||||
FIREBALL(39, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(74, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(97, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(75, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(98, ABSTRACT_FIREBALL),
|
||||
|
||||
// Projectiles
|
||||
PROJECTILE_ABSTRACT(-1, ENTITY),
|
||||
SNOWBALL(76, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(83, PROJECTILE_ABSTRACT),
|
||||
EGG(82, PROJECTILE_ABSTRACT),
|
||||
POTION(85, PROJECTILE_ABSTRACT),
|
||||
EXPERIENCE_BOTTLE(84, PROJECTILE_ABSTRACT),
|
||||
SNOWBALL(77, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(84, PROJECTILE_ABSTRACT),
|
||||
EGG(83, PROJECTILE_ABSTRACT),
|
||||
POTION(86, PROJECTILE_ABSTRACT),
|
||||
EXPERIENCE_BOTTLE(85, PROJECTILE_ABSTRACT),
|
||||
|
||||
// Vehicles
|
||||
MINECART_ABSTRACT(-1, ENTITY),
|
||||
CHESTED_MINECART_ABSTRACT(-1, MINECART_ABSTRACT),
|
||||
CHEST_MINECART(45, CHESTED_MINECART_ABSTRACT),
|
||||
HOPPER_MINECART(48, CHESTED_MINECART_ABSTRACT),
|
||||
MINECART(44, MINECART_ABSTRACT),
|
||||
FURNACE_MINECART(47, MINECART_ABSTRACT),
|
||||
COMMAND_BLOCK_MINECART(46, MINECART_ABSTRACT),
|
||||
TNT_MINECART(50, MINECART_ABSTRACT),
|
||||
SPAWNER_MINECART(49, MINECART_ABSTRACT),
|
||||
CHEST_MINECART(46, CHESTED_MINECART_ABSTRACT),
|
||||
HOPPER_MINECART(49, CHESTED_MINECART_ABSTRACT),
|
||||
MINECART(45, MINECART_ABSTRACT),
|
||||
FURNACE_MINECART(48, MINECART_ABSTRACT),
|
||||
COMMAND_BLOCK_MINECART(47, MINECART_ABSTRACT),
|
||||
TNT_MINECART(51, MINECART_ABSTRACT),
|
||||
SPAWNER_MINECART(50, MINECART_ABSTRACT),
|
||||
BOAT(6, ENTITY);
|
||||
|
||||
private static final Map<Integer, EntityType> TYPES = new HashMap<>();
|
||||
|
@ -80,7 +80,7 @@ public class ProtocolVersion {
|
||||
register(v1_15 = new ProtocolVersion(573, "1.15"));
|
||||
register(v1_15_1 = new ProtocolVersion(575, "1.15.1"));
|
||||
register(v1_15_2 = new ProtocolVersion(578, "1.15.2"));
|
||||
register(v1_16 = new ProtocolVersion(719, "1.16"));
|
||||
register(v1_16 = new ProtocolVersion(722, "1.16"));
|
||||
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
|
||||
InventoryPackets.register(this);
|
||||
|
||||
tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
|
||||
tagRewriter.register(0x5C, 0x5C);
|
||||
tagRewriter.register(0x5C, 0x5B);
|
||||
|
||||
// Login Success
|
||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||
@ -52,7 +52,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
|
||||
});
|
||||
|
||||
// Chat Message
|
||||
registerOutgoing(State.PLAY, 0x0F, 0x0F, new PacketRemapper() {
|
||||
registerOutgoing(State.PLAY, 0x0F, 0x0E, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
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.registerSound(0x51, 0x51);
|
||||
soundRewriter.registerSound(0x52, 0x52);
|
||||
|
||||
// Edit Book
|
||||
registerIncoming(State.PLAY, 0x0C, 0x0C, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
|
||||
}
|
||||
});
|
||||
soundRewriter.registerSound(0x51, 0x50);
|
||||
soundRewriter.registerSound(0x52, 0x51);
|
||||
|
||||
// Advancements
|
||||
registerOutgoing(State.PLAY, 0x58, 0x58, new PacketRemapper() {
|
||||
registerOutgoing(State.PLAY, 0x58, 0x57, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
@ -112,23 +104,63 @@ public class Protocol1_16To1_15_2 extends Protocol {
|
||||
}
|
||||
});
|
||||
|
||||
registerOutgoing(State.PLAY, 0x43, 0x44);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x45, 0x46);
|
||||
registerOutgoing(State.PLAY, 0x46, 0x47);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x48, 0x49);
|
||||
registerOutgoing(State.PLAY, 0x49, 0x4A);
|
||||
registerOutgoing(State.PLAY, 0x4A, 0x4B);
|
||||
registerOutgoing(State.PLAY, 0x4B, 0x4C);
|
||||
registerOutgoing(State.PLAY, 0x4C, 0x4D);
|
||||
registerOutgoing(State.PLAY, 0x4D, 0x4E);
|
||||
registerOutgoing(State.PLAY, 0x4E, 0x43);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x04, 0x03);
|
||||
registerOutgoing(State.PLAY, 0x06, 0x05);
|
||||
registerOutgoing(State.PLAY, 0x07, 0x06);
|
||||
registerOutgoing(State.PLAY, 0x09, 0x08);
|
||||
registerOutgoing(State.PLAY, 0x0A, 0x09);
|
||||
registerOutgoing(State.PLAY, 0x0D, 0x0C);
|
||||
registerOutgoing(State.PLAY, 0x0E, 0x0D);
|
||||
registerOutgoing(State.PLAY, 0x11, 0x10);
|
||||
registerOutgoing(State.PLAY, 0x12, 0x11);
|
||||
registerOutgoing(State.PLAY, 0x13, 0x12);
|
||||
registerOutgoing(State.PLAY, 0x14, 0x13);
|
||||
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, 0x28); // Jigsaw update
|
||||
|
||||
registerIncoming(State.PLAY, 0x0F, 0x10);
|
||||
registerIncoming(State.PLAY, 0x10, 0x11);
|
||||
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, 0x23, 0x24);
|
||||
registerIncoming(State.PLAY, 0x24, 0x25);
|
||||
|
||||
registerIncoming(State.PLAY, 0x28, 0x29);
|
||||
registerIncoming(State.PLAY, 0x29, 0x2A);
|
||||
registerIncoming(State.PLAY, 0x2A, 0x2B);
|
||||
|
@ -1,7 +1,10 @@
|
||||
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.FloatTag;
|
||||
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 us.myles.ViaVersion.api.PacketWrapper;
|
||||
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_9_3to1_9_1_2.storage.ClientWorld;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntityPackets {
|
||||
|
||||
private static final PacketHandler DIMENSION_HANDLER = wrapper -> {
|
||||
@ -43,43 +48,106 @@ public class EntityPackets {
|
||||
wrapper.write(Type.STRING, dimensionName); // dimension
|
||||
};
|
||||
private static final CompoundTag DIMENSIONS_TAG = new CompoundTag("");
|
||||
private static final String[] STRINGS = new String[0];
|
||||
private static final String[] WORLD_NAMES = {"minecraft:overworld", "minecraft:the_nether", "minecraft:the_end"};
|
||||
|
||||
static {
|
||||
ListTag list = new ListTag("dimension", CompoundTag.class);
|
||||
list.add(createDimensionEntry("minecraft:overworld"));
|
||||
list.add(createDimensionEntry("minecraft:the_nether"));
|
||||
list.add(createDimensionEntry("minecraft:the_end"));
|
||||
list.add(createOverworldEntry());
|
||||
list.add(createNetherEntry());
|
||||
list.add(createEndEntry());
|
||||
DIMENSIONS_TAG.put(list);
|
||||
}
|
||||
|
||||
private static CompoundTag createDimensionEntry(String dimension) {
|
||||
private static CompoundTag createOverworldEntry() {
|
||||
CompoundTag tag = new CompoundTag("");
|
||||
tag.put(new StringTag("key", dimension));
|
||||
tag.put(new StringTag("element", dimension));
|
||||
tag.put(new StringTag("key", "minecraft:overworld"));
|
||||
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_end"));
|
||||
CompoundTag elementTag = new CompoundTag("element");
|
||||
elementTag.put(new ByteTag("natural", (byte) 0));
|
||||
elementTag.put(new LongTag("fixed_time", 6000));
|
||||
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;
|
||||
}
|
||||
|
||||
public static void register(Protocol protocol) {
|
||||
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
|
||||
metadataRewriter.registerSpawnTrackerWithData(0x00, 0x00, Entity1_16Types.EntityType.FALLING_BLOCK, Protocol1_16To1_15_2::getNewBlockStateId);
|
||||
|
||||
// Spawn mob packet
|
||||
metadataRewriter.registerTracker(0x03, 0x03);
|
||||
metadataRewriter.registerTracker(0x03, 0x02);
|
||||
|
||||
// Spawn player packet
|
||||
metadataRewriter.registerTracker(0x05, 0x05, Entity1_16Types.EntityType.PLAYER);
|
||||
metadataRewriter.registerTracker(0x05, 0x04, Entity1_16Types.EntityType.PLAYER);
|
||||
|
||||
// Metadata
|
||||
metadataRewriter.registerMetadataRewriter(0x44, 0x45, Types1_14.METADATA_LIST);
|
||||
metadataRewriter.registerMetadataRewriter(0x44, 0x44, Types1_14.METADATA_LIST);
|
||||
|
||||
// Entity Destroy
|
||||
metadataRewriter.registerEntityDestroy(0x38, 0x38);
|
||||
metadataRewriter.registerEntityDestroy(0x38, 0x37);
|
||||
|
||||
// Respawn
|
||||
protocol.registerOutgoing(State.PLAY, 0x3B, 0x3B, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x3B, 0x3A, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(DIMENSION_HANDLER);
|
||||
@ -99,7 +167,7 @@ public class EntityPackets {
|
||||
});
|
||||
|
||||
// Join Game
|
||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x25, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.INT); // Entity ID
|
||||
@ -107,7 +175,7 @@ public class EntityPackets {
|
||||
map(Type.NOTHING, new ValueTransformer<Void, String[]>(Type.STRING_ARRAY) { // World list - only used for command completion
|
||||
@Override
|
||||
public String[] transform(PacketWrapper wrapper, Void input) throws Exception {
|
||||
return STRINGS;
|
||||
return WORLD_NAMES;
|
||||
}
|
||||
});
|
||||
map(Type.NOTHING, new ValueTransformer<Void, CompoundTag>(Type.NBT) { // whatever this is
|
||||
@ -138,7 +206,7 @@ public class EntityPackets {
|
||||
});
|
||||
|
||||
// Entity Properties
|
||||
protocol.registerOutgoing(State.PLAY, 0x59, 0x59, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x59, 0x58, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
|
@ -22,7 +22,7 @@ public class InventoryPackets {
|
||||
ItemRewriter itemRewriter = new ItemRewriter(protocol, InventoryPackets::toClient, InventoryPackets::toServer);
|
||||
|
||||
// Open Window
|
||||
protocol.registerOutgoing(State.PLAY, 0x2F, 0x2F, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x2F, 0x2E, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT);
|
||||
@ -39,7 +39,7 @@ public class InventoryPackets {
|
||||
});
|
||||
|
||||
// Window Property
|
||||
protocol.registerOutgoing(State.PLAY, 0x16, 0x16, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x16, 0x15, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE); // Window id
|
||||
@ -59,13 +59,13 @@ public class InventoryPackets {
|
||||
});
|
||||
|
||||
// Set cooldown
|
||||
itemRewriter.registerSetCooldown(0x18, 0x18, InventoryPackets::getNewItemId);
|
||||
itemRewriter.registerSetCooldown(0x18, 0x17, InventoryPackets::getNewItemId);
|
||||
|
||||
// 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
|
||||
protocol.registerOutgoing(State.PLAY, 0x28, 0x28, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x28, 0x27, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
@ -101,13 +101,13 @@ public class InventoryPackets {
|
||||
});
|
||||
|
||||
// Set slot packet
|
||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x17);
|
||||
itemRewriter.registerSetSlot(Type.FLAT_VAR_INT_ITEM, 0x17, 0x16);
|
||||
|
||||
// Entity Equipment Packet
|
||||
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x48);
|
||||
itemRewriter.registerEntityEquipment(Type.FLAT_VAR_INT_ITEM, 0x47, 0x47);
|
||||
|
||||
// Declare Recipes
|
||||
protocol.registerOutgoing(State.PLAY, 0x5B, 0x5B, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x5B, 0x5A, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
@ -171,6 +171,14 @@ public class InventoryPackets {
|
||||
|
||||
// Creative Inventory Action
|
||||
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) {
|
||||
|
@ -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);
|
||||
|
||||
// Block action
|
||||
blockRewriter.registerBlockAction(0x0B, 0x0B);
|
||||
blockRewriter.registerBlockAction(0x0B, 0x0A);
|
||||
|
||||
// Block Change
|
||||
blockRewriter.registerBlockChange(0x0C, 0x0C);
|
||||
blockRewriter.registerBlockChange(0x0C, 0x0B);
|
||||
|
||||
// Multi Block Change
|
||||
blockRewriter.registerMultiBlockChange(0x10, 0x10);
|
||||
blockRewriter.registerMultiBlockChange(0x10, 0x0F);
|
||||
|
||||
// Acknowledge player digging
|
||||
blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x08);
|
||||
blockRewriter.registerAcknowledgePlayerDigging(0x08, 0x07);
|
||||
|
||||
// Chunk Data
|
||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
|
||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x21, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
@ -97,10 +97,10 @@ public class WorldPackets {
|
||||
});
|
||||
|
||||
// Effect
|
||||
blockRewriter.registerEffect(0x23, 0x23, 1010, 2001, InventoryPackets::getNewItemId);
|
||||
blockRewriter.registerEffect(0x23, 0x22, 1010, 2001, InventoryPackets::getNewItemId);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren