fixed robots always dropping items forward into the world (even for dropUp and dropDown)

This commit is contained in:
Florian Nücke 2014-03-23 11:06:52 +01:00
parent ceab755f72
commit a042b71a15
4 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,9 @@ import li.cil.oc.api.network.{Node, Analyzable}
import li.cil.oc.client.Sound
import li.cil.oc.common.tileentity.RobotProxy
import li.cil.oc.server.driver
import li.cil.oc.server.{PacketSender => ServerPacketSender}
import li.cil.oc.Settings
import li.cil.oc.util.ExtendedNBT._
import li.cil.oc.util.mods.Waila
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.nbt.{NBTTagString, NBTTagCompound}

View File

@ -54,11 +54,11 @@ trait Inventory extends TileEntity with inventory.Inventory {
val rng = world.rand
val (tx, ty, tz) = (
0.1 * rng.nextGaussian + direction.offsetX * 0.45,
0.1 * rng.nextGaussian + 0.1,
0.1 * rng.nextGaussian + direction.offsetY * 0.65 + (direction.offsetX + direction.offsetZ) * 0.1,
0.1 * rng.nextGaussian + direction.offsetZ * 0.45)
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 + 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.delayBeforeCanPickup = 15
world.spawnEntityInWorld(entity)

View File

@ -290,7 +290,7 @@ class Player(val robot: tileentity.Robot) extends EntityPlayer(robot.world, Sett
}
override def dropPlayerItemWithRandomChoice(stack: ItemStack, inPlace: Boolean) =
robot.spawnStackInWorld(stack, if (inPlace) ForgeDirection.UNKNOWN else robot.facing)
robot.spawnStackInWorld(stack, if (inPlace) ForgeDirection.UNKNOWN else facing)
private def callUsingItemInSlot[T](slot: Int, f: (ItemStack) => T, repair: Boolean = true) = {
val itemsBefore = adjacentItems

View File

@ -211,7 +211,6 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
return result(true)
}
}
// TODO Drop into the direction of the call (i.e. down if dropDown).
player.dropPlayerItemWithRandomChoice(dropped, inPlace = false)
context.pause(Settings.get.dropDelay)
result(true)