mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
SPIGOT-5094: Allow opening merchant for wandering traders and hide the xp bar for custom merchants
This commit is contained in:
parent
9af900778d
commit
6dde4b9fda
@ -596,11 +596,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
|
|
||||||
IMerchant mcMerchant;
|
IMerchant mcMerchant;
|
||||||
IChatBaseComponent name;
|
IChatBaseComponent name;
|
||||||
int level = 0;
|
int level = 1; // note: using level 0 with active 'is-regular-villager'-flag allows hiding the name suffix
|
||||||
if (merchant instanceof CraftVillager) {
|
if (merchant instanceof CraftAbstractVillager) {
|
||||||
mcMerchant = ((CraftVillager) merchant).getHandle();
|
mcMerchant = ((CraftAbstractVillager) merchant).getHandle();
|
||||||
name = ((CraftVillager) merchant).getHandle().getScoreboardDisplayName();
|
name = ((CraftAbstractVillager) merchant).getHandle().getScoreboardDisplayName();
|
||||||
level = ((CraftVillager) merchant).getHandle().getVillagerData().getLevel();
|
if (merchant instanceof CraftVillager) {
|
||||||
|
level = ((CraftVillager) merchant).getHandle().getVillagerData().getLevel();
|
||||||
|
}
|
||||||
} else if (merchant instanceof CraftMerchantCustom) {
|
} else if (merchant instanceof CraftMerchantCustom) {
|
||||||
mcMerchant = ((CraftMerchantCustom) merchant).getMerchant();
|
mcMerchant = ((CraftMerchantCustom) merchant).getMerchant();
|
||||||
name = ((CraftMerchantCustom) merchant).getMerchant().getScoreboardDisplayName();
|
name = ((CraftMerchantCustom) merchant).getMerchant().getScoreboardDisplayName();
|
||||||
|
@ -95,7 +95,7 @@ public class CraftMerchantCustom extends CraftMerchant {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean eb() {
|
public boolean eb() {
|
||||||
return true;
|
return false; // is-regular-villager flag (hides some gui elements: xp bar, name suffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user