diff --git a/src/main/java/ca/spottedleaf/moonrise/mixin/random_ticking/BiomeManagerMixin.java b/src/main/java/ca/spottedleaf/moonrise/mixin/random_ticking/BiomeManagerMixin.java new file mode 100644 index 00000000..8975e6e8 --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/mixin/random_ticking/BiomeManagerMixin.java @@ -0,0 +1,18 @@ +package ca.spottedleaf.moonrise.mixin.random_ticking; + +import net.minecraft.world.level.biome.BiomeManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +@Mixin(BiomeManager.class) +abstract class BiomeManagerMixin { + + /** + * @reason Replace floorMod and double division to optimise the function + * @author Spottedleaf + */ + @Overwrite + public static double getFiddle(final long seed) { + return (double)(((seed >> 24) & (1024 - 1)) - (1024/2)) * (0.9 / 1024.0); + } +} diff --git a/src/main/resources/moonrise.mixins.json b/src/main/resources/moonrise.mixins.json index 42e62267..67ee622c 100644 --- a/src/main/resources/moonrise.mixins.json +++ b/src/main/resources/moonrise.mixins.json @@ -91,6 +91,7 @@ "poi_lookup.AcquirePoiMixin", "poi_lookup.PoiManagerMixin", "poi_lookup.PortalForcerMixin", + "random_ticking.BiomeManagerMixin", "random_ticking.BiomeMixin", "random_ticking.LevelMixin", "random_ticking.ServerLevelMixin",