Slimefun4 icon indicating copy to clipboard operation
Slimefun4 copied to clipboard

replace isitemsimilar

Open J3fftw1 opened this issue 1 year ago • 6 comments

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 Nonnull and Nullable annotations 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

J3fftw1 avatar Feb 05 '24 18:02 J3fftw1

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

github-actions[bot] avatar Feb 05 '24 18:02 github-actions[bot]

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!

github-actions[bot] avatar Feb 05 '24 19:02 github-actions[bot]

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

WalshyDev avatar Feb 06 '24 23:02 WalshyDev

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

WalshyDev avatar Feb 20 '24 00:02 WalshyDev

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.

ybw0014 avatar Feb 24 '24 22:02 ybw0014

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...

WalshyDev avatar Feb 25 '24 15:02 WalshyDev