Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-data/paper.at
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public net.minecraft.world.entity.npc.villager.Villager numberOfRestocksToday
public net.minecraft.world.entity.npc.villager.Villager releaseAllPois()V
public net.minecraft.world.entity.npc.villager.Villager setUnhappy()V
public net.minecraft.world.entity.npc.villager.Villager updateDemand()V
public net.minecraft.world.entity.npc.villager.Villager updateSpecialPrices(Lnet/minecraft/world/entity/player/Player;)V
public net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.player.Abilities flyingSpeed
public net.minecraft.world.entity.player.Abilities walkingSpeed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,17 +512,18 @@ public InventoryView openMerchant(Merchant merchant, boolean force) {
net.minecraft.world.item.trading.Merchant mcMerchant;
Component name;
int level = 1; // note: using level 0 with active 'is-regular-villager'-flag allows hiding the name suffix
if (merchant instanceof CraftAbstractVillager) {
mcMerchant = ((CraftAbstractVillager) merchant).getHandle();
name = ((CraftAbstractVillager) merchant).getHandle().getDisplayName();
if (merchant instanceof CraftVillager) {
level = ((CraftVillager) merchant).getHandle().getVillagerData().level();
if (merchant instanceof CraftAbstractVillager craftAbstractVillager) {
mcMerchant = craftAbstractVillager.getHandle();
name = craftAbstractVillager.getHandle().getDisplayName();
if (merchant instanceof CraftVillager craftVillager) {
level = craftVillager.getHandle().getVillagerData().level();
craftVillager.getHandle().updateSpecialPrices(this.getHandle()); // Update villager prices before to open to player
}
} else if (merchant instanceof CraftMerchantCustom) {
mcMerchant = ((CraftMerchantCustom) merchant).getMerchant();
name = ((CraftMerchantCustom) merchant).getMerchant().getScoreboardDisplayName();
} else if (merchant instanceof CraftMerchantCustom craftMerchantCustom) {
mcMerchant = craftMerchantCustom.getMerchant();
name = craftMerchantCustom.getMerchant().getScoreboardDisplayName();
} else {
throw new IllegalArgumentException("Can't open merchant " + merchant.toString());
throw new IllegalArgumentException("Can't open merchant " + merchant);
}

mcMerchant.setTradingPlayer(this.getHandle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void openMerchantMenu(final ServerPlayer player, final MerchantMen
int level = 1;
if (minecraftMerchant instanceof final Villager villager) {
level = villager.getVillagerData().level();
villager.updateSpecialPrices(player); // Update villager prices before to open to player
}

if (minecraftMerchant.getTradingPlayer() != null) { // merchant's can only have one trader
Expand Down
Loading