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

Changeable Max Stack Size for Items and Inventory #6698

Open
wants to merge 6 commits into
base: dev/feature
Choose a base branch
from

Conversation

NotSoDelayed
Copy link
Contributor

@NotSoDelayed NotSoDelayed commented May 15, 2024

Description

This PR adds support of changeable max stack size of inventories and the recently introduced max stack size ItemMeta in Minecraft 1.20.5.

Javadocs:

Note

Using GitHub actions to test the attached test scripts due to Skript testing environment abruptly failing. My sincerely apologies for any bulk commits from fixing tests.


Target Minecraft Versions: Minecraft 1.20.5 (changeable itemstack max stack size)
Requirements: Spigot 1.20.5 (changeable max stack size ItemMeta)
Related Issues: #5020 (inventory)

@cheeezburga
Copy link

Should this PR also include changes to the is stackable condition to properly reflect this new stuff?

@NotSoDelayed
Copy link
Contributor Author

Should this PR also include changes to the is stackable condition to properly reflect this new stuff?

The condition checks if the max stack size is more than 1, which to me it looks like it is fine as is, unless I’m missing something.
image

@cheeezburga
Copy link

Should this PR also include changes to the is stackable condition to properly reflect this new stuff?

The condition checks if the max stack size is more than 1, which to me it looks like it is fine as is, unless I’m missing something. image

Ye I have no idea what I was thinking when I looked at the condition earlier, looks so fine. Probably a result of no sleep tbh, my bad.

@sovdeeth sovdeeth added the feature Pull request adding a new feature. label May 28, 2024
@Override
public Long convert(final ItemType i) {
return (long) i.getRandom().getMaxStackSize();
public void change(Event event, @Nullable Object[] delta, ChangeMode mode) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public void change(Event event, @Nullable Object[] delta, ChangeMode mode) {
public void change(Event event, Object @Nullable [] delta, ChangeMode mode) {

@@ -2,3 +2,49 @@ test "max stack":
assert max stack size of diamond sword is 1 with "diamond sword max stack size failed"
assert max stack size of bucket is 16 with "bucket max stack size failed"
assert max stack size of dirt is 64 with "dirt max stack size failed"

test "max stack override - itemtype" when running minecraft "1.20.5":
Copy link
Member

Choose a reason for hiding this comment

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

I'd also like to see some tests of changing multiple items or category item types (all logs) at a time, with varying default sizes. Plus edge cases tests of null values on both sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants