mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-18 14:50:56 +00:00
add BeeMoveGoalsUnsynchronizedRandomAccessFix
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package com.dfsek.terra.fabric.mixin.fix;
|
||||||
|
|
||||||
|
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||||
|
import com.dfsek.terra.fabric.util.FabricUtil;
|
||||||
|
|
||||||
|
import net.minecraft.entity.passive.BeeEntity.MoveToFlowerGoal;
|
||||||
|
import net.minecraft.entity.passive.BeeEntity.MoveToHiveGoal;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.random.CheckedRandom;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bees spawning uses world.random without synchronization. This causes issues when spawning bees during world generation.
|
||||||
|
*/
|
||||||
|
@Mixin({
|
||||||
|
MoveToHiveGoal.class,
|
||||||
|
MoveToFlowerGoal.class
|
||||||
|
})
|
||||||
|
public class BeeMoveGoalsUnsynchronizedRandomAccessFix {
|
||||||
|
@Redirect(method = "<init>", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;random:Lnet/minecraft/util/math/random/Random;"))
|
||||||
|
public Random redirectRandomAccess(World instance) {
|
||||||
|
return new CheckedRandom(FabricEntryPoint.getPlatform().getServer().getTicks()); // replace with new random seeded by tick time.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,12 @@
|
|||||||
"access.MobSpawnerLogicAccessor",
|
"access.MobSpawnerLogicAccessor",
|
||||||
"access.StateAccessor",
|
"access.StateAccessor",
|
||||||
"access.StructureAccessorAccessor",
|
"access.StructureAccessorAccessor",
|
||||||
|
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
||||||
|
"fix.NetherFossilOptimization",
|
||||||
"implementations.cache.ChunkRegionMixin",
|
"implementations.cache.ChunkRegionMixin",
|
||||||
"implementations.cache.ProtoChunkMixin",
|
"implementations.cache.ProtoChunkMixin",
|
||||||
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
||||||
"implementations.entity_holder.ProtoChunkMixin",
|
"implementations.entity_holder.ProtoChunkMixin",
|
||||||
"fix.NetherFossilOptimization",
|
|
||||||
"implementations.terra.BiomeMixin",
|
"implementations.terra.BiomeMixin",
|
||||||
"implementations.terra.HandleImplementationMixin",
|
"implementations.terra.HandleImplementationMixin",
|
||||||
"implementations.terra.block.BlockMixin",
|
"implementations.terra.block.BlockMixin",
|
||||||
|
|||||||
Reference in New Issue
Block a user