Curios API (Fabric)

Curios API (Fabric)

830k Downloads

Datagen output is not deterministic

TheRealWormbo opened this issue ยท 0 comments

commented

Datagen logic for entities uses HashSet to store entities and slots. This neither retains the order as entries are passed into addEntities/addSlots, nor does it guarantee any other particular order. Across consecutive runs, or when using a different JVM distribution/configuration, the order may change at random. This may cause cached file hashes to change in subsequent datagen runs without any code changes. LinkedHashSet should be used to preserve the original order of entries:

private final Set<EntityType<?>> entities = new HashSet<>();
private final Set<String> slots = new HashSet<>();

I did not test the following, but in the slots data there also is a place where a HashSet is used to store data that is later written to JSON, so it should probably be adjusted as well:

(tested with Curios 9.3.1 for Minecraft 1.21.1)