Skip to content

Commit

Permalink
pref(item): 优化古代基座性能
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Oct 30, 2024
1 parent 38b4b44 commit bc23e8b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.Optional;
import javax.annotation.Nullable;

import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.block.Block;
Expand Down Expand Up @@ -158,7 +160,7 @@ public void placeItem(Player p, Block b) {
displayItem.setAmount(1);

// Get the display name of the original Item in the Player's hand
String nametag = ItemUtils.getItemName(hand);
Component nametag = Bukkit.getItemFactory().displayName(hand);

if (p.getGameMode() != GameMode.CREATIVE) {
ItemUtils.consumeItem(hand, false);
Expand All @@ -172,7 +174,7 @@ public void placeItem(Player p, Block b) {
entity.setInvulnerable(true);
entity.setVelocity(new Vector(0, 0.1, 0));
entity.setCustomNameVisible(true);
entity.setCustomName(nametag);
entity.customName(nametag);
armorStand.setCustomName(displayName);
armorStand.addPassenger(entity);
SlimefunUtils.markAsNoPickup(entity, "altar_item");
Expand Down

0 comments on commit bc23e8b

Please sign in to comment.