Fix cache file sorting issue on linux (#6793)

This commit is contained in:
hanetzer 2020-06-25 11:29:21 -05:00 committed by cpw
parent 4178885e29
commit 2ffdfb9582
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
7 changed files with 47 additions and 11 deletions

View File

@ -1,20 +1,13 @@
--- a/net/minecraft/data/DirectoryCache.java
+++ b/net/minecraft/data/DirectoryCache.java
@@ -23,7 +23,7 @@
private final Path field_208326_c;
private int field_208327_d;
private final Map<Path, String> field_208328_e = Maps.newHashMap();
- private final Map<Path, String> field_208329_f = Maps.newHashMap();
+ private final Map<Path, String> field_208329_f = Maps.newTreeMap(); //Forge: TreeMap, makes the file output predictable/sorted.
private final Set<Path> field_218457_g = Sets.newHashSet();
public DirectoryCache(Path p_i49352_1_, String p_i49352_2_) throws IOException {
@@ -55,7 +55,7 @@
@@ -55,8 +55,8 @@
}
IOUtils.writeLines(this.field_208329_f.entrySet().stream().map((p_208319_1_) -> {
- return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey());
- }).collect(Collectors.toList()), System.lineSeparator(), writer);
+ return (String)p_208319_1_.getValue() + ' ' + this.field_208325_b.relativize(p_208319_1_.getKey()).toString().replace('\\', '/'); //Forge: Standardize file paths.
}).collect(Collectors.toList()), System.lineSeparator(), writer);
+ }).sorted(java.util.Comparator.comparing(a -> a.split(" ")[1])).collect(Collectors.toList()), System.lineSeparator(), writer);
writer.close();
field_208324_a.debug("Caching: cache hits: {}, created: {} removed: {}", this.field_208327_d, this.field_208329_f.size() - this.field_208327_d, this.field_208328_e.size());
}

View File

@ -67,3 +67,7 @@ f51f026a75e27a0a53a76771d553c0e3385a2966 assets/piston_event_test/models/item/sh
4fbaf6f4a3ea05cc071076e27f44ac81f9cc50e3 data/data_gen_test/advancements/conditional.json
ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data/data_gen_test/recipes/conditional.json
2c3e2073a1597baaa2970de5ae1649781f87aef8 data/data_gen_test/tags/blocks/test.json
d65c425e740dc833f29d16606a1171825876be0d data/data_gen_test/tags/blocks/thing/one.json
1f70ed4ddc878bada5e43d3c44a34157806beda8 data/data_gen_test/tags/blocks/thing/three.json
2c648bca262caaa826ddbbde796d35bb2ee5f03a data/data_gen_test/tags/blocks/thing/two.json
b0565ce75fc7880be7517e86a218d1ed9d9e346f data/data_gen_test/tags/blocks/things.json

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:cobblestone"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:andesite"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:diorite"
]
}

View File

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"minecraft:cobblestone",
"minecraft:diorite",
"minecraft:andesite"
]
}

View File

@ -205,6 +205,19 @@ public class DataGeneratorTest
.add(BlockTags.STONE_BRICKS)
.addOptional(BlockTags.getCollection(), new ResourceLocation("chisel", "marble/raw"))
.addOptionalTag(new ResourceLocation("forge", "storage_blocks/ruby"));
// Hopefully sorting issues
getBuilder(new BlockTags.Wrapper(new ResourceLocation(MODID, "thing/one")))
.add(Blocks.COBBLESTONE);
getBuilder(new BlockTags.Wrapper(new ResourceLocation(MODID, "thing/two")))
.add(Blocks.DIORITE);
getBuilder(new BlockTags.Wrapper(new ResourceLocation(MODID, "thing/three")))
.add(Blocks.ANDESITE);
getBuilder(new BlockTags.Wrapper(new ResourceLocation(MODID, "things")))
.add(Blocks.COBBLESTONE)
.add(Blocks.DIORITE)
.add(Blocks.ANDESITE);
}
}