Mekanism 1.12.2 Community Edition

Mekanism 1.12.2 Community Edition

1.9k Downloads

[BUG]: Factory sorting will cause texture errors and will cause items to be overwritten and duplicated.

sddsd2332 opened this issue ยท 13 comments

commented

Describe the bug

I forked the modified one from your side in my own modified version of the MEK
In testing, it was found that some factory recipes caused the meta value of the item to change from the correct ID to 32767
You can see it using CrT, GrS, or other mods that can view NBT

To Reproduce

  1. Get a Basic Smelting Factory
  2. Open the GUI and put 64 iron ores
    3.Click Auto-sort
  3. Item stickers change from normal to black and purple
  4. Using the NBT viewer, it was found that meta became 32767

Expected behavior

The item's texture should be normal

Mekanism Version

Mekanism-1.12.2-Community-Edition-1.12.2-9.12.2-Core

Minecraft Version is this regarding?

1.12.2

What OS are you seeing the problem on?

Windows

Name of modpack if applicable

No response

Version of said modpack if applicable

No response

Screenshots

In the video, the Basic Sawing Factory is placed, 64 Spruce Wood Planks are added, and Auto-sort is started
You can clearly see that the meta id of the block has changed from 0005/1 to 0005/32767

2023-01-23.22-50-41.mp4

The crash report in folder ./crash-reports (both server and client logs)

null

Please provide the following other files

No response

commented

breaking change: 34c258d
i'm quite busy, and we're currently prioritizing 1.7.10. if you have an fix for this, feel free to open an pull request

commented

When I was trying to fix this sorting issue, I accidentally put an item without a recipe into the input slot and found that the item was overwritten,This may result in the use of a lower cost to handle recipe items that can be worked on,
In the video, assuming that Dragon Head is very easy to obtain, Gold Ore is extremely difficult to obtain, and after enabling sorting, a large amount of Gold Ore is easily obtained

2023-02-09.22-33-51.mp4
commented

hmmm, maybe i should revert the commit, i really dont have time to look into this. but if you're working on a fix, i'll wait.

commented

this seems to only happen vanilla mc recipes

commented

It is also reproduced in Sawmill and only needs to be put in Wood Planks

commented

Not sure why meta became short. MAX_VALUE
This all seems to happen when matching mineral dictionaries

commented

i reverted the commit in 9.12.4, feel free to either fix the broken code or make new one. however i also believe that the issue might come from on how mek handles recipe's.

commented

There seems to be a problem with the ItemStack input obtained from FurnaceRecipes.instance().getSmeltingList(). (It's in line 891 of https://github.com/Thorfusion/Mekanism-Community-Edition/blob/1.12.2/src/main/java/mekanism/common/Mekanism.java.)
If you go to print the Metadata for these ItemStack, you will see that it has a Metadata of 32767 for some of the items, when the correct one should be 0.
Because the new sorting algorithm gets the items from the machine recipe's item input, it overwrites the original items in the slot and sets the wrong Metadata value, which eventually leads to a display error.

In addition, the sorting algorithm presented in 34c258d gets the items from the recipe input, which means that if a player enters an item with NBT, turning on sorting will cause the NBT of the entered item to disappear or be overwritten by the NBT of the recipe input.
In addition, the new sorting algorithm will overwrite all items entered into the slot, even though the slot has a different type of item.
Since I did not delve into the sorting algorithm of the new commit, and I am not completely familiar with Mekanism's code, I did not find the problem.

I would suggest rolling back this commit, using the old sorting method, and then merging this commit when the issue is fixed.

commented

I tried to fix again and the input slot doesn't seem to be covered anymore

Factory.Auto.Sorting.test.fixes.mp4

Some recipes may appear that different meta overlays of the same block from left to right [e.g. planks out of sticks, if one is the same blockID, but meta is different] will occur in the state in the video

Factory.Auto.Sorting.meta.error.override.mp4

This may not affect the impact of the game

commented

I've finished rewriting the sorting in the meantime, and it should work well, so if you're interested in that, check out https://github.com/sddsd2332/MEK-1.12.2-v10/pull/24/files.

commented

I've finished rewriting the sorting in the meantime, and it should work well, so if you're interested in that, check out https://github.com/sddsd2332/MEK-1.12.2-v10/pull/24/files.

So why not submit a PR here as well?
[My code involves the ultimate and creative level factories, which need to be modified and committed]

commented

I've finished rewriting the sorting in the meantime, and it should work well, so if you're interested in that, check out https://github.com/sddsd2332/MEK-1.12.2-v10/pull/24/files.

feel free to submit an pr

commented

I've finished rewriting the sorting in the meantime, and it should work well, so if you're interested in that, check out https://github.com/sddsd2332/MEK-1.12.2-v10/pull/24/files.

So why not submit a PR here as well? [My code involves the ultimate and creative level factories, which need to be modified and committed]

i took a look into the repo, while you can relicense original mek, our license cannot and therefore your license is in violation of our license. the license we have is copy left and cant be changed, all you need to do is just leave our license intact, if you copied the license text without any code, just remove our company and user names from it. We have a strict license to stop people from ARR our changes and claim they did themself and claim to done other fixes, which is the situation on mek 1.7.10