Skip to content

Commit

Permalink
Remove random
Browse files Browse the repository at this point in the history
  • Loading branch information
Thodor12 committed Nov 17, 2024
1 parent cd0c90b commit c23c2e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.gson.JsonObject;
import com.minecolonies.api.colony.requestsystem.StandardFactoryController;
import com.minecolonies.api.crafting.ItemStorage;
import com.minecolonies.api.util.MathUtils;
import com.minecolonies.core.Network;
import com.minecolonies.core.datalistener.model.Disease;
import com.minecolonies.core.network.messages.client.colony.GlobalDiseaseSyncMessage;
Expand Down Expand Up @@ -133,13 +134,12 @@ public static Disease getDisease(final ResourceLocation id)
/**
* Get a random disease from the list of diseases.
*
* @param random the random provider.
* @return the random disease instance or null if no diseases exist.
*/
@Nullable
public static Disease getRandomDisease(final RandomSource random)
public static Disease getRandomDisease()
{
return DISEASES.next(random);
return DISEASES.next(MathUtils.RANDOM);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void tick()

if (citizen.getRandom().nextInt(configModifier * DISEASE_FACTOR) < citizenModifier * 10)
{
this.disease = DiseasesListener.getRandomDisease(citizen.getRandom());
this.disease = DiseasesListener.getRandomDisease();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.minecolonies.core.util;

import net.minecraft.util.RandomSource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -56,7 +55,7 @@ public void add(double weight, K key, E result)
* @return the underlying random.
*/
@Nullable
public E next(final RandomSource random)
public E next(final Random random)
{
final double value = random.nextDouble() * total;
final Entry<Double, E> entry = map.higherEntry(value);
Expand Down

0 comments on commit c23c2e2

Please sign in to comment.