Skript icon indicating copy to clipboard operation
Skript copied to clipboard

1.19.4 displays

Open TheLimeGlass opened this issue 2 years ago • 10 comments

Description

  • Adds 1.19.4 displays support
  • ~~Adds entity hiding because Spigot was finally forced to with these Displays.~~
  • Changes ColorRGB to be using static methods to create a new instance to keep in line with SkriptColor, there was an abandoned pull request to do this aswell.

Download

Many people rely on this pull request. If you also wish to use this experimental version, go to the "checks" tab and then click Java 17, it'll have a skript-nightly.zip containing the built jar of this pull request.

Documentation at https://docs.skriptlang.org/nightly/feature/displays/docs.html

Ender chest loot box opening where it spins around and dumps out the contents as the reward (Requires Biosphere2)

Video of animation in #showcase https://discord.com/channels/135877399391764480/1072217309852213298/1111482138924163082

on right click on ender chest:
	cancel event
	set {_before} to block data of event-block
	set event-block to air
	spawn block display of ender chest at event-block:
		set transformation translation of display to vector from 0.5, -0.5, -0.5
		set right transformation rotation of display to right transformation rotation of display rotated around the y-axis by -1.57
		set {_display} to event-entity
	set {_mod} to 0.04
	add a diamond, gold ingot, emerald, stone, bedrock, diamond sword, wooden hoe, any ore, any weapon, any armour and any wood to {_items::*}
	play sound "BLOCK_CHEST_OPEN" at event-block
	loop line from event-block to location 1.6 blocks above event-block with density 10:
		teleport {_display} to loop-value
		wait a tick
	loop circle at location 1.6 blocks above event-block with radius 2 and density 4.5:
		add loop-value to {_locations::*}
		teleport {_display} to loop-value
		set {_quaternion} to left transformation rotation of {_display}
		set {_quaternion} to {_quaternion} rotated around the z-axis by {_mod}
		set {_quaternion} to {_quaternion} rotated around the x-axis by {_mod}
		add {_quaternion} to {_quaternions::*}
		set left transformation rotation of {_display} to {_quaternion}
		add 1 to {_count}
		if {_count} is greater than 20:
			{_count} is less than 100
			drop a random item out of {_items::*} at location 1.5 blocks below loop-value without velocity
			play sound "ENTITY_EXPERIENCE_ORB_PICKUP" with volume 0.5 at loop-value
		wait a tick
	set {_mod} to 0.1
	set {_index} to size of {_locations::*}
	loop {_locations::*}:
		teleport {_display} to loop-value
		subtract 1 from {_index}
		set left transformation rotation of {_display} to {_quaternions::%{_index}%}
		wait a tick
	loop line from location 1.6 blocks above event-block to event-block with density 10:
		teleport {_display} to loop-value
		wait a tick
	play sound "BLOCK_CHEST_CLOSE" at event-block
	clear all entities
	set event-block to {_before}

Target Minecraft Versions: 1.19.4 Requirements: none, but paper for some. Related Issues: none

TheLimeGlass avatar Apr 12 '23 21:04 TheLimeGlass

Hey Lime, do you intend to wait for SetEffects before taking this out of draft? I think it's a pretty high priority to get display support into Skript and I don't think SetEffect will be merged anytime soon. Would you be ok with finishing this PR without SetEffect? If not, I'll make a new version w/out SetEffect because I think it's too valuable to leave in draft this long.

sovdeeth avatar Nov 25 '23 21:11 sovdeeth

Hey Lime, do you intend to wait for SetEffects before taking this out of draft? I think it's a pretty high priority to get display support into Skript and I don't think SetEffect will be merged anytime soon. Would you be ok with finishing this PR without SetEffect? If not, I'll make a new version w/out SetEffect because I think it's too valuable to leave in draft this long.

There are other elements in the todo list.

TheLimeGlass avatar Nov 27 '23 20:11 TheLimeGlass

There are other elements in the todo list.

Sure, but it doesn't look like those are blocking, just things that are planned to be done. Are there other blocking tasks this is waiting on?

sovdeeth avatar Nov 29 '23 03:11 sovdeeth

This needs to be done for 2.9, we shouldn't go another 6 months without such an important feature.

sovdeeth avatar May 29 '24 19:05 sovdeeth

I decided to remove axisangle to simplify syntax for users. The axisAngle function still works the same, it just returns quaternions now. Please let me know if this is a contentious choice. I'm also considering adding (axis|angle) of %quarternions% for users' ease of use.

sovdeeth avatar Jul 13 '24 04:07 sovdeeth

axisangle is easier to understand and use than quarternions so that's why they're present. I use quarternions but I remember seeing Shane say he likes them for Displays.

TheLimeGlass avatar Jul 13 '24 04:07 TheLimeGlass

axisangle is easier to understand and use than quarternions so that's why they're present. I use quarternions but I remember seeing Shane say he likes them for Displays.

Yeah I agree, that's why I think the axisangle function is valuable. I just don't think we need both axisangle and quaternion as types in skript, we can just convert one to the other.

sovdeeth avatar Jul 13 '24 04:07 sovdeeth

tests failing due to use of java 17 features. Will include a edit to build.gradle for the sake of actions, but should be done in its own pr after 2.9.

sovdeeth avatar Jul 13 '24 17:07 sovdeeth

Last commit included a change that changes the behavior of ExprColorOf changers. Previously, they checked if the expr's return type is/is a child of the particular type, which is a conservative approach. This meant that variables could never be changed, as they always have a return type of Object.

My changes allow either parents or children, so all variables are treated as supporting all the changers (as if they are FireworkEffects) until otherwise proven during runtime. This means that a user can write delete color of {_block} with no parse warnings, but it also means they can actually set color of {_display}, which I think is a worthwhile tradeoff.

sovdeeth avatar Jul 14 '24 07:07 sovdeeth

Attention should be paid to the choices I made regarding the local vs global axis rotations in the ~~last~~ commit below this comment, namely that the default is to do the global axis rotations, despite local being the default in JOML api. Opinions welcome.

sovdeeth avatar Jul 23 '24 04:07 sovdeeth