Add missing Villager.Type parameter, rename methods to setBiome and deprecate old.

This commit is contained in:
libraryaddict 2019-11-13 11:07:53 +13:00
parent 0972e74d17
commit 92a85194fb
4 changed files with 27 additions and 3 deletions

View File

@ -28,10 +28,19 @@ public class VillagerWatcher extends AbstractVillagerWatcher {
return getVillagerData().getProfession(); return getVillagerData().getProfession();
} }
@Deprecated
public Villager.Type getType() { public Villager.Type getType() {
return getVillagerData().getType(); return getVillagerData().getType();
} }
public Villager.Type getBiome() {
return getType();
}
public void setBiome(Villager.Type type) {
setType(type);
}
public int getLevel() { public int getLevel() {
return getVillagerData().getLevel(); return getVillagerData().getLevel();
} }
@ -40,6 +49,7 @@ public class VillagerWatcher extends AbstractVillagerWatcher {
setVillagerData(new VillagerData(getType(), profession, getLevel())); setVillagerData(new VillagerData(getType(), profession, getLevel()));
} }
@Deprecated
public void setType(Villager.Type type) { public void setType(Villager.Type type) {
setVillagerData(new VillagerData(type, getProfession(), getLevel())); setVillagerData(new VillagerData(type, getProfession(), getLevel()));
} }

View File

@ -59,11 +59,21 @@ public class ZombieVillagerWatcher extends ZombieWatcher {
setVillagerData(new VillagerData(getType(), profession, getLevel())); setVillagerData(new VillagerData(getType(), profession, getLevel()));
} }
@Deprecated
public void setType(Villager.Type type) { public void setType(Villager.Type type) {
setVillagerData(new VillagerData(type, getProfession(), getLevel())); setVillagerData(new VillagerData(type, getProfession(), getLevel()));
} }
@Deprecated
public void setLevel(int level) { public void setLevel(int level) {
setVillagerData(new VillagerData(getType(), getProfession(), getLevel())); setVillagerData(new VillagerData(getType(), getProfession(), getLevel()));
} }
public Villager.Type getBiome() {
return getType();
}
public void setBiome(Villager.Type type) {
setType(type);
}
} }

View File

@ -1546,8 +1546,10 @@ public class DisguiseUtilities {
((Set<Object>) trackedPlayersObj).add(ReflectionManager.getNmsEntity(player)); ((Set<Object>) trackedPlayersObj).add(ReflectionManager.getNmsEntity(player));
} else { } else {
((Map<Object, Object>) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayerMap") Field field = ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayerMap");
.get(entityTrackerEntry)).put(ReflectionManager.getNmsEntity(player), true); Object nmsEntity = ReflectionManager.getNmsEntity(player);
Map<Object, Object> map = ((Map<Object, Object>) field.get(entityTrackerEntry));
map.put(nmsEntity, true);
} }
ProtocolManager manager = ProtocolLibrary.getProtocolManager(); ProtocolManager manager = ProtocolLibrary.getProtocolManager();

View File

@ -40,7 +40,9 @@ public class ParamInfoTypes {
"View all the colors you can use for a horses color")); "View all the colors you can use for a horses color"));
paramInfos.add(new ParamInfoEnum(Villager.Profession.class, "Villager Profession", paramInfos.add(new ParamInfoEnum(Villager.Profession.class, "Villager Profession",
"View all the professions you can set on a Zombie and Normal Villager")); "View all the professions you can set on a Villager and Zombie Villager"));
paramInfos.add(new ParamInfoEnum(Villager.Type.class, "Villager Biome",
"View all the biomes you can set on a Villager and Zombie Villager"));
paramInfos.add(new ParamInfoEnum(BlockFace.class, "Direction", "Direction (North, East, South, West, Up, Down)", paramInfos.add(new ParamInfoEnum(BlockFace.class, "Direction", "Direction (North, East, South, West, Up, Down)",
"View the directions usable on player setSleeping and shulker direction", "View the directions usable on player setSleeping and shulker direction",
Arrays.copyOf(BlockFace.values(), 6))); Arrays.copyOf(BlockFace.values(), 6)));