Skip to content

Commit

Permalink
Fix random bias (#9919)
Browse files Browse the repository at this point in the history
Fix random to also do negative direction
  • Loading branch information
someaddons authored Apr 14, 2024
1 parent 0c6d56d commit 5099aba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/minecolonies/api/util/BlockPosUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public static CompoundTag writeOptional(
public static BlockPos getRandomPosAround(final BlockPos center, final int distance)
{
final Vec3 vec =
new Vec3(ColonyConstants.rand.nextDouble(), ColonyConstants.rand.nextDouble(), ColonyConstants.rand.nextDouble()).normalize().multiply(distance, distance, distance);
new Vec3(ColonyConstants.rand.nextDouble() - 0.5, ColonyConstants.rand.nextDouble() - 0.5, ColonyConstants.rand.nextDouble() - 0.5).normalize()
.multiply(distance, distance, distance);
return new BlockPos((int) Math.round(center.getX() + vec.x), (int) Math.round(center.getY() + vec.y), (int) Math.round(center.getZ() + vec.z));
}

Expand Down

0 comments on commit 5099aba

Please # to comment.