Skip to content

Commit

Permalink
Use LinkedHashMap for more reproducibility
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Jul 3, 2024
1 parent 39ee8b5 commit b0bfa3f
Show file tree
Hide file tree
Showing 26 changed files with 145 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static BiomeTintColors generateBiomeTintColors() {
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getColorIntensity(redstoneLevel);
Expand All @@ -51,7 +51,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();
// FIXME: ?
// resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
// resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -149,8 +149,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static BiomeTintColors generateBiomeTintColors() {
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getColorIntensity(redstoneLevel);
Expand All @@ -51,7 +51,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();
// FIXME: ?
// resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
// resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -149,8 +149,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static BiomeTintColors generateBiomeTintColors() {
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getColorIntensity(redstoneLevel);
Expand All @@ -52,7 +52,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();
// FIXME: ?
// resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
// resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -151,8 +151,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getColorIntensity(redstoneLevel);
Expand All @@ -50,7 +50,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -152,8 +152,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
Expand All @@ -53,7 +53,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -160,8 +160,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
Expand All @@ -53,7 +53,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -160,8 +160,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
Expand All @@ -54,7 +54,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -161,8 +161,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List<MaterialInfo> allMaterials,
private static void createCompositeMaterial(Map<String, Map<Item, Float>> allMaterials, List<String> combinedMaterials) {
String compositeMaterialName = String.join(";", combinedMaterials);

Map<Item, Float> resultingToolSpeeds = new HashMap<>();
Map<Item, Float> resultingToolSpeeds = new LinkedHashMap<>();
combinedMaterials.stream()
.map(allMaterials::get)
.forEach(resultingToolSpeeds::putAll);
Expand Down Expand Up @@ -105,14 +105,14 @@ public String getDataName() {
public JsonElement generateDataJson() {
Registry<Item> itemRegistry = Registry.ITEM;

Map<String, Map<Item, Float>> materialMiningSpeeds = new HashMap<>();
Map<String, Map<Item, Float>> materialMiningSpeeds = new LinkedHashMap<>();
materialMiningSpeeds.put("default", ImmutableMap.of());

//Special materials used for shears and swords special mining speed logic
Map<Item, Float> leavesMaterialSpeeds = new HashMap<>();
Map<Item, Float> cowebMaterialSpeeds = new HashMap<>();
Map<Item, Float> plantMaterialSpeeds = new HashMap<>();
Map<Item, Float> gourdMaterialSpeeds = new HashMap<>();
Map<Item, Float> leavesMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> cowebMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> plantMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> gourdMaterialSpeeds = new LinkedHashMap<>();

materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds);
materialMiningSpeeds.put("coweb", cowebMaterialSpeeds);
Expand All @@ -131,7 +131,7 @@ public JsonElement generateDataJson() {
Tag<Block> effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks();
String materialName = makeMaterialNameForTag(effectiveBlocks);

Map<Item, Float> materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>());
Map<Item, Float> materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>());
float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed();
materialSpeeds.put(item, miningSpeed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
Expand All @@ -49,7 +49,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -156,8 +156,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static void createCompositeMaterialInfo(List<MaterialInfo> allMaterials,
private static void createCompositeMaterial(Map<String, Map<Item, Float>> allMaterials, List<String> combinedMaterials) {
String compositeMaterialName = String.join(";", combinedMaterials);

Map<Item, Float> resultingToolSpeeds = new HashMap<>();
Map<Item, Float> resultingToolSpeeds = new LinkedHashMap<>();
combinedMaterials.stream()
.map(allMaterials::get)
.forEach(v -> {
Expand Down Expand Up @@ -108,14 +108,14 @@ public String getDataName() {
public JsonElement generateDataJson() {
Registry<Item> itemRegistry = Registry.ITEM;

Map<String, Map<Item, Float>> materialMiningSpeeds = new HashMap<>();
Map<String, Map<Item, Float>> materialMiningSpeeds = new LinkedHashMap<>();
materialMiningSpeeds.put("default", ImmutableMap.of());

//Special materials used for shears and swords special mining speed logic
Map<Item, Float> leavesMaterialSpeeds = new HashMap<>();
Map<Item, Float> cowebMaterialSpeeds = new HashMap<>();
Map<Item, Float> plantMaterialSpeeds = new HashMap<>();
Map<Item, Float> gourdMaterialSpeeds = new HashMap<>();
Map<Item, Float> leavesMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> cowebMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> plantMaterialSpeeds = new LinkedHashMap<>();
Map<Item, Float> gourdMaterialSpeeds = new LinkedHashMap<>();

materialMiningSpeeds.put(makeMaterialNameForTag(BlockTags.LEAVES), leavesMaterialSpeeds);
materialMiningSpeeds.put("coweb", cowebMaterialSpeeds);
Expand All @@ -134,7 +134,7 @@ public JsonElement generateDataJson() {
Tag<Block> effectiveBlocks = ((MiningToolItemAccessor) toolItem).getEffectiveBlocks();
String materialName = makeMaterialNameForTag(effectiveBlocks);

Map<Item, Float> materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new HashMap<>());
Map<Item, Float> materialSpeeds = materialMiningSpeeds.computeIfAbsent(materialName, k -> new LinkedHashMap<>());
float miningSpeed = ((MiningToolItemAccessor) toolItem).getMiningSpeed();
materialSpeeds.put(item, miningSpeed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static BiomeTintColors generateBiomeTintColors(Registry<Biome> biomeRegis
}

public static Map<Integer, Integer> generateRedstoneTintColors() {
Map<Integer, Integer> resultColors = new HashMap<>();
Map<Integer, Integer> resultColors = new LinkedHashMap<>();

for (int redstoneLevel : RedstoneWireBlock.POWER.getValues()) {
int color = RedstoneWireBlock.getWireColor(redstoneLevel);
Expand All @@ -49,7 +49,7 @@ private static int getBlockColor(Block block) {
}

public static Map<Block, Integer> generateConstantTintColors() {
Map<Block, Integer> resultColors = new HashMap<>();
Map<Block, Integer> resultColors = new LinkedHashMap<>();

resultColors.put(Blocks.BIRCH_LEAVES, FoliageColors.getBirchColor());
resultColors.put(Blocks.SPRUCE_LEAVES, FoliageColors.getSpruceColor());
Expand Down Expand Up @@ -156,8 +156,8 @@ public JsonObject generateDataJson() {
}

public static class BiomeTintColors {
final Map<Integer, List<Biome>> grassColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new HashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new HashMap<>();
final Map<Integer, List<Biome>> grassColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> foliageColoursMap = new LinkedHashMap<>();
final Map<Integer, List<Biome>> waterColourMap = new LinkedHashMap<>();
}
}
Loading

0 comments on commit b0bfa3f

Please sign in to comment.