Skip to content

Commit

Permalink
Avoid players seeing item frames to optimise maps in item frames
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jan 1, 2022
1 parent bf3bf6f commit fe15df7
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -548,6 +549,14 @@ private PlayerNPC(EntityHumanNPC entity) {
npc.getOrAddTrait(Inventory.class);
}

@Override
public boolean canSee(org.bukkit.entity.Entity entity) {
if (entity.getType() == EntityType.ITEM_FRAME) {
return false; // optimise for large maps in item frames
}
return super.canSee(entity);
}

@Override
public Player getBukkitEntity() {
return this;
Expand Down

0 comments on commit fe15df7

Please sign in to comment.