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

Rework entity visibility #6867

Merged
merged 27 commits into from
Oct 13, 2024
Merged

Rework entity visibility #6867

merged 27 commits into from
Oct 13, 2024

Conversation

Efnilite
Copy link
Member

@Efnilite Efnilite commented Jul 5, 2024

Description

Adds support for the hideEntity, showEntity and canSee(Entity) and removes the player-only equivalents, which are functionally equivalent. Also updates the Hidden Players syntax to match the current style guide and to improve the naming of the variable required for reveal hidden players of {_p}.

I wasn't sure on how to do the test for the can see condition, as this will have to be done with JUnit to mock the player, but I couldn't get it to work properly with canSee. pls help :)


Target Minecraft Versions: 1.19+ (Skript 2.10)
Requirements: none
Related Issues: #6795

@cheeezburga
Copy link
Member

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

@Efnilite
Copy link
Member Author

Efnilite commented Jul 5, 2024

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

Not sure about that, since the entity one has only been around since Spigot 1.19, but idk

@cheeezburga
Copy link
Member

Can this just be put into the already existing CanSee condition and PlayerVisibility effect instead of making brand new ones?

Not sure about that, since the entity one has only been around since Spigot 1.19, but idk

You should just be able to change which kind of type is accepted in the pattern based on whether or not a certain method exists, if that makes sense.

@sovdeeth
Copy link
Member

sovdeeth commented Jul 5, 2024

You can just change it entirely since 2.10 will be 1.19+

Copy link
Contributor

@ShaneBeee ShaneBeee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few little things

@Efnilite Efnilite changed the title Add entity visibility Rework entity visibility Jul 5, 2024
@Efnilite Efnilite requested a review from ShaneBeee July 5, 2024 22:18
Copy link
Member

@cheeezburga cheeezburga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small things I saw - I think some of them are just preference so up to you. Stuff like the star imports tho are pretty up there.

src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/conditions/CondCanSee.java Outdated Show resolved Hide resolved
@Efnilite Efnilite requested a review from sovdeeth July 7, 2024 16:59
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: mock tests, you would need to provide your own logic implementation for canSee, since mocked objects have no inherent logic. I'm not sure if a junit test here is worth it.

sovdeeth added a commit that referenced this pull request Jul 13, 2024
Shouldn't be in the scope of this PR.
@Efnilite Efnilite requested a review from sovdeeth July 13, 2024 20:32
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the status of the junit tests?

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jul 14, 2024
@Efnilite
Copy link
Member Author

what's the status of the junit tests?

i think the EffEntityVisibility test is fine, but not really sure how to improve the one for CondCanSee. maybe adding an entity to a collection when it's hidden and then canSee checking that list? suggestions welcome :)

@sovdeeth
Copy link
Member

what's the status of the junit tests?

i think the EffEntityVisibility test is fine, but not really sure how to improve the one for CondCanSee. maybe adding an entity to a collection when it's hidden and then canSee checking that list? suggestions welcome :)

That'd work! As long as there's some basic logic implementation.

@Efnilite Efnilite requested a review from sovdeeth July 19, 2024 21:49
@Efnilite Efnilite requested a review from sovdeeth July 21, 2024 18:32
@Efnilite Efnilite requested a review from Moderocky August 17, 2024 20:57
@Moderocky Moderocky added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Aug 20, 2024
@Moderocky Moderocky requested review from APickledWalrus and removed request for ShaneBeee August 30, 2024 10:50
Copy link
Contributor

@TheLimeGlass TheLimeGlass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, very impressive.

@TheLimeGlass TheLimeGlass requested a review from ShaneBeee August 30, 2024 14:51
Moderocky and others added 5 commits August 30, 2024 16:35
…s/EffEntityVisibilityTest.java

Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
…ions/CondCanSeeTest.java

Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
sovdeeth added a commit that referenced this pull request Oct 13, 2024
* Fix gradle temp

* Start on displays

* Save

* More work

* update gradle.build

* stash

* Progress so far

* Finish bulk add

* Finalize so far

* Minimize adventure api

* Fix static class check for not 1.19.4

* Fix missing display classinfo in pattern under 1.19.4

* Fix missing quaternions classinfo in pattern under 1.19.4

* Make sure test runs on only 1.19.4

* Address reviews and fix java 8

* Apply suggestions from code review

Co-authored-by: sovdee <ethansovde@gmail.com>

* Move classes

* Apply changes

* Move classes

* Class rename

* Update to Spigot's fix to TextAlignment

* Return null when using w of vector

* Update src/main/java/ch/njol/skript/expressions/ExprXYZComponent.java

Co-authored-by: sovdee <ethansovde@gmail.com>

* Use brackets

* Add entity hiding

* Add property init values for displays

* 1.19.4 check

* Add rotate syntaxes

* Change example

* Fix tests

* shadow syntax missing

* Change setting

* Revert change

* Update src/main/java/ch/njol/skript/conditions/CondCanSee.java

* Fix imports from master merge

* Get tests working

* Add color reset

* Update ExprXYZComponent.java

* Update DisplayData.java

* Update DisplayData.java

* Change the package naming and merge item into its own class

* Add versioning for hide effect

* Add versioning for hide effect

* Change tests

* Update submodule skript-aliases

* Fix tests

* Fix tests

* Fix tests

* Apply suggestions from code review

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>

* Apply changes

* Add axis angle

* Add axis angle

* Update skript-aliases

* fix merge error

* Remove axisangle and only present quaternion to users

* Add tests for basic quaternion features, cleanup and fix bugs with ExprXYZComponent, add tests

Notable changes include changing float comparison behavior (needs discussion) and allowing multiple vectors/quaternions to be changed at once (will overwrite list indices, needs discussion)

* Add ExprQuaternionAxisAngle and tests. Change float comparison to use dynamic epsilon value.

* Temporary change to build.gradle for java 17

* Revert "Update src/main/java/ch/njol/skript/conditions/CondCanSee.java"

This reverts commit 3da7b37.

* Reverts entity hiding commits in favor of #6867

Shouldn't be in the scope of this PR.

* version check for EQAA and displaydata cleanup

* force 'rotation' in EQAA, fix classdef error, add itemtypes to block display entitydata pattern, add tests for display entitydata

Not sure wh

* Clean up colorOf, add tests, add alpha parameter to rgb function and color tostring, add rgba factory method + constructor

Discussion needed surrounding type checking in colorof acceptChange

* update Nullable annotations to jetbrains

* Fix <1.19 errors (just for actions) and fix subtle issues with xyz component changer

* rename package to bukkit

* finish package refactor

* Add tests for billboarding, rework display brightness and add tests, move joml utilities

* tests + allow setting override to a single number

* tests, cleanup, and bug fixes for glow override and hegiht/width

* Interpolation and Shadow tests + correct reset value for shadow strength + guard against NaN and init

* Tests and cleanup for teleportation duration, remove number from changers for tp duration and interpolation delay/duration

* Transformation tests, cleanup, bugfixes. Removed unnecessary Joml utils class.

* wrong version check for teleportation duration

* Display view range tests, cleanup, finite guard, switch to Timespan#getAs

* strip licenses

* cleanup, tests for ItemDisplayTransfrom. Fixed default from being FIXED to NONE, changed lang for NONE to be no transform to avoid confusion

* Remove ItemOfItemDisplay (redundant), cleanup/test the text display expressions.

* small cleanup to textdisplayexprs and rename ItemFrameSlot to be more generic

* rework ExprRotate

* Completely rework rotation with new Rotator API. Add support for quaternions + displays in EffRotate

* cleanup rotations - java 17 tests will fail until legacy tests are removed

* Fix bugs with rotation, adds tests

* Add drop shadow syntax and small cleanup of ExprTextOf

* See through blocks syntax

* Update ExprRotate.java

* remove extra [a]'s

* whoops! reverts a change to number accuracy config done for testing

* Module-ize, package infos, remove mc version checks

* rename display.expressions package, use for loops, move displaydata

* display data improvements

* requested changes 1

* update switches and remove banana

* requested changes 2

* Apply suggestions from code review

Co-authored-by: cheeezburga <47320303+cheeezburga@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: cheeezburga <47320303+cheeezburga@users.noreply.github.com>

* fix expritemofentity description

* Apply suggestions from code review

Co-authored-by: cheeezburga <47320303+cheeezburga@users.noreply.github.com>

* Update ExprDisplayHeightWidth.java

* Apply suggestions from code review

Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>

* requested changes 2 + rotator docs

* requested changes

* Apply suggestions from code review

Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>

* requested changes!

---------

Co-authored-by: sovdee <ethansovde@gmail.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Co-authored-by: Moderocky <admin@moderocky.com>
Co-authored-by: cheeezburga <47320303+cheeezburga@users.noreply.github.com>
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
@sovdeeth
Copy link
Member

@Efnilite conflicts :(

# Conflicts:
#	src/main/java/ch/njol/skript/conditions/CondCanSee.java
#	src/main/java/ch/njol/skript/effects/EffPlayerVisibility.java
#	src/main/java/ch/njol/skript/expressions/ExprHiddenPlayers.java
@Efnilite
Copy link
Member Author

@sovdeeth should be good now

@sovdeeth sovdeeth merged commit d763411 into SkriptLang:dev/feature Oct 13, 2024
5 checks passed
@Efnilite Efnilite deleted the visibility branch October 13, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants