Replace getBlockRandomPos implementation
This commit is contained in:
parent
85e7505d30
commit
0ae2319ddc
18
src/main/java/ru/dbotthepony/mc/prng/mixin/LevelMixin.java
Normal file
18
src/main/java/ru/dbotthepony/mc/prng/mixin/LevelMixin.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package ru.dbotthepony.mc.prng.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
|
@Mixin(Level.class)
|
||||||
|
public abstract class LevelMixin {
|
||||||
|
@Overwrite
|
||||||
|
public BlockPos getBlockRandomPos(int x, int y, int z, int yMask) {
|
||||||
|
long value = ((Level) (Object) this).random.nextLong();
|
||||||
|
int selectX = (int) (value & 15);
|
||||||
|
int selectZ = (int) ((value >>> 8) & 15);
|
||||||
|
int selectY = (int) ((value >>> 16) & yMask);
|
||||||
|
return new BlockPos(selectX + x, selectY + y, selectZ + z);
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,8 @@
|
|||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"RandomSourceMixin"
|
"RandomSourceMixin",
|
||||||
|
"LevelMixin"
|
||||||
],
|
],
|
||||||
"client": []
|
"client": []
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user