Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Add ExprNearestEntity

Open Pikachu920 opened this issue 3 years ago • 4 comments

Description

Adds an expression to get the nearest entity relative to another entity or location. Example script:

on click:
	broadcast nearest mob
	kill nearest mob

Target Minecraft Versions: Any Requirements: None Related Issues: #4674

Pikachu920 avatar Mar 19 '22 02:03 Pikachu920

You don't need the entity type in the pattern along with location, converters will take care of that

TPGamesNL avatar Mar 19 '22 09:03 TPGamesNL

You don't need the entity type in the pattern along with location, converters will take care of that

it's there on purpose because otherwise if you do, for example, nearest player relative to player the result will be player. Taking in an entity specifically allows me to exclude that entity from the search. See the below code snippets (in particular line 84) https://github.com/SkriptLang/Skript/blob/6e28d9448f5b6fb1d364f4fd0a9db4df058c684e/src/main/java/ch/njol/skript/expressions/ExprNearestEntity.java#L79-L93 https://github.com/SkriptLang/Skript/blob/6e28d9448f5b6fb1d364f4fd0a9db4df058c684e/src/main/java/ch/njol/skript/expressions/ExprNearestEntity.java#L104

Pikachu920 avatar Mar 19 '22 18:03 Pikachu920

Ah okay, that makes sense, I hadn't seen that part of the method initially

TPGamesNL avatar Mar 19 '22 23:03 TPGamesNL

When you apply changes, you can re-request a review from the user that asked for the changes when they're completed. That way the pull request gets looked into more, and eventually merged faster. Like me, I sort by "Awaiting reviews from you" first when starting reviews.

TheLimeGlass avatar Jul 31 '22 02:07 TheLimeGlass