Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with some Entity functions #28

Closed
ricsal1 opened this issue Apr 1, 2023 · 1 comment
Closed

Problem with some Entity functions #28

ricsal1 opened this issue Apr 1, 2023 · 1 comment
Labels
resolution: invalid Issue or Request has no basis. resolution: won't fix Issue will not be resolved or feature not added. type: bug Something doesn't work as it was intended to. version: 1.19.4 Game version 1.19.4

Comments

@ricsal1
Copy link

ricsal1 commented Apr 1, 2023

Expected behavior

Expected do get results from:

  • player.getLocation().getChunk().getTileEntities()
  • .getWorld().getNearbyLivingEntities
  • getWorld().getNearbyEntities()

Observed/Actual behavior

[14:45:39] [Region Scheduler Thread #0/ERROR]: Could not pass event ServerTickEndEvent to CoolProtection v1.6
java.lang.IllegalStateException: Cannot getEntities asynchronously
at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:86) ~[folia-1.19.4.jar:git-Folia-"7072994"] at net.minecraft.world.level.Level.getEntities(Level.java:1157) ~[folia-1.19.4.jar:git-Folia-"7072994"]
at org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getNearbyEntities(CraftWorld.java:1099) ~[folia-1.19.4.jar:git-Folia-"7072994"]
at org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getNearbyEntities(CraftWorld.java:1085) ~[folia-1.19.4.jar:git-Folia-"7072994"]
at org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getNearbyEntities(CraftWorld.java:1076) ~[folia-1.19.4.jar:git-Folia-"7072994"]
at org.bukkit.World.getNearbyEntitiesByType(World.java:1074) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.World.getNearbyEntitiesByType(World.java:1025) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.World.getNearbyLivingEntities(World.java:856) ~[folia-api-1.19.4-R0.1-SNAPSHOT.jar:?]

Steps/models to reproduce

Call

public void test(Player player) {
int currentLiving = player.getWorld().getLivingEntities().size();
int currentEntities = player.getWorld().getEntities().size();
int currentChunkEntities = player.getLocation().getChunk().getEntities().length;

//Fails from here

    int currentChunkTileEntities = player.getLocation().getChunk().getTileEntities().length;
    int nearbyLivingEntities = player.getWorld().getNearbyLivingEntities(player.getLocation(), 30, 200).size();;
    int nearbyEntities = player.getWorld().getNearbyEntities(player.getLocation(), 30, 200, 30).size();;

//print..
}

Plugin and Datapack List

1 plugin been adapted

Folia version

[14:52:02 INFO]: Checking version, please wait...
[14:52:03 INFO]: This server is running Folia version git-Folia-"7072994" (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 7072994)
You are running the latest version
Previous version: git-Folia-"00cfbaa" (MC: 1.19.4)

Other

No response

@ricsal1 ricsal1 added status: needs triage type: bug Something doesn't work as it was intended to. labels Apr 1, 2023
@ricsal1 ricsal1 changed the title Problems with some Entity functions Problem with some Entity functions Apr 1, 2023
@Spottedleaf Spottedleaf added resolution: invalid Issue or Request has no basis. resolution: won't fix Issue will not be resolved or feature not added. and removed status: needs triage labels Apr 1, 2023
@Spottedleaf
Copy link
Member

getEntities is specifically guarded to prevent plugins from retrieving entities from chunks not owned by the current region. Only call it for players owned by the current region

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: invalid Issue or Request has no basis. resolution: won't fix Issue will not be resolved or feature not added. type: bug Something doesn't work as it was intended to. version: 1.19.4 Game version 1.19.4
Projects
None yet
Development

No branches or pull requests

3 participants