GeyserOptionalPack support for zombie villager textures (#2237)

Trade tier and profession now show on zombie villagers with this commit.
This commit is contained in:
Camotoy 2021-05-28 20:38:17 -04:00 committed by GitHub
parent 40d1e39093
commit 08ba82a44e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 19 deletions

View file

@ -46,7 +46,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
/** /**
* A map of Java profession IDs to Bedrock IDs * A map of Java profession IDs to Bedrock IDs
*/ */
private static final Int2IntMap VILLAGER_VARIANTS = new Int2IntOpenHashMap(); public static final Int2IntMap VILLAGER_PROFESSIONS = new Int2IntOpenHashMap();
/** /**
* A map of all Java region IDs (plains, savanna...) to Bedrock * A map of all Java region IDs (plains, savanna...) to Bedrock
*/ */
@ -54,21 +54,21 @@ public class VillagerEntity extends AbstractMerchantEntity {
static { static {
// Java villager profession IDs -> Bedrock // Java villager profession IDs -> Bedrock
VILLAGER_VARIANTS.put(0, 0); VILLAGER_PROFESSIONS.put(0, 0);
VILLAGER_VARIANTS.put(1, 8); VILLAGER_PROFESSIONS.put(1, 8);
VILLAGER_VARIANTS.put(2, 11); VILLAGER_PROFESSIONS.put(2, 11);
VILLAGER_VARIANTS.put(3, 6); VILLAGER_PROFESSIONS.put(3, 6);
VILLAGER_VARIANTS.put(4, 7); VILLAGER_PROFESSIONS.put(4, 7);
VILLAGER_VARIANTS.put(5, 1); VILLAGER_PROFESSIONS.put(5, 1);
VILLAGER_VARIANTS.put(6, 2); VILLAGER_PROFESSIONS.put(6, 2);
VILLAGER_VARIANTS.put(7, 4); VILLAGER_PROFESSIONS.put(7, 4);
VILLAGER_VARIANTS.put(8, 12); VILLAGER_PROFESSIONS.put(8, 12);
VILLAGER_VARIANTS.put(9, 5); VILLAGER_PROFESSIONS.put(9, 5);
VILLAGER_VARIANTS.put(10, 13); VILLAGER_PROFESSIONS.put(10, 13);
VILLAGER_VARIANTS.put(11, 14); VILLAGER_PROFESSIONS.put(11, 14);
VILLAGER_VARIANTS.put(12, 3); VILLAGER_PROFESSIONS.put(12, 3);
VILLAGER_VARIANTS.put(13, 10); VILLAGER_PROFESSIONS.put(13, 10);
VILLAGER_VARIANTS.put(14, 9); VILLAGER_PROFESSIONS.put(14, 9);
VILLAGER_REGIONS.put(0, 1); VILLAGER_REGIONS.put(0, 1);
VILLAGER_REGIONS.put(1, 2); VILLAGER_REGIONS.put(1, 2);
@ -88,7 +88,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
if (entityMetadata.getId() == 17) { if (entityMetadata.getId() == 17) {
VillagerData villagerData = (VillagerData) entityMetadata.getValue(); VillagerData villagerData = (VillagerData) entityMetadata.getValue();
// Profession // Profession
metadata.put(EntityData.VARIANT, VILLAGER_VARIANTS.get(villagerData.getProfession())); metadata.put(EntityData.VARIANT, VILLAGER_PROFESSIONS.get(villagerData.getProfession()));
//metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? //metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason?
// Region // Region
metadata.put(EntityData.MARK_VARIANT, VILLAGER_REGIONS.get(villagerData.getType())); metadata.put(EntityData.MARK_VARIANT, VILLAGER_REGIONS.get(villagerData.getType()));

View file

@ -48,8 +48,10 @@ public class ZombieVillagerEntity extends ZombieEntity {
} }
if (entityMetadata.getId() == 19) { if (entityMetadata.getId() == 19) {
VillagerData villagerData = (VillagerData) entityMetadata.getValue(); VillagerData villagerData = (VillagerData) entityMetadata.getValue();
// Region - only one used on Bedrock metadata.put(EntityData.VARIANT, VillagerEntity.VILLAGER_PROFESSIONS.get(villagerData.getProfession())); // Actually works properly with the OptionalPack
metadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType())); metadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType()));
// Used with the OptionalPack
metadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1);
} }
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
} }

@ -1 +1 @@
Subproject commit 53e13b7a0d2ea14df71ed0c9582d29a9b4fb4453 Subproject commit c5925b01cf8e7d8b284cf359e927145b9b4694aa