Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8.9

# Conflicts:
#	src/main/scala/li/cil/oc/server/command/SpawnComputerCommand.scala
This commit is contained in:
Florian Nücke 2016-04-02 21:49:30 +02:00
commit 82edd9567d

View File

@ -41,15 +41,35 @@ object SpawnComputerCommand extends SimpleCommand("oc_spawnComputer") {
return
}
def rotateProperly(pos: BlockPosition):tileentity.traits.Rotatable = {
world.getTileEntity(pos) match {
case rotatable: tileentity.traits.Rotatable =>
rotatable.setFromEntityPitchAndYaw(player)
if (!rotatable.validFacings.contains(rotatable.pitch)) {
rotatable.pitch = rotatable.validFacings.headOption.getOrElse(EnumFacing.NORTH)
}
rotatable.invertRotation()
rotatable
case _ => null // not rotatable
}
}
world.setBlock(casePos, api.Items.get(Constants.BlockName.CaseCreative).block())
rotateProperly(casePos)
world.setBlock(screenPos, api.Items.get(Constants.BlockName.ScreenTier2).block())
world.setBlock(keyboardPos, api.Items.get(Constants.BlockName.Keyboard).block())
world.getTileEntity(keyboardPos) match {
case t: tileentity.traits.Rotatable => t.setFromFacing(EnumFacing.UP)
rotateProperly(screenPos) match {
case rotatable: tileentity.traits.Rotatable => rotatable.pitch match {
case EnumFacing.UP | EnumFacing.DOWN =>
rotatable.pitch = EnumFacing.NORTH
case _ => // nothing to do here, pitch is fine
}
case _ => // ???
}
world.getTileEntity(screenPos) match {
case t: tileentity.traits.Rotatable => t.setFromFacing(EnumFacing.NORTH)
world.setBlock(keyboardPos, api.Items.get(Constants.BlockName.Keyboard).block())
world.getTileEntity(keyboardPos) match {
case t: tileentity.traits.Rotatable =>
t.setFromEntityPitchAndYaw(player)
t.setFromFacing(EnumFacing.UP)
case _ => // ???
}