Slimefun4
Slimefun4 copied to clipboard
replace isitemsimilar
Description
This PR replaces isItemSImilar with a new method for now called compareItem()
Proposed changes
Replace isItemSImilar with a better check
Related Issues (if applicable)
Checklist
- [x] 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.
- [x] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
- [x] 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.
- [x] I have added
NonnullandNullableannotations to my methods to indicate their behaviour for null values - [ ] I added sufficient Unit Tests to cover my code.
ToDo
- [x] add tests for all lines of the new code
- [x] Add comments
- [ ] performance test
Your Pull Request was automatically labelled as: "🧹 Chores" Thank you for contributing to this project! ❤️
Slimefun preview build
A Slimefun preview build is available for testing! Commit: 9f01d73f
https://preview-builds.walshy.dev/download/Slimefun/4120/9f01d73f
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!
Testing required
This will need just general Slimefun testing. Some areas to specifically cover:
- Can use a variety of items
- Can craft items in enhanced crafting table
- Can build multi block
- Can craft with ancient alter
- Backpacks still work
- Cargo can move items as normal
Boomer:
I even added teleporting, basic dust farming, tested a few nodes going thru cargo, and everything seems to work as expected. backpacks are fine. no issues on ancient altar. all i tested with though was core slimefun. no addons or outside plugins. Added multiple power generators, geo mining, teleporting with the gps pad, and everything seems to be running as expected.
the environment was 1.20.4, paper version 405. probably need to update that but, eh for now
Type check is the first, so items with changed item type (e.g. explosive pickaxe is diamond pickaxe, and using the improvement forge from FoxyMachines to upgrade it to netherite) will not match. maybe we can have some sort of whitelist for tools and weapons. and other type mismatches will return immediately.
An allowlist just leads to unmaintable again annoyingly
I'd say just do this when we know it isn't an Slimefun item but that will slow down a bunch...