Skip to content

Commit

Permalink
fix: incorrect random instance derive
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Apr 22, 2023
1 parent 96857e1 commit c0ac08e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import net.minecraft.util.math.random.LocalRandom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(LocalRandom.class)
public interface ISimpleRandom {

@Accessor
long getSeed();

@Accessor
void setSeed(long seed);
@Invoker
void invokeSetSeed(long seed);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void derive(RandomSplitter deriver, Random random, int x, int y, i
if (deriver instanceof CheckedRandom.Splitter) {
final ISimpleRandom random1 = (ISimpleRandom) random;
final IAtomicSimpleRandomDeriver deriver1 = (IAtomicSimpleRandomDeriver) deriver;
random1.setSeed(MathHelper.hashCode(x, y, z) ^ deriver1.getSeed());
random1.invokeSetSeed(MathHelper.hashCode(x, y, z) ^ deriver1.getSeed());
return;
}
throw new IllegalArgumentException();
Expand Down

0 comments on commit c0ac08e

Please sign in to comment.