Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 00:50:13 +01:00
20w14a, entity name fixes, abstract tag rewriter
Dieser Commit ist enthalten in:
Ursprung
b941a6a422
Commit
0ee6369884
@ -29,21 +29,21 @@ public class Entity1_16Types {
|
||||
ENTITY(-1),
|
||||
|
||||
AREA_EFFECT_CLOUD(0, ENTITY),
|
||||
ENDER_CRYSTAL(18, ENTITY),
|
||||
EVOCATION_FANGS(22, ENTITY),
|
||||
XP_ORB(24, ENTITY),
|
||||
EYE_OF_ENDER_SIGNAL(25, ENTITY),
|
||||
END_CRYSTAL(18, ENTITY),
|
||||
EVOKER_FANGS(22, ENTITY),
|
||||
EXPERIENCE_ORB(24, ENTITY),
|
||||
EYE_OF_ENDER(25, ENTITY),
|
||||
FALLING_BLOCK(26, ENTITY),
|
||||
FIREWORKS_ROCKET(27, ENTITY),
|
||||
FIREWORK_ROCKET(27, ENTITY),
|
||||
ITEM(35, ENTITY),
|
||||
LLAMA_SPIT(40, ENTITY),
|
||||
TNT(59, ENTITY),
|
||||
SHULKER_BULLET(64, ENTITY),
|
||||
FISHING_BOBBER(105, ENTITY),
|
||||
TNT(58, ENTITY),
|
||||
SHULKER_BULLET(63, ENTITY),
|
||||
FISHING_BOBBER(106, ENTITY),
|
||||
|
||||
LIVINGENTITY(-1, ENTITY),
|
||||
ARMOR_STAND(1, LIVINGENTITY),
|
||||
PLAYER(104, LIVINGENTITY),
|
||||
PLAYER(105, LIVINGENTITY),
|
||||
|
||||
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
||||
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
|
||||
@ -53,8 +53,8 @@ public class Entity1_16Types {
|
||||
ABSTRACT_CREATURE(-1, ABSTRACT_INSENTIENT),
|
||||
|
||||
ABSTRACT_AGEABLE(-1, ABSTRACT_CREATURE),
|
||||
VILLAGER(85, ABSTRACT_AGEABLE),
|
||||
WANDERING_TRADER(89, ABSTRACT_AGEABLE),
|
||||
VILLAGER(84, ABSTRACT_AGEABLE),
|
||||
WANDERING_TRADER(88, ABSTRACT_AGEABLE),
|
||||
|
||||
// Animals
|
||||
ABSTRACT_ANIMAL(-1, ABSTRACT_AGEABLE),
|
||||
@ -64,16 +64,16 @@ public class Entity1_16Types {
|
||||
MOOSHROOM(50, COW),
|
||||
PANDA(53, ABSTRACT_INSENTIENT),
|
||||
PIG(55, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(58, ABSTRACT_ANIMAL),
|
||||
RABBIT(60, ABSTRACT_ANIMAL),
|
||||
SHEEP(62, ABSTRACT_ANIMAL),
|
||||
TURTLE(78, ABSTRACT_ANIMAL),
|
||||
POLAR_BEAR(57, ABSTRACT_ANIMAL),
|
||||
RABBIT(59, ABSTRACT_ANIMAL),
|
||||
SHEEP(61, ABSTRACT_ANIMAL),
|
||||
TURTLE(77, ABSTRACT_ANIMAL),
|
||||
FOX(28, ABSTRACT_ANIMAL),
|
||||
|
||||
ABSTRACT_TAMEABLE_ANIMAL(-1, ABSTRACT_ANIMAL),
|
||||
CAT(7, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
OCELOT(51, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(94, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
WOLF(93, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
|
||||
ABSTRACT_PARROT(-1, ABSTRACT_TAMEABLE_ANIMAL),
|
||||
PARROT(54, ABSTRACT_PARROT),
|
||||
@ -84,23 +84,23 @@ public class Entity1_16Types {
|
||||
DONKEY(13, CHESTED_HORSE),
|
||||
MULE(49, CHESTED_HORSE),
|
||||
LLAMA(39, CHESTED_HORSE),
|
||||
TRADER_LLAMA(76, CHESTED_HORSE),
|
||||
TRADER_LLAMA(75, CHESTED_HORSE),
|
||||
HORSE(32, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(67, ABSTRACT_HORSE),
|
||||
SKELETON_HORSE(66, ABSTRACT_HORSE),
|
||||
ZOMBIE_HORSE(96, ABSTRACT_HORSE),
|
||||
|
||||
// Golem
|
||||
ABSTRACT_GOLEM(-1, ABSTRACT_CREATURE),
|
||||
SNOWMAN(70, ABSTRACT_GOLEM),
|
||||
VILLAGER_GOLEM(86, ABSTRACT_GOLEM),
|
||||
SHULKER(63, ABSTRACT_GOLEM),
|
||||
SNOW_GOLEM(69, ABSTRACT_GOLEM),
|
||||
IRON_GOLEM(85, ABSTRACT_GOLEM),
|
||||
SHULKER(62, ABSTRACT_GOLEM),
|
||||
|
||||
// Fish
|
||||
ABSTRACT_FISHES(-1, ABSTRACT_CREATURE),
|
||||
COD(10, ABSTRACT_FISHES),
|
||||
PUFFER_FISH(56, ABSTRACT_FISHES),
|
||||
SALMON_MOB(61, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(77, ABSTRACT_FISHES),
|
||||
PUFFERFISH(56, ABSTRACT_FISHES),
|
||||
SALMON(60, ABSTRACT_FISHES),
|
||||
TROPICAL_FISH(76, ABSTRACT_FISHES),
|
||||
|
||||
// Monsters
|
||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||
@ -109,43 +109,44 @@ public class Entity1_16Types {
|
||||
ENDERMITE(21, ABSTRACT_MONSTER),
|
||||
ENDERMAN(20, ABSTRACT_MONSTER),
|
||||
GIANT(30, ABSTRACT_MONSTER),
|
||||
SILVERFISH(65, ABSTRACT_MONSTER),
|
||||
VEX(84, ABSTRACT_MONSTER),
|
||||
WITCH(90, ABSTRACT_MONSTER),
|
||||
WITHER(91, ABSTRACT_MONSTER),
|
||||
SILVERFISH(64, ABSTRACT_MONSTER),
|
||||
VEX(83, ABSTRACT_MONSTER),
|
||||
WITCH(89, ABSTRACT_MONSTER),
|
||||
WITHER(90, ABSTRACT_MONSTER),
|
||||
RAVAGER(99, ABSTRACT_MONSTER),
|
||||
PIGLIN(101, ABSTRACT_MONSTER),
|
||||
|
||||
HOGLIN(100, ABSTRACT_ANIMAL),
|
||||
STRIDER(102, ABSTRACT_ANIMAL),
|
||||
ZOGLIN(103, ABSTRACT_MONSTER),
|
||||
|
||||
// Illagers
|
||||
ABSTRACT_ILLAGER_BASE(-1, ABSTRACT_MONSTER),
|
||||
ABSTRACT_EVO_ILLU_ILLAGER(-1, ABSTRACT_ILLAGER_BASE),
|
||||
EVOCATION_ILLAGER(23, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
ILLUSION_ILLAGER(34, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
VINDICATION_ILLAGER(87, ABSTRACT_ILLAGER_BASE),
|
||||
PILLAGER(88, ABSTRACT_ILLAGER_BASE),
|
||||
EVOKER(23, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
ILLUSIONER(34, ABSTRACT_EVO_ILLU_ILLAGER),
|
||||
VINDICATOR(86, ABSTRACT_ILLAGER_BASE),
|
||||
PILLAGER(87, ABSTRACT_ILLAGER_BASE),
|
||||
|
||||
// Skeletons
|
||||
ABSTRACT_SKELETON(-1, ABSTRACT_MONSTER),
|
||||
SKELETON(66, ABSTRACT_SKELETON),
|
||||
STRAY(75, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(92, ABSTRACT_SKELETON),
|
||||
SKELETON(65, ABSTRACT_SKELETON),
|
||||
STRAY(74, ABSTRACT_SKELETON),
|
||||
WITHER_SKELETON(91, ABSTRACT_SKELETON),
|
||||
|
||||
// Guardians
|
||||
GUARDIAN(31, ABSTRACT_MONSTER),
|
||||
ELDER_GUARDIAN(17, GUARDIAN),
|
||||
|
||||
// Spiders
|
||||
SPIDER(73, ABSTRACT_MONSTER),
|
||||
SPIDER(72, ABSTRACT_MONSTER),
|
||||
CAVE_SPIDER(8, SPIDER),
|
||||
|
||||
// Zombies
|
||||
ZOMBIE(95, ABSTRACT_MONSTER),
|
||||
ZOMBIE(94, ABSTRACT_MONSTER),
|
||||
DROWNED(16, ZOMBIE),
|
||||
HUSK(33, ZOMBIE),
|
||||
ZOMBIFIED_PIGLIN(57, ZOMBIE),
|
||||
ZOMBIFIED_PIGLIN(95, ZOMBIE),
|
||||
ZOMBIE_VILLAGER(97, ZOMBIE),
|
||||
|
||||
// Flying entities
|
||||
@ -157,10 +158,10 @@ public class Entity1_16Types {
|
||||
BAT(3, ABSTRACT_AMBIENT),
|
||||
|
||||
ABSTRACT_WATERMOB(-1, ABSTRACT_INSENTIENT),
|
||||
SQUID(74, ABSTRACT_WATERMOB),
|
||||
SQUID(73, ABSTRACT_WATERMOB),
|
||||
|
||||
// Slimes
|
||||
SLIME(68, ABSTRACT_INSENTIENT),
|
||||
SLIME(67, ABSTRACT_INSENTIENT),
|
||||
MAGMA_CUBE(41, SLIME),
|
||||
|
||||
// Hangable objects
|
||||
@ -170,28 +171,28 @@ public class Entity1_16Types {
|
||||
PAINTING(52, ABSTRACT_HANGING),
|
||||
|
||||
ABSTRACT_LIGHTNING(-1, ENTITY),
|
||||
LIGHTNING_BOLT(103, ABSTRACT_LIGHTNING),
|
||||
LIGHTNING_BOLT(104, ABSTRACT_LIGHTNING),
|
||||
|
||||
// Arrows
|
||||
ABSTRACT_ARROW(-1, ENTITY),
|
||||
ARROW(2, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(72, ABSTRACT_ARROW),
|
||||
TRIDENT(83, ABSTRACT_ARROW),
|
||||
SPECTRAL_ARROW(71, ABSTRACT_ARROW),
|
||||
TRIDENT(82, ABSTRACT_ARROW),
|
||||
|
||||
// Fireballs
|
||||
ABSTRACT_FIREBALL(-1, ENTITY),
|
||||
DRAGON_FIREBALL(15, ABSTRACT_FIREBALL),
|
||||
FIREBALL(37, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(69, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(93, ABSTRACT_FIREBALL),
|
||||
SMALL_FIREBALL(68, ABSTRACT_FIREBALL),
|
||||
WITHER_SKULL(92, ABSTRACT_FIREBALL),
|
||||
|
||||
// Projectiles
|
||||
PROJECTILE_ABSTRACT(-1, ENTITY),
|
||||
SNOWBALL(71, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(80, PROJECTILE_ABSTRACT),
|
||||
EGG(79, PROJECTILE_ABSTRACT),
|
||||
POTION(82, PROJECTILE_ABSTRACT),
|
||||
XP_BOTTLE(81, PROJECTILE_ABSTRACT),
|
||||
SNOWBALL(70, PROJECTILE_ABSTRACT),
|
||||
ENDER_PEARL(79, PROJECTILE_ABSTRACT),
|
||||
EGG(78, PROJECTILE_ABSTRACT),
|
||||
POTION(81, PROJECTILE_ABSTRACT),
|
||||
EXPERIENCE_BOTTLE(80, PROJECTILE_ABSTRACT),
|
||||
|
||||
// Vehicles
|
||||
MINECART_ABSTRACT(-1, ENTITY),
|
||||
@ -200,7 +201,7 @@ public class Entity1_16Types {
|
||||
HOPPER_MINECART(46, CHESTED_MINECART_ABSTRACT),
|
||||
MINECART(42, MINECART_ABSTRACT),
|
||||
FURNACE_MINECART(45, MINECART_ABSTRACT),
|
||||
COMMANDBLOCK_MINECART(44, MINECART_ABSTRACT),
|
||||
COMMAND_BLOCK_MINECART(44, MINECART_ABSTRACT),
|
||||
TNT_MINECART(48, MINECART_ABSTRACT),
|
||||
SPAWNER_MINECART(47, MINECART_ABSTRACT),
|
||||
BOAT(6, ENTITY);
|
||||
|
@ -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(709, "1.16"));
|
||||
register(v1_16 = new ProtocolVersion(710, "1.16"));
|
||||
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public abstract class MetadataRewriter {
|
||||
return getTypeFromId(type);
|
||||
}
|
||||
|
||||
protected int getNewEntityId(int oldId) {
|
||||
public int getNewEntityId(int oldId) {
|
||||
return oldId;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,96 @@
|
||||
package us.myles.ViaVersion.api.rewriters;
|
||||
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TagRewriter {
|
||||
public static final int[] EMPTY_ARRAY = {};
|
||||
private final Protocol protocol;
|
||||
private final IdRewriteFunction blockRewriter;
|
||||
private final IdRewriteFunction itemRewriter;
|
||||
private final IdRewriteFunction entityRewriter;
|
||||
private final List<TagData> newBlockTags = new ArrayList<>();
|
||||
// add item, fluid, or entity tag lists if needed at some point
|
||||
|
||||
public TagRewriter(Protocol protocol, IdRewriteFunction blockRewriter, IdRewriteFunction itemRewriter, IdRewriteFunction entityRewriter) {
|
||||
this.protocol = protocol;
|
||||
this.blockRewriter = blockRewriter;
|
||||
this.itemRewriter = itemRewriter;
|
||||
this.entityRewriter = entityRewriter;
|
||||
}
|
||||
|
||||
public void addEmptyBlockTag(String id) {
|
||||
newBlockTags.add(new TagData(id, EMPTY_ARRAY));
|
||||
}
|
||||
|
||||
public void addBlockTag(String id, int... oldBlockIds) {
|
||||
for (int i = 0; i < oldBlockIds.length; i++) {
|
||||
int oldBlockId = oldBlockIds[i];
|
||||
oldBlockIds[i] = blockRewriter.rewrite(oldBlockId);
|
||||
}
|
||||
newBlockTags.add(new TagData(id, oldBlockIds));
|
||||
}
|
||||
|
||||
public void register(int oldId, int newId) {
|
||||
protocol.registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
handle(wrapper, blockRewriter, newBlockTags);
|
||||
handle(wrapper, itemRewriter, null);
|
||||
|
||||
if (entityRewriter == null) return;
|
||||
|
||||
int fluidTagsSize = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < fluidTagsSize; i++) {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
}
|
||||
|
||||
handle(wrapper, entityRewriter, null);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handle(PacketWrapper wrapper, IdRewriteFunction rewriteFunction, List<TagData> newTags) throws Exception {
|
||||
int tagsSize = wrapper.read(Type.VAR_INT);
|
||||
if (newTags != null) {
|
||||
wrapper.write(Type.VAR_INT, tagsSize + newTags.size()); // new tags
|
||||
} else {
|
||||
wrapper.write(Type.VAR_INT, tagsSize);
|
||||
}
|
||||
|
||||
for (int i = 0; i < tagsSize; i++) {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
int[] ids = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
for (int j = 0; j < ids.length; j++) {
|
||||
ids[j] = rewriteFunction.rewrite(ids[j]);
|
||||
}
|
||||
}
|
||||
|
||||
// Send new block tags if present
|
||||
if (newTags != null) {
|
||||
for (TagData tag : newTags) {
|
||||
wrapper.write(Type.STRING, tag.identifier);
|
||||
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, tag.entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final class TagData {
|
||||
private final String identifier;
|
||||
private final int[] entries;
|
||||
|
||||
private TagData(final String identifier, final int[] entries) {
|
||||
this.identifier = identifier;
|
||||
this.entries = entries;
|
||||
}
|
||||
}
|
||||
}
|
@ -101,7 +101,7 @@ public class MetadataRewriter1_13To1_12_2 extends MetadataRewriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNewEntityId(final int oldId) {
|
||||
public int getNewEntityId(final int oldId) {
|
||||
return EntityTypeRewriter.getNewId(oldId).orElse(oldId);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class MetadataRewriter1_14To1_13_2 extends MetadataRewriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNewEntityId(final int oldId) {
|
||||
public int getNewEntityId(final int oldId) {
|
||||
return EntityTypeRewriter.getNewId(oldId).orElse(oldId);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class MetadataRewriter1_15To1_14_4 extends MetadataRewriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNewEntityId(final int oldId) {
|
||||
public int getNewEntityId(final int oldId) {
|
||||
return EntityPackets.getNewEntityId(oldId);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
@ -20,13 +21,23 @@ public class Protocol1_16To1_15_2 extends Protocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
new MetadataRewriter1_16To1_15_2(this);
|
||||
MetadataRewriter1_16To1_15_2 metadataRewriter = new MetadataRewriter1_16To1_15_2(this);
|
||||
|
||||
MappingData.init();
|
||||
EntityPackets.register(this);
|
||||
WorldPackets.register(this);
|
||||
InventoryPackets.register(this);
|
||||
|
||||
TagRewriter tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
|
||||
tagRewriter.addBlockTag("minecraft:beacon_base_blocks", 133, 134, 148, 265);
|
||||
tagRewriter.addBlockTag("minecraft:climbable", 160, 241, 658);
|
||||
// The client crashes if we don't send these tags
|
||||
tagRewriter.addEmptyBlockTag("minecraft:soul_speed_blocks");
|
||||
tagRewriter.addEmptyBlockTag("minecraft:soul_fire_base_blocks");
|
||||
tagRewriter.addEmptyBlockTag("minecraft:fire");
|
||||
tagRewriter.addEmptyBlockTag("minecraft:beacon_payment_items");
|
||||
tagRewriter.register(0x5C, 0x5C);
|
||||
|
||||
// Login Success
|
||||
registerOutgoing(State.LOGIN, 0x02, 0x02, new PacketRemapper() {
|
||||
@Override
|
||||
@ -104,40 +115,6 @@ public class Protocol1_16To1_15_2 extends Protocol {
|
||||
}
|
||||
});
|
||||
|
||||
// Tags
|
||||
registerOutgoing(State.PLAY, 0x5C, 0x5C, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
int blockTagsSize = wrapper.read(Type.VAR_INT);
|
||||
wrapper.write(Type.VAR_INT, blockTagsSize + 2); // new tag(s)
|
||||
|
||||
for (int i = 0; i < blockTagsSize; i++) {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
int[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
for (int j = 0; j < blockIds.length; j++) {
|
||||
blockIds[j] = getNewBlockId(blockIds[j]);
|
||||
}
|
||||
}
|
||||
|
||||
// Only send the necessary new tags
|
||||
wrapper.write(Type.STRING, "minecraft:beacon_base_blocks");
|
||||
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{getNewBlockId(133), getNewBlockId(134), getNewBlockId(148), getNewBlockId(265)});
|
||||
wrapper.write(Type.STRING, "minecraft:climbable");
|
||||
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{getNewBlockId(160), getNewBlockId(241), getNewBlockId(658)});
|
||||
|
||||
int itemTagsSize = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int i = 0; i < itemTagsSize; i++) {
|
||||
wrapper.passthrough(Type.STRING);
|
||||
int[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
for (int j = 0; j < itemIds.length; j++) {
|
||||
itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerOutgoing(State.PLAY, 0x43, 0x44);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x45, 0x46);
|
||||
|
@ -7,8 +7,12 @@ import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.MappingDataLoader;
|
||||
import us.myles.ViaVersion.api.data.Mappings;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MappingData {
|
||||
public static BiMap<Integer, Integer> oldToNewItems = HashBiMap.create();
|
||||
public static Map<String, String> attributeMappings = new HashMap<>();
|
||||
public static Mappings blockMappings;
|
||||
public static Mappings blockStateMappings;
|
||||
public static Mappings soundMappings;
|
||||
@ -26,5 +30,17 @@ public class MappingData {
|
||||
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_15.getAsJsonObject("items"), mapping1_16.getAsJsonObject("items"), diffmapping.getAsJsonObject("items"));
|
||||
Via.getPlatform().getLogger().info("Loading 1.15 -> 1.16 sound mapping...");
|
||||
soundMappings = new Mappings(mapping1_15.getAsJsonArray("sounds"), mapping1_16.getAsJsonArray("sounds"), diffmapping.getAsJsonObject("sounds"));
|
||||
|
||||
attributeMappings.put("generic.maxHealth", "minecraft:generic.max_health");
|
||||
attributeMappings.put("zombie.spawnReinforcements", "minecraft:zombie.spawn_reinforcements");
|
||||
attributeMappings.put("horse.jumpStrength", "minecraft:horse.jump_strength");
|
||||
attributeMappings.put("generic.followRange", "minecraft:generic.follow_range");
|
||||
attributeMappings.put("generic.knockbackResistance", "minecraft:generic.knockback_resistance");
|
||||
attributeMappings.put("generic.movementSpeed", "minecraft:generic.movement_speed");
|
||||
attributeMappings.put("generic.flyingSpeed", "minecraft:generic.flying_speed");
|
||||
attributeMappings.put("generic.attackDamage", "minecraft:generic.attack_damage");
|
||||
attributeMappings.put("generic.attackKnockback", "minecraft:generic.attack_knockback");
|
||||
attributeMappings.put("generic.attackSpeed", "minecraft:generic.attack_speed");
|
||||
attributeMappings.put("generic.armorToughness", "minecraft:generic.armor_toughness");
|
||||
}
|
||||
}
|
||||
|
@ -50,4 +50,18 @@ public class MetadataRewriter1_16To1_15_2 extends MetadataRewriter {
|
||||
protected EntityType getTypeFromId(int type) {
|
||||
return Entity1_16Types.getTypeFromId(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNewEntityId(final int oldId) {
|
||||
if (oldId == 57) {
|
||||
return 95;
|
||||
}
|
||||
if (oldId > 57 && oldId < 95) {
|
||||
return oldId - 1;
|
||||
}
|
||||
if (oldId > 103) {
|
||||
return oldId + 1;
|
||||
}
|
||||
return oldId;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_16to1_15_2.packets;
|
||||
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_16Types;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.metadata.MetadataRewriter1_16To1_15_2;
|
||||
|
||||
public class EntityPackets {
|
||||
@ -31,5 +36,45 @@ public class EntityPackets {
|
||||
|
||||
// Join Game
|
||||
metadataRewriter.registerJoinGame(0x26, 0x26, Entity1_16Types.EntityType.PLAYER);
|
||||
|
||||
// Entity Properties
|
||||
protocol.registerOutgoing(State.PLAY, 0x59, 0x59, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
wrapper.passthrough(Type.VAR_INT);
|
||||
int size = wrapper.passthrough(Type.INT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
// Attributes have been renamed and are now namespaced identifiers
|
||||
String key = wrapper.read(Type.STRING);
|
||||
String attributeIdentifier = MappingData.attributeMappings.get(key);
|
||||
if (attributeIdentifier == null) {
|
||||
attributeIdentifier = "minecraft:" + key;
|
||||
if (!us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) {
|
||||
Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
|
||||
wrapper.read(Type.DOUBLE);
|
||||
int modifierSize = wrapper.read(Type.VAR_INT);
|
||||
for (int j = 0; j < modifierSize; j++) {
|
||||
wrapper.read(Type.UUID);
|
||||
wrapper.read(Type.DOUBLE);
|
||||
wrapper.read(Type.BYTE);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.write(Type.STRING, attributeIdentifier);
|
||||
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
int modifierSize = wrapper.passthrough(Type.VAR_INT);
|
||||
for (int j = 0; j < modifierSize; j++) {
|
||||
wrapper.passthrough(Type.UUID);
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -17356,150 +17356,151 @@
|
||||
"803": "minecraft:witch_spawn_egg",
|
||||
"804": "minecraft:wither_skeleton_spawn_egg",
|
||||
"805": "minecraft:wolf_spawn_egg",
|
||||
"806": "minecraft:zombie_spawn_egg",
|
||||
"807": "minecraft:zombie_horse_spawn_egg",
|
||||
"808": "minecraft:zombified_piglin_spawn_egg",
|
||||
"809": "minecraft:zombie_villager_spawn_egg",
|
||||
"810": "minecraft:experience_bottle",
|
||||
"811": "minecraft:fire_charge",
|
||||
"812": "minecraft:writable_book",
|
||||
"813": "minecraft:written_book",
|
||||
"814": "minecraft:emerald",
|
||||
"815": "minecraft:item_frame",
|
||||
"816": "minecraft:flower_pot",
|
||||
"817": "minecraft:carrot",
|
||||
"818": "minecraft:potato",
|
||||
"819": "minecraft:baked_potato",
|
||||
"820": "minecraft:poisonous_potato",
|
||||
"821": "minecraft:map",
|
||||
"822": "minecraft:golden_carrot",
|
||||
"823": "minecraft:skeleton_skull",
|
||||
"824": "minecraft:wither_skeleton_skull",
|
||||
"825": "minecraft:player_head",
|
||||
"826": "minecraft:zombie_head",
|
||||
"827": "minecraft:creeper_head",
|
||||
"828": "minecraft:dragon_head",
|
||||
"829": "minecraft:carrot_on_a_stick",
|
||||
"830": "minecraft:warped_fungus_on_a_stick",
|
||||
"831": "minecraft:nether_star",
|
||||
"832": "minecraft:pumpkin_pie",
|
||||
"833": "minecraft:firework_rocket",
|
||||
"834": "minecraft:firework_star",
|
||||
"835": "minecraft:enchanted_book",
|
||||
"836": "minecraft:nether_brick",
|
||||
"837": "minecraft:quartz",
|
||||
"838": "minecraft:tnt_minecart",
|
||||
"839": "minecraft:hopper_minecart",
|
||||
"840": "minecraft:prismarine_shard",
|
||||
"841": "minecraft:prismarine_crystals",
|
||||
"842": "minecraft:rabbit",
|
||||
"843": "minecraft:cooked_rabbit",
|
||||
"844": "minecraft:rabbit_stew",
|
||||
"845": "minecraft:rabbit_foot",
|
||||
"846": "minecraft:rabbit_hide",
|
||||
"847": "minecraft:armor_stand",
|
||||
"848": "minecraft:iron_horse_armor",
|
||||
"849": "minecraft:golden_horse_armor",
|
||||
"850": "minecraft:diamond_horse_armor",
|
||||
"851": "minecraft:leather_horse_armor",
|
||||
"852": "minecraft:lead",
|
||||
"853": "minecraft:name_tag",
|
||||
"854": "minecraft:command_block_minecart",
|
||||
"855": "minecraft:mutton",
|
||||
"856": "minecraft:cooked_mutton",
|
||||
"857": "minecraft:white_banner",
|
||||
"858": "minecraft:orange_banner",
|
||||
"859": "minecraft:magenta_banner",
|
||||
"860": "minecraft:light_blue_banner",
|
||||
"861": "minecraft:yellow_banner",
|
||||
"862": "minecraft:lime_banner",
|
||||
"863": "minecraft:pink_banner",
|
||||
"864": "minecraft:gray_banner",
|
||||
"865": "minecraft:light_gray_banner",
|
||||
"866": "minecraft:cyan_banner",
|
||||
"867": "minecraft:purple_banner",
|
||||
"868": "minecraft:blue_banner",
|
||||
"869": "minecraft:brown_banner",
|
||||
"870": "minecraft:green_banner",
|
||||
"871": "minecraft:red_banner",
|
||||
"872": "minecraft:black_banner",
|
||||
"873": "minecraft:end_crystal",
|
||||
"874": "minecraft:chorus_fruit",
|
||||
"875": "minecraft:popped_chorus_fruit",
|
||||
"876": "minecraft:beetroot",
|
||||
"877": "minecraft:beetroot_seeds",
|
||||
"878": "minecraft:beetroot_soup",
|
||||
"879": "minecraft:dragon_breath",
|
||||
"880": "minecraft:splash_potion",
|
||||
"881": "minecraft:spectral_arrow",
|
||||
"882": "minecraft:tipped_arrow",
|
||||
"883": "minecraft:lingering_potion",
|
||||
"884": "minecraft:shield",
|
||||
"885": "minecraft:elytra",
|
||||
"886": "minecraft:spruce_boat",
|
||||
"887": "minecraft:birch_boat",
|
||||
"888": "minecraft:jungle_boat",
|
||||
"889": "minecraft:acacia_boat",
|
||||
"890": "minecraft:dark_oak_boat",
|
||||
"891": "minecraft:totem_of_undying",
|
||||
"892": "minecraft:shulker_shell",
|
||||
"893": "minecraft:iron_nugget",
|
||||
"894": "minecraft:knowledge_book",
|
||||
"895": "minecraft:debug_stick",
|
||||
"896": "minecraft:music_disc_13",
|
||||
"897": "minecraft:music_disc_cat",
|
||||
"898": "minecraft:music_disc_blocks",
|
||||
"899": "minecraft:music_disc_chirp",
|
||||
"900": "minecraft:music_disc_far",
|
||||
"901": "minecraft:music_disc_mall",
|
||||
"902": "minecraft:music_disc_mellohi",
|
||||
"903": "minecraft:music_disc_stal",
|
||||
"904": "minecraft:music_disc_strad",
|
||||
"905": "minecraft:music_disc_ward",
|
||||
"906": "minecraft:music_disc_11",
|
||||
"907": "minecraft:music_disc_wait",
|
||||
"908": "minecraft:trident",
|
||||
"909": "minecraft:phantom_membrane",
|
||||
"910": "minecraft:nautilus_shell",
|
||||
"911": "minecraft:heart_of_the_sea",
|
||||
"912": "minecraft:crossbow",
|
||||
"913": "minecraft:suspicious_stew",
|
||||
"914": "minecraft:loom",
|
||||
"915": "minecraft:flower_banner_pattern",
|
||||
"916": "minecraft:creeper_banner_pattern",
|
||||
"917": "minecraft:skull_banner_pattern",
|
||||
"918": "minecraft:mojang_banner_pattern",
|
||||
"919": "minecraft:globe_banner_pattern",
|
||||
"920": "minecraft:composter",
|
||||
"921": "minecraft:barrel",
|
||||
"922": "minecraft:smoker",
|
||||
"923": "minecraft:blast_furnace",
|
||||
"924": "minecraft:cartography_table",
|
||||
"925": "minecraft:fletching_table",
|
||||
"926": "minecraft:grindstone",
|
||||
"927": "minecraft:lectern",
|
||||
"928": "minecraft:smithing_table",
|
||||
"929": "minecraft:stonecutter",
|
||||
"930": "minecraft:bell",
|
||||
"931": "minecraft:lantern",
|
||||
"932": "minecraft:soul_fire_lantern",
|
||||
"933": "minecraft:sweet_berries",
|
||||
"934": "minecraft:campfire",
|
||||
"935": "minecraft:shroomlight",
|
||||
"936": "minecraft:honeycomb",
|
||||
"937": "minecraft:bee_nest",
|
||||
"938": "minecraft:beehive",
|
||||
"939": "minecraft:honey_bottle",
|
||||
"940": "minecraft:honey_block",
|
||||
"941": "minecraft:honeycomb_block",
|
||||
"942": "minecraft:lodestone",
|
||||
"943": "minecraft:netherite_block",
|
||||
"944": "minecraft:ancient_debris",
|
||||
"945": "minecraft:netherite_ingot",
|
||||
"946": "minecraft:netherite_scrap",
|
||||
"947": "minecraft:target",
|
||||
"948": "minecraft:crying_obsidian",
|
||||
"949": "minecraft:respawn_anchor"
|
||||
"806": "minecraft:zoglin_spawn_egg",
|
||||
"807": "minecraft:zombie_spawn_egg",
|
||||
"808": "minecraft:zombie_horse_spawn_egg",
|
||||
"809": "minecraft:zombified_piglin_spawn_egg",
|
||||
"810": "minecraft:zombie_villager_spawn_egg",
|
||||
"811": "minecraft:experience_bottle",
|
||||
"812": "minecraft:fire_charge",
|
||||
"813": "minecraft:writable_book",
|
||||
"814": "minecraft:written_book",
|
||||
"815": "minecraft:emerald",
|
||||
"816": "minecraft:item_frame",
|
||||
"817": "minecraft:flower_pot",
|
||||
"818": "minecraft:carrot",
|
||||
"819": "minecraft:potato",
|
||||
"820": "minecraft:baked_potato",
|
||||
"821": "minecraft:poisonous_potato",
|
||||
"822": "minecraft:map",
|
||||
"823": "minecraft:golden_carrot",
|
||||
"824": "minecraft:skeleton_skull",
|
||||
"825": "minecraft:wither_skeleton_skull",
|
||||
"826": "minecraft:player_head",
|
||||
"827": "minecraft:zombie_head",
|
||||
"828": "minecraft:creeper_head",
|
||||
"829": "minecraft:dragon_head",
|
||||
"830": "minecraft:carrot_on_a_stick",
|
||||
"831": "minecraft:warped_fungus_on_a_stick",
|
||||
"832": "minecraft:nether_star",
|
||||
"833": "minecraft:pumpkin_pie",
|
||||
"834": "minecraft:firework_rocket",
|
||||
"835": "minecraft:firework_star",
|
||||
"836": "minecraft:enchanted_book",
|
||||
"837": "minecraft:nether_brick",
|
||||
"838": "minecraft:quartz",
|
||||
"839": "minecraft:tnt_minecart",
|
||||
"840": "minecraft:hopper_minecart",
|
||||
"841": "minecraft:prismarine_shard",
|
||||
"842": "minecraft:prismarine_crystals",
|
||||
"843": "minecraft:rabbit",
|
||||
"844": "minecraft:cooked_rabbit",
|
||||
"845": "minecraft:rabbit_stew",
|
||||
"846": "minecraft:rabbit_foot",
|
||||
"847": "minecraft:rabbit_hide",
|
||||
"848": "minecraft:armor_stand",
|
||||
"849": "minecraft:iron_horse_armor",
|
||||
"850": "minecraft:golden_horse_armor",
|
||||
"851": "minecraft:diamond_horse_armor",
|
||||
"852": "minecraft:leather_horse_armor",
|
||||
"853": "minecraft:lead",
|
||||
"854": "minecraft:name_tag",
|
||||
"855": "minecraft:command_block_minecart",
|
||||
"856": "minecraft:mutton",
|
||||
"857": "minecraft:cooked_mutton",
|
||||
"858": "minecraft:white_banner",
|
||||
"859": "minecraft:orange_banner",
|
||||
"860": "minecraft:magenta_banner",
|
||||
"861": "minecraft:light_blue_banner",
|
||||
"862": "minecraft:yellow_banner",
|
||||
"863": "minecraft:lime_banner",
|
||||
"864": "minecraft:pink_banner",
|
||||
"865": "minecraft:gray_banner",
|
||||
"866": "minecraft:light_gray_banner",
|
||||
"867": "minecraft:cyan_banner",
|
||||
"868": "minecraft:purple_banner",
|
||||
"869": "minecraft:blue_banner",
|
||||
"870": "minecraft:brown_banner",
|
||||
"871": "minecraft:green_banner",
|
||||
"872": "minecraft:red_banner",
|
||||
"873": "minecraft:black_banner",
|
||||
"874": "minecraft:end_crystal",
|
||||
"875": "minecraft:chorus_fruit",
|
||||
"876": "minecraft:popped_chorus_fruit",
|
||||
"877": "minecraft:beetroot",
|
||||
"878": "minecraft:beetroot_seeds",
|
||||
"879": "minecraft:beetroot_soup",
|
||||
"880": "minecraft:dragon_breath",
|
||||
"881": "minecraft:splash_potion",
|
||||
"882": "minecraft:spectral_arrow",
|
||||
"883": "minecraft:tipped_arrow",
|
||||
"884": "minecraft:lingering_potion",
|
||||
"885": "minecraft:shield",
|
||||
"886": "minecraft:elytra",
|
||||
"887": "minecraft:spruce_boat",
|
||||
"888": "minecraft:birch_boat",
|
||||
"889": "minecraft:jungle_boat",
|
||||
"890": "minecraft:acacia_boat",
|
||||
"891": "minecraft:dark_oak_boat",
|
||||
"892": "minecraft:totem_of_undying",
|
||||
"893": "minecraft:shulker_shell",
|
||||
"894": "minecraft:iron_nugget",
|
||||
"895": "minecraft:knowledge_book",
|
||||
"896": "minecraft:debug_stick",
|
||||
"897": "minecraft:music_disc_13",
|
||||
"898": "minecraft:music_disc_cat",
|
||||
"899": "minecraft:music_disc_blocks",
|
||||
"900": "minecraft:music_disc_chirp",
|
||||
"901": "minecraft:music_disc_far",
|
||||
"902": "minecraft:music_disc_mall",
|
||||
"903": "minecraft:music_disc_mellohi",
|
||||
"904": "minecraft:music_disc_stal",
|
||||
"905": "minecraft:music_disc_strad",
|
||||
"906": "minecraft:music_disc_ward",
|
||||
"907": "minecraft:music_disc_11",
|
||||
"908": "minecraft:music_disc_wait",
|
||||
"909": "minecraft:trident",
|
||||
"910": "minecraft:phantom_membrane",
|
||||
"911": "minecraft:nautilus_shell",
|
||||
"912": "minecraft:heart_of_the_sea",
|
||||
"913": "minecraft:crossbow",
|
||||
"914": "minecraft:suspicious_stew",
|
||||
"915": "minecraft:loom",
|
||||
"916": "minecraft:flower_banner_pattern",
|
||||
"917": "minecraft:creeper_banner_pattern",
|
||||
"918": "minecraft:skull_banner_pattern",
|
||||
"919": "minecraft:mojang_banner_pattern",
|
||||
"920": "minecraft:globe_banner_pattern",
|
||||
"921": "minecraft:composter",
|
||||
"922": "minecraft:barrel",
|
||||
"923": "minecraft:smoker",
|
||||
"924": "minecraft:blast_furnace",
|
||||
"925": "minecraft:cartography_table",
|
||||
"926": "minecraft:fletching_table",
|
||||
"927": "minecraft:grindstone",
|
||||
"928": "minecraft:lectern",
|
||||
"929": "minecraft:smithing_table",
|
||||
"930": "minecraft:stonecutter",
|
||||
"931": "minecraft:bell",
|
||||
"932": "minecraft:lantern",
|
||||
"933": "minecraft:soul_fire_lantern",
|
||||
"934": "minecraft:sweet_berries",
|
||||
"935": "minecraft:campfire",
|
||||
"936": "minecraft:shroomlight",
|
||||
"937": "minecraft:honeycomb",
|
||||
"938": "minecraft:bee_nest",
|
||||
"939": "minecraft:beehive",
|
||||
"940": "minecraft:honey_bottle",
|
||||
"941": "minecraft:honey_block",
|
||||
"942": "minecraft:honeycomb_block",
|
||||
"943": "minecraft:lodestone",
|
||||
"944": "minecraft:netherite_block",
|
||||
"945": "minecraft:ancient_debris",
|
||||
"946": "minecraft:netherite_ingot",
|
||||
"947": "minecraft:netherite_scrap",
|
||||
"948": "minecraft:target",
|
||||
"949": "minecraft:crying_obsidian",
|
||||
"950": "minecraft:respawn_anchor"
|
||||
},
|
||||
"sounds": [
|
||||
"ambient.cave",
|
||||
@ -17829,6 +17830,7 @@
|
||||
"entity.hoglin.ambient",
|
||||
"entity.hoglin.angry",
|
||||
"entity.hoglin.attack",
|
||||
"entity.hoglin.converted_to_zombified",
|
||||
"entity.hoglin.death",
|
||||
"entity.hoglin.hurt",
|
||||
"entity.hoglin.retreat",
|
||||
@ -18426,6 +18428,12 @@
|
||||
"block.wool.hit",
|
||||
"block.wool.place",
|
||||
"block.wool.step",
|
||||
"entity.zoglin.ambient",
|
||||
"entity.zoglin.angry",
|
||||
"entity.zoglin.attack",
|
||||
"entity.zoglin.death",
|
||||
"entity.zoglin.hurt",
|
||||
"entity.zoglin.step",
|
||||
"entity.zombie.ambient",
|
||||
"entity.zombie.attack_wooden_door",
|
||||
"entity.zombie.attack_iron_door",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren