Project-RT / RandomTweaker

Provides many more mods support and great features for CraftTweaker.
https://www.curseforge.com/minecraft/mc-mods/randomtweaker
MIT License
21 stars 8 forks source link

`setMaterialPriority` not working for main material grid view #67

Closed Krutoy242 closed 7 months ago

Krutoy242 commented 1 year ago

Im using this methof to rearrange materials in book:

for matName, power in scripts.equipment.equipData.defaultWeaponMats {
  mods.randomtweaker.tconstruct.IBook.setMaterialPriority(matName, power);
}

Comes out that only detailed pages arranged (were we can see stats and applicable tool parts), but main "grid" view is stay the same:

image

debug.log

ikexing-cn commented 1 year ago

To be honest, I'm not entirely sure what is happening from your description. To avoid ambiguity, it needs to be made clear that the implementation of the setMaterialPriority method will only handle with the material that's set, while the rest will retain the default ordering.

Krutoy242 commented 1 year ago

I though, setMaterialPriority('paper', -1000) will place paper here:

image

ikexing-cn commented 1 year ago

try setMaterialPriority('paper', 1000)

Krutoy242 commented 1 year ago

Not working too.

Krutoy242 commented 1 year ago

There, i printed messages about values to be sure:

This is my ZS code:

for matName, power in scripts.equipment.equipData.defaultWeaponMats {
  print('randomtweaker: setting '~matName~' priority: '~(-power));
  mods.randomtweaker.tconstruct.IBook.setMaterialPriority(matName, -power);
}

This is cafttweaker.log output:

[INITIALIZATION][CLIENT][INFO] randomtweaker: setting prismarine priority: -80
[INITIALIZATION][CLIENT][INFO] Setting material prismarine priority to -80
...
[INITIALIZATION][CLIENT][INFO] randomtweaker: setting paper priority: -21
[INITIALIZATION][CLIENT][INFO] Setting material paper priority to -21
...
[INITIALIZATION][CLIENT][INFO] randomtweaker: setting endstone priority: -77
[INITIALIZATION][CLIENT][INFO] Setting material endstone priority to -77

But we still seeing them near each other:

image

ikexing-cn commented 1 year ago

In fact, this is an expected result. Simply setting the priority of some of the materials will only result in them being placed last or first in the loop in order of priority. I think your requirements need to be sorted for all materials to control the specific insertion order.

Krutoy242 commented 1 year ago

Ok, seems like I just come up with wrong example. I will make another example to show that order actually not changing.

Krutoy242 commented 11 months ago

There is another example showing that sorting does not work.

Crafttweaker.log output:

Setting material paper priority to 21
Setting material stone priority to 31
Setting material construction_alloy priority to 41
Setting material flint priority to 49

What i see: image

ikexing-cn commented 11 months ago

It seems to be not compatible with a other expansion mods of tc again, If you can find the specific mod may I can try to fix it.

ikexing-cn commented 7 months ago

Fixed, #1397ec6