So I recently removed the whole RNG of Minecraft 1.12.2,
but it's done in MCP.
And I don't know very much about Forge
What i did is just replacing the java.util.Random Import with my custom class.
But there are a few exceptions...
Here is a List:
Every File:
import java.util.Random to import customrng.Random
net.minecraft.client.audio.SoundManager:
String s = MathHelper.getRandomUUID(ThreadLocalRandom.current()).toString();
to
String s = MathHelper.getRandomUUID(new java.util.Random()).toString();
net.minecraft.entity.ai.attributes.AttributeModifier:
this(MathHelper.getRandomUUID(ThreadLocalRandom.current()), nameIn, amountIn, operationIn);
to
this(MathHelper.getRandomUUID(new java.util.Random()), nameIn, amountIn, operationIn);
net.minecraft.entity.Entity:
this.entityUniqueID = MathHelper.getRandomUUID(this.rand);
to
this.entityUniqueID = MathHelper.getRandomUUID(new java.util.Random());
net.minecraft.util.math.MathHelper:
public static UUID getRandomUUID(Random rand)
{
long i = rand.nextLong() & -61441L | 16384L;
long j = rand.nextLong() & 4611686018427387903L | Long.MIN_VALUE;
return new UUID(i, j);
}
/**
* Generates a random UUID using the shared random
*/
public static UUID getRandomUUID()
{
return getRandomUUID(RANDOM);
}
to
public static UUID getRandomUUID(java.util.Random random2)
{
long i = random2.nextLong() & -61441L | 16384L;
long j = random2.nextLong() & 4611686018427387903L | Long.MIN_VALUE;
return new UUID(i, j);
}
/**
* Generates a random UUID using the shared random
*/
public static UUID getRandomUUID()
{
return getRandomUUID(new java.util.Random());
}
net.minecraft.world.biome.BiomeEndDecorator:
Collections.shuffle(list, new Random(p_load_1_.longValue()));
to
Collections.shuffle(list, new java.util.Random(p_load_1_.longValue()));
net.minecraft.world.end.DragonFightManager:
Collections.shuffle(this.gateways, new Random(worldIn.getSeed()));
to
Collections.shuffle(this.gateways, new java.util.Random(worldIn.getSeed()));
net.minecraft.world.gen.structure:
Collections.shuffle(list, p_175836_1_);
to
Collections.shuffle(list, new java.util.Random());
net.minecraft.world.gen.structure.WoodlandMansionPieces:
Collections.shuffle(list, this.field_191117_a);
to
Collections.shuffle(list, new java.util.Random());
net.minecraft.world.storage.loot:
```java
private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand)
{
List<ItemStack> list = Lists.<ItemStack>newArrayList();
Iterator<ItemStack> iterator = stacks.iterator();
while (iterator.hasNext())
{
ItemStack itemstack = iterator.next();
if (itemstack.func_190926_b())
{
iterator.remove();
}
else if (itemstack.func_190916_E() > 1)
{
list.add(itemstack);
iterator.remove();
}
}
p_186463_2_ = p_186463_2_ - stacks.size();
while (p_186463_2_ > 0 && !list.isEmpty())
{
ItemStack itemstack2 = list.remove(MathHelper.getInt(rand, 0, list.size() - 1));
int i = MathHelper.getInt(rand, 1, itemstack2.func_190916_E() / 2);
ItemStack itemstack1 = itemstack2.splitStack(i);
if (itemstack2.func_190916_E() > 1 && rand.nextBoolean())
{
list.add(itemstack2);
}
else
{
stacks.add(itemstack2);
}
if (itemstack1.func_190916_E() > 1 && rand.nextBoolean())
{
list.add(itemstack1);
}
else
{
stacks.add(itemstack1);
}
}
stacks.addAll(list);
Collections.shuffle(stacks, rand);
}
private List<Integer> getEmptySlotsRandomized(IInventory inventory, Random rand)
{
List<Integer> list = Lists.<Integer>newArrayList();
for (int i = 0; i < inventory.getSizeInventory(); ++i)
{
if (inventory.getStackInSlot(i).func_190926_b())
{
list.add(Integer.valueOf(i));
}
}
Collections.shuffle(list, rand);
return list;
}
```
to ```java
private void shuffleItems(List<ItemStack> stacks, int p_186463_2_, Random rand)
{
List<ItemStack> list = Lists.<ItemStack>newArrayList();
Iterator<ItemStack> iterator = stacks.iterator();
while (iterator.hasNext())
{
ItemStack itemstack = iterator.next();
if (itemstack.func_190926_b())
{
iterator.remove();
}
else if (itemstack.func_190916_E() > 1)
{
list.add(itemstack);
iterator.remove();
}
}
p_186463_2_ = p_186463_2_ - stacks.size();
while (p_186463_2_ > 0 && !list.isEmpty())
{
ItemStack itemstack2 = list.remove(MathHelper.getInt(rand, 0, list.size() - 1));
int i = MathHelper.getInt(rand, 1, itemstack2.func_190916_E() / 2);
ItemStack itemstack1 = itemstack2.splitStack(i);
if (itemstack2.func_190916_E() > 1 && rand.nextBoolean())
{
list.add(itemstack2);
}
else
{
stacks.add(itemstack2);
}
if (itemstack1.func_190916_E() > 1 && rand.nextBoolean())
{
list.add(itemstack1);
}
else
{
stacks.add(itemstack1);
}
}
stacks.addAll(list);
Collections.shuffle(stacks, new java.util.Random());
}
private List<Integer> getEmptySlotsRandomized(IInventory inventory, Random rand)
{
List<Integer> list = Lists.<Integer>newArrayList();
for (int i = 0; i < inventory.getSizeInventory(); ++i)
{
if (inventory.getStackInSlot(i).func_190926_b())
{
list.add(Integer.valueOf(i));
}
}
Collections.shuffle(list, new java.util.Random());
return list;
}
```
That's it!
Well i don't know if that is possible or not. (i think not)
If anybody can help me with that ty.
So: I need to transform every Random import with my Class which has to be injected in the Code of Minecraft.
And i need to change a few lines in the code.
Ty 4 your help