From c4986eeb82f7cc2e1aad94d7ad5ffce1bcbfc755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sat, 28 Jun 2014 15:50:09 +0200 Subject: [PATCH] Screw nextGaussian, using nextDouble for the random direction when dropping stuff from robots (and other inventories) now, makes for no... outliers, leading to extreme values. Closes #347. --- .../cil/oc/common/tileentity/traits/Inventory.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/li/cil/oc/common/tileentity/traits/Inventory.scala b/src/main/scala/li/cil/oc/common/tileentity/traits/Inventory.scala index e5680655e..758f74810 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/traits/Inventory.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/traits/Inventory.scala @@ -53,13 +53,13 @@ trait Inventory extends TileEntity with inventory.Inventory { def spawnStackInWorld(stack: ItemStack, direction: ForgeDirection) = if (world != null) { val rng = world.rand val (tx, ty, tz) = ( - 0.1 * rng.nextGaussian + direction.offsetX * 0.45, - 0.1 * rng.nextGaussian + direction.offsetY * 0.65 + (direction.offsetX + direction.offsetZ) * 0.1, - 0.1 * rng.nextGaussian + direction.offsetZ * 0.45) + 0.1 * (rng.nextDouble - 0.5) + direction.offsetX * 0.65, + 0.1 * (rng.nextDouble - 0.5) + direction.offsetY * 0.75 + (direction.offsetX + direction.offsetZ) * 0.25, + 0.1 * (rng.nextDouble - 0.5) + direction.offsetZ * 0.65) val entity = new EntityItem(world, x + 0.5 + tx, y + 0.5 + ty, z + 0.5 + tz, stack.copy()) - entity.motionX = 0.0125 * rng.nextGaussian + direction.offsetX * 0.03 - entity.motionY = 0.0125 * rng.nextGaussian + direction.offsetY * 0.08 + (direction.offsetX + direction.offsetZ) * 0.03 - entity.motionZ = 0.0125 * rng.nextGaussian + direction.offsetZ * 0.03 + entity.motionX = 0.0125 * (rng.nextDouble - 0.5) + direction.offsetX * 0.03 + entity.motionY = 0.0125 * (rng.nextDouble - 0.5) + direction.offsetY * 0.08 + (direction.offsetX + direction.offsetZ) * 0.03 + entity.motionZ = 0.0125 * (rng.nextDouble - 0.5) + direction.offsetZ * 0.03 entity.delayBeforeCanPickup = 15 world.spawnEntityInWorld(entity) entity