Revert slime chunk spawn behavior to pre-changes
This commit is contained in:
parent
81b41d267d
commit
161df68b38
12
README.md
12
README.md
@ -2,7 +2,14 @@
|
|||||||
Better Random
|
Better Random
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Or Better PRNG, is a mod which replace Minecraft's default
|
##### Disclaimer
|
||||||
|
This mod changes RNG, and as such, affects worldgen greatly, so with this mod alone installed vanilla world seeds will no longer
|
||||||
|
be reproducible. If you care about preserving vanilla worldgen parity in your modpack, **refrain** from installing this mod.
|
||||||
|
|
||||||
|
You were warned.
|
||||||
|
|
||||||
|
### About the mod
|
||||||
|
Better Random, or Better PRNG if you prefer, is a mod which replace Minecraft's default
|
||||||
[Linear congruential generator](https://en.wikipedia.org/wiki/Linear_congruential_generator)
|
[Linear congruential generator](https://en.wikipedia.org/wiki/Linear_congruential_generator)
|
||||||
(LCG for short, used for generating most of random game events, as well as generator used when generating world features)
|
(LCG for short, used for generating most of random game events, as well as generator used when generating world features)
|
||||||
and Xoshiro128PlusPlus (used to generate "sequences" aka random generator used for `LootPool`s)
|
and Xoshiro128PlusPlus (used to generate "sequences" aka random generator used for `LootPool`s)
|
||||||
@ -13,6 +20,9 @@ with a better random number generator, [gjrand](https://gjrand.sourceforge.net).
|
|||||||
* Replaces `RandomSequence` and `RandomSequences` with versions which use gjrand;
|
* Replaces `RandomSequence` and `RandomSequences` with versions which use gjrand;
|
||||||
* Replaces `Level#getBlockRandomPos` to use `Level#random`. Previously, `getBlockRandomPos` utilized LCG with even worse properties than one of `Level#random`.
|
* Replaces `Level#getBlockRandomPos` to use `Level#random`. Previously, `getBlockRandomPos` utilized LCG with even worse properties than one of `Level#random`.
|
||||||
|
|
||||||
|
### Caveats:
|
||||||
|
* Slime chunk function was patched to be hardwired to LegacyRandomSource so they don't change with this mod installed.
|
||||||
|
|
||||||
### Compatibility:
|
### Compatibility:
|
||||||
|
|
||||||
Should be compatible with everything that doesn't go around public interfaces vanilla code provide.
|
Should be compatible with everything that doesn't go around public interfaces vanilla code provide.
|
||||||
|
@ -34,7 +34,7 @@ mod_name=Better Random
|
|||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=BSD 2 Clause
|
mod_license=BSD 2 Clause
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.0.0
|
mod_version=1.1.0
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package ru.dbotthepony.mc.prng.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
|
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||||
|
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
|
@Mixin(WorldgenRandom.class)
|
||||||
|
public abstract class WorldgenRandomMixin {
|
||||||
|
@Overwrite
|
||||||
|
public static RandomSource seedSlimeChunk(int chunkX, int chunkZ, long levelSeed, long salt) {
|
||||||
|
return new LegacyRandomSource(
|
||||||
|
levelSeed
|
||||||
|
+ (long)(chunkX * chunkX * 4987142)
|
||||||
|
+ (long)(chunkX * 5947611)
|
||||||
|
+ (long)(chunkZ * chunkZ) * 4392871L
|
||||||
|
+ (long)(chunkZ * 389711)
|
||||||
|
^ salt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,8 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"RandomSourceMixin",
|
"RandomSourceMixin",
|
||||||
"LevelMixin",
|
"LevelMixin",
|
||||||
"ServerLevelMixin"
|
"ServerLevelMixin",
|
||||||
|
"WorldgenRandomMixin"
|
||||||
],
|
],
|
||||||
"client": []
|
"client": []
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user