Skript

Skript

743k Downloads

Edits to shulker box inventories not applying to all ItemDatas in an ItemType.

freausan opened this issue ยท 1 comments

commented

Skript/Server Version

[Skript] Server Version: 1.21.1-2326-4f2fe31 (MC: 1.21.1)
[Skript] Skript Version: 2.9.5 (skriptlang-github)
[Skript] Installed Skript Addons: 
[Skript]  - skript-reflect v2.5.1 (https://github.com/SkriptLang/skript-reflect)
[Skript]  - SkBee v3.6.5 (https://github.com/SkriptHub/SkBee)
[Skript] Installed dependencies: 
[Skript]  - Vault v1.7.3-b131
[Skript]  - WorldGuard v7.0.13-SNAPSHOT+2307-3b9ab47

Bug Description

With command /test1, it drops every single type of shulker box with the diamond added to the generic uncolored shulker box instead of a single random element of all shulker boxes.

With command /test2, it drops a random color of shulker box with no diamond in its inventory, instead of a single uncolored shulker box.

Expected Behavior

For test1, a single shulker box of a random color should be dropped with a diamond.
For test2, an uncolored shulker box should be dropped with a diamond.

Steps to Reproduce

command /test1:
	trigger:
		set {_x} to a random element out of all shulker boxes
		add 1 diamond to inventory of {_x}
		drop {_x} at player

command /test2:
	trigger:
		set {_x} to a shulker box
		add 1 diamond to inventory of {_x}
		drop {_x} at player

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

The first bit is technically intended. all shulker boxes is an alias rather than a list, and as such doesn't respond to random element. Instead you should be doing set {_x} to any shulker box. If you want an uncoloured box, use normal shulker box.

As for the failure to add the diamond, this appears to be a bug related to 1.20.5 components, where it only applies properly to the first ItemData in an ItemType, and despite calls to setItemMeta happening for subsequent itemtypes, the component does not apply. Perhaps @Pikachu920 has some insight?