|
8 | 8 | import codechicken.microblock.part.MicroblockPart; |
9 | 9 | import codechicken.microblock.util.MaskedCuboid; |
10 | 10 | import codechicken.multipart.util.PartRayTraceResult; |
| 11 | +import net.covers1624.quack.collection.FastStream; |
11 | 12 | import net.minecraft.client.Minecraft; |
12 | 13 | import net.minecraft.client.multiplayer.ClientLevel; |
13 | 14 | import net.minecraft.client.particle.ParticleEngine; |
|
31 | 32 | import net.minecraft.world.level.block.state.properties.Property; |
32 | 33 | import org.jetbrains.annotations.Nullable; |
33 | 34 |
|
| 35 | +import java.util.Comparator; |
| 36 | +import java.util.HashMap; |
34 | 37 | import java.util.List; |
35 | 38 | import java.util.Map; |
36 | 39 | import java.util.function.Consumer; |
@@ -172,7 +175,11 @@ public static ResourceLocation makeMaterialKey(BlockState state) { |
172 | 175 | if (!state.getProperties().isEmpty()) { |
173 | 176 | path.append("//"); |
174 | 177 |
|
175 | | - for (Map.Entry<Property<?>, Comparable<?>> entry : state.getValues().entrySet()) { |
| 178 | + // Stable sort all keys based off their name, otherwise they may differ on the server/client. |
| 179 | + Map<Property<?>, Comparable<?>> entries = FastStream.of(state.getValues().entrySet()) |
| 180 | + .sorted(Comparator.comparing(e -> e.getKey().getName())) |
| 181 | + .toMap(Map.Entry::getKey, Map.Entry::getValue); |
| 182 | + for (Map.Entry<Property<?>, Comparable<?>> entry : entries.entrySet()) { |
176 | 183 | Property<?> property = entry.getKey(); |
177 | 184 | if (path.charAt(path.length() - 2) != '/') { |
178 | 185 | path.append('/'); |
|
0 commit comments