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

Fix/cargo enchants #4190

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

Intybyte
Copy link

Description

This PR aims to fix a confirmed bug regarding enchants not being filtered.

Proposed changes

Adding a filter option to cargo nodes for vanilla enchants.

Related Issues (if applicable)

Resolves #3341

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

- Removed unused imports
- Removed wildcard imports
@Intybyte Intybyte requested a review from a team as a code owner May 13, 2024 18:14
@github-actions github-actions bot added the ✨ Fix This Pull Request fixes an issue. label May 13, 2024
Copy link
Contributor

Your Pull Request was automatically labelled as: "✨ Fix"
Thank you for contributing to this project! ❤️

@J3fftw1
Copy link
Member

J3fftw1 commented May 13, 2024

before i review this i would really like some benchmarks for this.
Anything cargo may slow down the server massively

Copy link
Contributor

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: eab5972

https://preview-builds.walshy.dev/download/Slimefun/4190/eab59726

Note: This is not a supported build and is only here for the purposes of testing.
Do not run this on a live server and do not report bugs anywhere but this PR!

Now allows ItemStackWrapper with no meta, by creating one with ItemFactory, this will improve performance until isItemSimilar will be changed.
Instead of calling ItemFactory#getItemMeta, made equalsItemMeta support null values
Back to using itemFactory, caching to but now I cache the result to optimize it
…oEnchants

# Conflicts:
#	src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java
@Intybyte
Copy link
Author

Intybyte commented Jun 7, 2024

before i review this i would really like some benchmarks for this. Anything cargo may slow down the server massively

Now it uses SlimefunUtils#isItemSimilar so the benchmark is the same as that method, however it uses ItemFactory to create ItemMetas of vanilla items, as for some reason ItemStackWrapper class doesn't save them. However as it is an heavy method, I cache the item meta in an hashmap so it is called just once per Material type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Fix This Pull Request fixes an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cargo is not filtering Vanilla Enchanted Books (All treated as same with/without Lore filter)
2 participants