mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-25 17:41:35 +01:00
Give item holograms the same tracking range as the base hologram
This commit is contained in:
parent
321088784c
commit
8cf37b0ecc
@ -126,6 +126,10 @@ public class HologramTrait extends Trait {
|
|||||||
if (itemMatcher.matches()) {
|
if (itemMatcher.matches()) {
|
||||||
Material item = SpigotUtil.isUsing1_13API() ? Material.matchMaterial(itemMatcher.group(1), false)
|
Material item = SpigotUtil.isUsing1_13API() ? Material.matchMaterial(itemMatcher.group(1), false)
|
||||||
: Material.matchMaterial(itemMatcher.group(1));
|
: Material.matchMaterial(itemMatcher.group(1));
|
||||||
|
if (item == null) {
|
||||||
|
hologramNPC.destroy();
|
||||||
|
throw new IllegalStateException("Unknown material " + line);
|
||||||
|
}
|
||||||
ItemStack itemStack = new ItemStack(item, 1);
|
ItemStack itemStack = new ItemStack(item, 1);
|
||||||
NPC itemNPC = registry.createNPCUsingItem(EntityType.DROPPED_ITEM, "", itemStack);
|
NPC itemNPC = registry.createNPCUsingItem(EntityType.DROPPED_ITEM, "", itemStack);
|
||||||
itemNPC.data().setPersistent(NPC.Metadata.NAMEPLATE_VISIBLE, false);
|
itemNPC.data().setPersistent(NPC.Metadata.NAMEPLATE_VISIBLE, false);
|
||||||
@ -138,6 +142,10 @@ public class HologramTrait extends Trait {
|
|||||||
.setColor(Util.matchEnum(ChatColor.values(), itemMatcher.group(2).substring(1)));
|
.setColor(Util.matchEnum(ChatColor.values(), itemMatcher.group(2).substring(1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hologramNPC.data().has(NPC.Metadata.TRACKING_RANGE)) {
|
||||||
|
itemNPC.data().setPersistent(NPC.Metadata.TRACKING_RANGE,
|
||||||
|
hologramNPC.data().get(NPC.Metadata.TRACKING_RANGE));
|
||||||
|
}
|
||||||
itemNPC.getOrAddTrait(MountTrait.class).setMountedOn(hologramNPC.getUniqueId());
|
itemNPC.getOrAddTrait(MountTrait.class).setMountedOn(hologramNPC.getUniqueId());
|
||||||
itemNPC.spawn(currentLoc);
|
itemNPC.spawn(currentLoc);
|
||||||
NPC hn = hologramNPC;
|
NPC hn = hologramNPC;
|
||||||
|
Loading…
Reference in New Issue
Block a user