From 4bac1be1f3b5b99c411374d295cc183bfb9c8c89 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 1 Jan 2024 13:54:16 -0500 Subject: [PATCH] fix thread random stuff --- .../quark/content/tools/recipe/SmithingRuneRecipe.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java b/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java index 704925d236..5095f131b5 100644 --- a/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java +++ b/src/main/java/org/violetmoon/quark/content/tools/recipe/SmithingRuneRecipe.java @@ -42,9 +42,9 @@ public final class SmithingRuneRecipe extends SmithingTrimRecipe { // Extends to private final RuneColor runeColor; private static Ingredient used; - private static final RandomSource BASE_INGREDIENT_RANDOM = RandomSource.create(); + private static final RandomSource BASE_INGREDIENT_RANDOM = RandomSource.createThreadSafe(); - private static ItemStack makeEnchantedDisplayItem(ItemStack input, RandomSource random) { + private static ItemStack makeEnchantedDisplayItem(ItemStack input) { ItemStack stack = input.copy(); stack.hideTooltipPart(ItemStack.TooltipPart.ENCHANTMENTS); stack.hideTooltipPart(ItemStack.TooltipPart.MODIFIERS); @@ -53,7 +53,7 @@ private static ItemStack makeEnchantedDisplayItem(ItemStack input, RandomSource stack.enchant(Enchantments.UNBREAKING, 3); // it probably accepts unbreaking anyways return stack; } - return EnchantmentHelper.enchantItem(random, stack, 25, false); + return EnchantmentHelper.enchantItem(BASE_INGREDIENT_RANDOM, stack, 25, false); } private static Ingredient createBaseIngredient() { @@ -70,7 +70,7 @@ private static Ingredient createBaseIngredient() { used = Ingredient.of(displayItems .filter(it -> !(it.getItem() instanceof IDisableable dis) || dis.isEnabled()) - .map(item -> makeEnchantedDisplayItem(item, BASE_INGREDIENT_RANDOM))); + .map(SmithingRuneRecipe::makeEnchantedDisplayItem)); } return used; @@ -108,7 +108,7 @@ public ItemStack assemble(Container container, @Nonnull RegistryAccess registry) @Nonnull @Override public ItemStack getResultItem(@Nonnull RegistryAccess registry) { - ItemStack displayStack = makeEnchantedDisplayItem(new ItemStack(Items.IRON_CHESTPLATE), BASE_INGREDIENT_RANDOM); + ItemStack displayStack = makeEnchantedDisplayItem(new ItemStack(Items.IRON_CHESTPLATE)); ColorRunesModule.withRune(displayStack, runeColor); return displayStack;